JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.texture.spi.TGAImage Class Reference

Targa image reader and writer adapted from sources of the Jimi image I/O class library. More...

Collaboration diagram for com.jogamp.opengl.util.texture.spi.TGAImage:

Classes

class  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. More...
 

Public Member Functions

int getWidth ()
 Returns the width of the image. More...
 
int getHeight ()
 Returns the height of the image. More...
 
int getGLFormat ()
 Returns the OpenGL format for this texture; e.g. More...
 
int getBytesPerPixel ()
 Returns the bytes per pixel. More...
 
ByteBuffer getData ()
 Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D. More...
 
void write (final String filename) throws IOException
 Writes the image in Targa format to the specified file name. More...
 
void write (final File file) throws IOException
 Writes the image in Targa format to the specified file. More...
 

Static Public Member Functions

static TGAImage read (final GLProfile glp, final String filename) throws IOException
 Reads a Targa image from the specified file. More...
 
static TGAImage read (final GLProfile glp, final InputStream in) throws IOException
 Reads a Targa image from the specified InputStream. More...
 
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. More...
 

Detailed Description

Targa image reader and writer adapted from sources of the Jimi image I/O class library.

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

Author
Robin Luiten
Kenneth Russell
Version
Revision
1768

Definition at line 73 of file TGAImage.java.

Member Function Documentation

◆ createFromData()

static TGAImage com.jogamp.opengl.util.texture.spi.TGAImage.createFromData ( final int  width,
final int  height,
final boolean  hasAlpha,
final boolean  topToBottom,
final ByteBuffer  data 
)
static

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.

Definition at line 440 of file TGAImage.java.

◆ getBytesPerPixel()

int com.jogamp.opengl.util.texture.spi.TGAImage.getBytesPerPixel ( )

Returns the bytes per pixel.

Definition at line 394 of file TGAImage.java.

◆ getData()

ByteBuffer com.jogamp.opengl.util.texture.spi.TGAImage.getData ( )

Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D.

Definition at line 398 of file TGAImage.java.

◆ getGLFormat()

int com.jogamp.opengl.util.texture.spi.TGAImage.getGLFormat ( )

Returns the OpenGL format for this texture; e.g.

GL.GL_BGR or GL.GL_BGRA.

Definition at line 391 of file TGAImage.java.

◆ getHeight()

int com.jogamp.opengl.util.texture.spi.TGAImage.getHeight ( )

Returns the height of the image.

Definition at line 388 of file TGAImage.java.

◆ getWidth()

int com.jogamp.opengl.util.texture.spi.TGAImage.getWidth ( )

Returns the width of the image.

Definition at line 385 of file TGAImage.java.

◆ read() [1/2]

static TGAImage com.jogamp.opengl.util.texture.spi.TGAImage.read ( final GLProfile  glp,
final InputStream  in 
) throws IOException
static

Reads a Targa image from the specified InputStream.

Definition at line 406 of file TGAImage.java.

◆ read() [2/2]

static TGAImage com.jogamp.opengl.util.texture.spi.TGAImage.read ( final GLProfile  glp,
final String  filename 
) throws IOException
static

Reads a Targa image from the specified file.

Definition at line 401 of file TGAImage.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [1/2]

void com.jogamp.opengl.util.texture.spi.TGAImage.write ( final File  file) throws IOException

Writes the image in Targa format to the specified file.

Definition at line 421 of file TGAImage.java.

Here is the call graph for this function:

◆ write() [2/2]

void com.jogamp.opengl.util.texture.spi.TGAImage.write ( final String  filename) throws IOException

Writes the image in Targa format to the specified file name.

Definition at line 416 of file TGAImage.java.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: