# TGAImageData (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.opengl
Class TGAImageData

    java.lang.Object
      org.newdawn.slick.opengl.TGAImageData

All Implemented Interfaces:
  ImageData, LoadableImageData

    public class TGAImageData

extends java.lang.Object
implements LoadableImageData

A utility to load TGAs. Note: NOT THREAD SAFE Fresh cut of code but largely influeneced by the TGA loading class provided as part of the Java Monkey Engine (JME). Why not check out what they're doing over at http://www.jmonkeyengine.com. kudos to Mark Powell.

Author:
  Kevin Glass

Constructor Summary
`TGAImageData()` Create a new TGA Loader

Method Summary
`void` `configureEdging(boolean edging)` Configure the edging that can be used to make texture edges loop more cleanly
`int` `getDepth()` Get the last bit depth read from a TGA
`int` `getHeight()` Get the last height read from a TGA
`java.nio.ByteBuffer` `getImageBufferData()` Get the store image
`int` `getTexHeight()` Get the ast required texture height for a loaded image
`int` `getTexWidth()` Get the last required texture width for a loaded image
`int` `getWidth()` Get the last width read from a TGA
`java.nio.ByteBuffer` `loadImage(java.io.InputStream fis)` Load a image from the specified stream
`java.nio.ByteBuffer` `loadImage(java.io.InputStream fis, boolean flipped, boolean forceAlpha, int[] transparent)` Load a image from the specified stream
`java.nio.ByteBuffer` `loadImage(java.io.InputStream fis, boolean flipped, int[] transparent)` Load a image from the specified stream

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

Constructor Detail

### TGAImageData

    public TGAImageData()

  Create a new TGA Loader

Method Detail

### getDepth

    public int getDepth()

  Description copied from interface: `ImageData`
  Get the last bit depth read from a TGA

  Specified by:
    `getDepth` in interface `ImageData`
  Returns:
    The last bit depth read
  See Also:
    `ImageData.getDepth()`

### getWidth

    public int getWidth()

  Description copied from interface: `ImageData`
  Get the last width read from a TGA

  Specified by:
    `getWidth` in interface `ImageData`
  Returns:
    Get the last width in pixels fread from a TGA
  See Also:
    `ImageData.getWidth()`

### getHeight

    public int getHeight()

  Description copied from interface: `ImageData`
  Get the last height read from a TGA

  Specified by:
    `getHeight` in interface `ImageData`
  Returns:
    Get the last height in pixels fread from a TGA
  See Also:
    `ImageData.getHeight()`

### getTexWidth

    public int getTexWidth()

  Description copied from interface: `ImageData`
  Get the last required texture width for a loaded image

  Specified by:
    `getTexWidth` in interface `ImageData`
  Returns:
    Get the ast required texture width for a loaded image
  See Also:
    `ImageData.getTexWidth()`

### getTexHeight

    public int getTexHeight()

  Description copied from interface: `ImageData`
  Get the ast required texture height for a loaded image

  Specified by:
    `getTexHeight` in interface `ImageData`
  Returns:
    Get the ast required texture height for a loaded image
  See Also:
    `ImageData.getTexHeight()`

### loadImage

    public java.nio.ByteBuffer loadImage(java.io.InputStream fis)
                                  throws java.io.IOException

  Description copied from interface: `LoadableImageData`
  Load a image from the specified stream

  Specified by:
    `loadImage` in interface `LoadableImageData`
  Parameters:
    `fis` - The stream from which we'll load the TGA
  Returns:
    The byte buffer containing texture data
  Throws:
    `java.io.IOException` - Indicates a failure to read the TGA
  See Also:
    `LoadableImageData.loadImage(java.io.InputStream)`

### loadImage

    public java.nio.ByteBuffer loadImage(java.io.InputStream fis,
                                         boolean flipped,
                                         int[] transparent)
                                  throws java.io.IOException

  Description copied from interface: `LoadableImageData`
  Load a image from the specified stream

  Specified by:
    `loadImage` in interface `LoadableImageData`
  Parameters:
    `fis` - The stream from which we'll load the TGA
    `flipped` - True if we loading in flipped mode (used for cursors)
    `transparent` - The colour to interpret as transparent or null if none
  Returns:
    The byte buffer containing texture data
  Throws:
    `java.io.IOException` - Indicates a failure to read the TGA
  See Also:
    `LoadableImageData.loadImage(java.io.InputStream, boolean, int[])`

### loadImage

    public java.nio.ByteBuffer loadImage(java.io.InputStream fis,
                                         boolean flipped,
                                         boolean forceAlpha,
                                         int[] transparent)
                                  throws java.io.IOException

  Description copied from interface: `LoadableImageData`
  Load a image from the specified stream

  Specified by:
    `loadImage` in interface `LoadableImageData`
  Parameters:
    `fis` - The stream from which we'll load the TGA
    `flipped` - True if we loading in flipped mode (used for cursors)
    `forceAlpha` - Force the output to have an alpha channel
    `transparent` - The colour to interpret as transparent or null if none
  Returns:
    The byte buffer containing texture data
  Throws:
    `java.io.IOException` - Indicates a failure to read the TGA
  See Also:
    `LoadableImageData.loadImage(java.io.InputStream, boolean, boolean, int[])`

### getImageBufferData

    public java.nio.ByteBuffer getImageBufferData()

  Description copied from interface: `ImageData`
  Get the store image

  Specified by:
    `getImageBufferData` in interface `ImageData`
  Returns:
    The stored image
  See Also:
    `ImageData.getImageBufferData()`

### configureEdging

    public void configureEdging(boolean edging)

  Description copied from interface: `LoadableImageData`
  Configure the edging that can be used to make texture edges loop more cleanly

  Specified by:
    `configureEdging` in interface `LoadableImageData`
  Parameters:
    `edging` - True if we should edge
  See Also:
    `LoadableImageData.configureEdging(boolean)`

Copyright © 2006 New Dawn Software. All Rights Reserved.