public class TGAImage extends Object
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 |
---|---|
static class |
TGAImage.Header
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 | Method and Description |
---|---|
static TGAImage |
createFromData(int width,
int height,
boolean hasAlpha,
boolean topToBottom,
ByteBuffer data)
Creates a TGAImage from data supplied by the end user.
|
int |
getBytesPerPixel()
Returns the bytes per pixel
|
ByteBuffer |
getData()
Returns the raw data for this texture in the correct
(bottom-to-top) order for calls to glTexImage2D.
|
int |
getGLFormat()
Returns the OpenGL format for this texture; e.g.
|
int |
getHeight()
Returns the height of the image.
|
int |
getWidth()
Returns the width of the image.
|
static TGAImage |
read(GLProfile glp,
InputStream in)
Reads a Targa image from the specified InputStream.
|
static TGAImage |
read(GLProfile glp,
String filename)
Reads a Targa image from the specified file.
|
void |
write(File file)
Writes the image in Targa format to the specified file.
|
void |
write(String filename)
Writes the image in Targa format to the specified file name.
|
public int getWidth()
public int getHeight()
public int getGLFormat()
public int getBytesPerPixel()
public ByteBuffer getData()
public static TGAImage read(GLProfile glp, String filename) throws IOException
IOException
public static TGAImage read(GLProfile glp, InputStream in) throws IOException
IOException
public void write(String filename) throws IOException
IOException
public void write(File file) throws IOException
IOException
public static TGAImage createFromData(int width, int height, boolean hasAlpha, boolean topToBottom, ByteBuffer data)
Copyright 2010 JogAmp Community.