Image decoder for image data stored in TGA file format. Currently only the original TGA file format is supported. This is because the new TGA format has data at the end of the file, getting to the end of a file in an InputStream orient environment presents several difficulties which are avoided at the moment.
This is a simple decoder and is only setup to load a single image from the input stream
| Modifier and Type | Class and Description |
|---|---|
| public static class | TGAImage.
This class reads in all of the TGA image header in addition it also reads in the imageID field as it is convenient to handle that here. |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private ByteBuffer | |
| private int | |
| private final TGAImage. |
| Modifier and Type | Method and Description |
|---|---|
| public static TGAImage | createFromData(final int width, final int height, final boolean hasAlpha, final boolean topToBottom, final ByteBuffer data)
Creates a TGAImage from data supplied by the end user. |
| private void | decodeImage(final GLProfile glp, final LEDataInputStream dIn)
Identifies the image type of the tga image data and loads it into the JimiImage structure. |
| private void | decodeRGBImageRLE24_32(final GLProfile glp, final LEDataInputStream dIn)
This assumes that the body is for a 24 bit or 32 bit for a RGB or ARGB image respectively. |
| private void | decodeRGBImageU24_32(final GLProfile glp, final LEDataInputStream dIn)
This assumes that the body is for a 24 bit or 32 bit for a RGB or ARGB image respectively. |
| public int | |
| public ByteBuffer | getData()
Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D. |
| public int | |
| public int | |
| public int | |
| public static TGAImage | |
| public static TGAImage | |
| private void | |
| private static void | |
| public void | |
| public void |
| bpp | back to summary |
|---|---|
| private int bpp | |
| data | back to summary |
|---|---|
| private ByteBuffer data | |
| format | back to summary |
|---|---|
| private int format | |
| header | back to summary |
|---|---|
| private final TGAImage. | |
| TGAImage | back to summary |
|---|---|
| private TGAImage(final TGAImage. | |
| createFromData | back to summary |
|---|---|
| public static TGAImage createFromData(final int width, final int height, final boolean hasAlpha, final boolean topToBottom, final ByteBuffer data) Creates a TGAImage from data supplied by the end user. Shares data with the passed ByteBuffer. Assumes the data is already in the correct byte order for writing to disk, i.e., BGR or BGRA. | |
| decodeImage | back to summary |
|---|---|
| private void decodeImage(final GLProfile glp, final LEDataInputStream dIn) throws IOException Identifies the image type of the tga image data and loads it into the JimiImage structure. This was taken from the prototype and modified for the new Jimi structure | |
| decodeRGBImageRLE24_32 | back to summary |
|---|---|
| private void decodeRGBImageRLE24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException This assumes that the body is for a 24 bit or 32 bit for a RGB or ARGB image respectively. | |
| decodeRGBImageU24_32 | back to summary |
|---|---|
| private void decodeRGBImageU24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException This assumes that the body is for a 24 bit or 32 bit for a RGB or ARGB image respectively. | |
| getBytesPerPixel | back to summary |
|---|---|
| public int getBytesPerPixel() Returns the bytes per pixel | |
| getData | back to summary |
|---|---|
| public ByteBuffer getData() Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D. | |
| getGLFormat | back to summary |
|---|---|
| public int getGLFormat() Returns the OpenGL format for this texture; e.g. GL.GL_BGR or GL.GL_BGRA. | |
| getHeight | back to summary |
|---|---|
| public int getHeight() Returns the height of the image. | |
| getWidth | back to summary |
|---|---|
| public int getWidth() Returns the width of the image. | |
| read | back to summary |
|---|---|
| public static TGAImage read(final GLProfile glp, final String filename) throws IOException Reads a Targa image from the specified file. | |
| read | back to summary |
|---|---|
| public static TGAImage read(final GLProfile glp, final InputStream in) throws IOException Reads a Targa image from the specified InputStream. | |
| setupImage24_32 | back to summary |
|---|---|
| private void setupImage24_32(final GLProfile glp) | |
| swapBGR | back to summary |
|---|---|
| private static void swapBGR(final byte[] data, final int bWidth, final int height, final int bpp) | |
| write | back to summary |
|---|---|
| public void write(final String filename) throws IOException Writes the image in Targa format to the specified file name. | |
| write | back to summary |
|---|---|
| public void write(final File file) throws IOException Writes the image in Targa format to the specified file. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| private byte | |
| private int | |
| public static final int | |
| private int | |
| private int | firstEntryIndex
TGA image colour map fields |
| private int | |
| public static final int | |
| public static final int | I_NOTINTERLEAVED
Field image descriptor / interleave values |
| public static final int | |
| public static final int | ID_ATTRIBPERPIXEL
Field image descriptor bitfield values definitions |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | idLength
initial TGA image data fields |
| private byte | |
| private String | |
| private byte[] | |
| private int | |
| public static final int | NO_IMAGE
Set of possible image types in TGA file |
| private byte | |
| private final int | tgaType
Type of this TGA file format |
| public static final int | |
| public static final int | TYPE_NEW
Set of possible file format TGA types |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | |
| private int | xOrigin
TGA image specification fields |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public byte | |
| public byte | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public byte | |
| public String | |
| public byte[] | |
| public int | |
| public byte | |
| public byte | |
| public boolean | |
| public int | |
| public int | |
| public boolean | |
| public String | |
| public int | |
| private void | |
| public int | |
| public int |
| BLACKWHITE | back to summary |
|---|---|
| public static final int BLACKWHITE | |
| colorMapEntrySize | back to summary |
|---|---|
| private byte colorMapEntrySize | |
| colorMapLength | back to summary |
|---|---|
| private int colorMapLength | |
| COLORMAPPED | back to summary |
|---|---|
| public static final int COLORMAPPED | |
| colorMapType | back to summary |
|---|---|
| private int colorMapType | |
| firstEntryIndex | back to summary |
|---|---|
| private int firstEntryIndex TGA image colour map fields | |
| height | back to summary |
|---|---|
| private int height | |
| I_FOURWAY | back to summary |
|---|---|
| public static final int I_FOURWAY | |
| I_NOTINTERLEAVED | back to summary |
|---|---|
| public static final int I_NOTINTERLEAVED Field image descriptor / interleave values | |
| I_TWOWAY | back to summary |
|---|---|
| public static final int I_TWOWAY | |
| ID_ATTRIBPERPIXEL | back to summary |
|---|---|
| public static final int ID_ATTRIBPERPIXEL Field image descriptor bitfield values definitions | |
| ID_INTERLEAVE | back to summary |
|---|---|
| public static final int ID_INTERLEAVE | |
| ID_RIGHTTOLEFT | back to summary |
|---|---|
| public static final int ID_RIGHTTOLEFT | |
| ID_TOPTOBOTTOM | back to summary |
|---|---|
| public static final int ID_TOPTOBOTTOM | |
| idLength | back to summary |
|---|---|
| private int idLength initial TGA image data fields | |
| imageDescriptor | back to summary |
|---|---|
| private byte imageDescriptor | |
| imageID | back to summary |
|---|---|
| private String imageID | |
| imageIDbuf | back to summary |
|---|---|
| private byte[] imageIDbuf | |
| imageType | back to summary |
|---|---|
| private int imageType | |
| NO_IMAGE | back to summary |
|---|---|
| public static final int NO_IMAGE Set of possible image types in TGA file | |
| pixelDepth | back to summary |
|---|---|
| private byte pixelDepth | |
| tgaType | back to summary |
|---|---|
| private final int tgaType Type of this TGA file format | |
| TRUECOLOR | back to summary |
|---|---|
| public static final int TRUECOLOR | |
| TYPE_NEW | back to summary |
|---|---|
| public static final int TYPE_NEW Set of possible file format TGA types | |
| TYPE_OLD | back to summary |
|---|---|
| public static final int TYPE_OLD | |
| TYPE_UNK | back to summary |
|---|---|
| public static final int TYPE_UNK | |
| UBLACKWHITE | back to summary |
|---|---|
| public static final int UBLACKWHITE | |
| UCOLORMAPPED | back to summary |
|---|---|
| public static final int UCOLORMAPPED | |
| UTRUECOLOR | back to summary |
|---|---|
| public static final int UTRUECOLOR | |
| width | back to summary |
|---|---|
| private int width | |
| xOrigin | back to summary |
|---|---|
| private int xOrigin TGA image specification fields | |
| yOrigin | back to summary |
|---|---|
| private int yOrigin | |
| Header | back to summary |
|---|---|
| pack-priv Header() | |
| Header | back to summary |
|---|---|
| pack-priv Header(final LEDataInputStream in) throws IOException | |
| attribPerPixel | back to summary |
|---|---|
| public byte attribPerPixel() bitfields in imageDescriptor | |
| colorMapEntrySize | back to summary |
|---|---|
| public byte colorMapEntrySize() | |
| colorMapLength | back to summary |
|---|---|
| public int colorMapLength() | |
| colorMapType | back to summary |
|---|---|
| public int colorMapType() | |
| firstEntryIndex | back to summary |
|---|---|
| public int firstEntryIndex() TGA image colour map fields | |
| height | back to summary |
|---|---|
| public int height() | |
| idLength | back to summary |
|---|---|
| public int idLength() initial TGA image data fields | |
| imageDescriptor | back to summary |
|---|---|
| public byte imageDescriptor() | |
| imageID | back to summary |
|---|---|
| public String imageID() | |
| imageIDbuf | back to summary |
|---|---|
| public byte[] imageIDbuf() | |
| imageType | back to summary |
|---|---|
| public int imageType() | |
| interleave | back to summary |
|---|---|
| public byte interleave() | |
| pixelDepth | back to summary |
|---|---|
| public byte pixelDepth() | |
| rightToLeft | back to summary |
|---|---|
| public boolean rightToLeft() | |
| size | back to summary |
|---|---|
| public int size() | |
| tgaType | back to summary |
|---|---|
| public int tgaType() | |
| topToBottom | back to summary |
|---|---|
| public boolean topToBottom() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| width | back to summary |
|---|---|
| public int width() | |
| write | back to summary |
|---|---|
| private void write(final ByteBuffer buf) | |
| xOrigin | back to summary |
|---|---|
| public int xOrigin() TGA image specification fields | |
| yOrigin | back to summary |
|---|---|
| public int yOrigin() | |