## com.lowagie.text.rtf.graphic
Class RtfImage

    java.lang.Object
      com.lowagie.text.rtf.RtfElement
          com.lowagie.text.rtf.graphic.RtfImage

All Implemented Interfaces:
  RtfBasicElement

    public class RtfImage

extends RtfElement

The RtfImage contains one image. Supported image types are jpeg, png, wmf, bmp.

Version:
  $Revision: 1.23 $
Author:
  Mark Hall (mhall@edu.uni-klu.ac.at), Paulo Soares

Field Summary
`private int` `alignment` The alignment of this picture
`private float` `height` The height of this picutre
`private byte[]` `image` The actual image.
`private int` `imageType` The type of image this is.
`private static byte[]` `PICTURE` Constant for a picture
`private static byte[]` `PICTURE_BMP` Constant for a bmp image
`private static byte[]` `PICTURE_GROUP` Constant for the shape/picture group
`private static byte[]` `PICTURE_HEIGHT` Constant for the picture height
`private static byte[]` `PICTURE_JPEG` Constant for a jpeg image
`private static byte[]` `PICTURE_PNG` Constant for a png image
`private static byte[]` `PICTURE_SCALED_HEIGHT` Constant for the picture height scale
`private static byte[]` `PICTURE_SCALED_WIDTH` Constant for the picture width scale
`private static byte[]` `PICTURE_WIDTH` Constant for the picture width
`private static byte[]` `PICTURE_WMF` Constant for a wmf image
`private float` `plainHeight` The intended display height of this picture
`private float` `plainWidth` The intended display width of this picture
`private boolean` `topLevelElement` Whether this RtfImage is a top level element and should be an extra paragraph.
`private float` `width` The width of this picture

Fields inherited from class com.lowagie.text.rtf.RtfElement
`document, inHeader, inTable`

Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
`CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR`

Constructor Summary
`RtfImage(RtfDocument doc, Image image)` Constructs a RtfImage for an Image.

Method Summary
`private byte[]` `getImage(Image image)` Extracts the image data from the Image.
`void` `setAlignment(int alignment)` Sets the alignment of this RtfImage.
`void` `setTopLevelElement(boolean topLevelElement)` Set whether this RtfImage should behave like a top level element and enclose itself in a paragraph.
`byte[]` `write()` Writes the RtfImage content

Methods inherited from class com.lowagie.text.rtf.RtfElement
`intToByteArray, isInTable, setInHeader, setInTable, setRtfDocument`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PICTURE_GROUP

    private static final byte[] PICTURE_GROUP

  Constant for the shape/picture group

### PICTURE

    private static final byte[] PICTURE

  Constant for a picture

### PICTURE_JPEG

    private static final byte[] PICTURE_JPEG

  Constant for a jpeg image

### PICTURE_PNG

    private static final byte[] PICTURE_PNG

  Constant for a png image

### PICTURE_BMP

    private static final byte[] PICTURE_BMP

  Constant for a bmp image

### PICTURE_WMF

    private static final byte[] PICTURE_WMF

  Constant for a wmf image

### PICTURE_WIDTH

    private static final byte[] PICTURE_WIDTH

  Constant for the picture width

### PICTURE_HEIGHT

    private static final byte[] PICTURE_HEIGHT

  Constant for the picture height

### PICTURE_SCALED_WIDTH

    private static final byte[] PICTURE_SCALED_WIDTH

  Constant for the picture width scale

### PICTURE_SCALED_HEIGHT

    private static final byte[] PICTURE_SCALED_HEIGHT

  Constant for the picture height scale

### imageType

    private int imageType

  The type of image this is.

### image

    private byte[] image

  The actual image. Already formated for direct inclusion in the rtf document

### alignment

    private int alignment

  The alignment of this picture

### width

    private float width

  The width of this picture

### height

    private float height

  The height of this picutre

### plainWidth

    private float plainWidth

  The intended display width of this picture

### plainHeight

    private float plainHeight

  The intended display height of this picture

### topLevelElement

    private boolean topLevelElement

  Whether this RtfImage is a top level element and should be an extra paragraph.

Constructor Detail

### RtfImage

    public RtfImage(RtfDocument doc,
                    Image image)
             throws DocumentException

  Constructs a RtfImage for an Image.

  Parameters:
    `doc` - The RtfDocument this RtfImage belongs to
    `image` - The Image that this RtfImage wraps
  Throws:
    `DocumentException` - If an error occured accessing the image content

Method Detail

### getImage

    private byte[] getImage(Image image)
                     throws DocumentException

  Extracts the image data from the Image. The data is formated for direct inclusion in a rtf document

  Parameters:
    `image` - The Image for which to extract the content
  Returns:
    The image data formated for the rtf document
  Throws:
    `DocumentException` - If an error occurs accessing the image content

### write

    public byte[] write()

  Writes the RtfImage content

  Specified by:
    `write` in interface `RtfBasicElement`
  Overrides:
    `write` in class `RtfElement`
  Returns:
    the RtfImage content

### setAlignment

    public void setAlignment(int alignment)

  Sets the alignment of this RtfImage. Uses the alignments from com.lowagie.text.Element.

  Parameters:
    `alignment` - The alignment to use.

### setTopLevelElement

    public void setTopLevelElement(boolean topLevelElement)

  Set whether this RtfImage should behave like a top level element and enclose itself in a paragraph.

  Parameters:
    `topLevelElement` - Whether to behave like a top level element.