org.newdawn.slick.opengl
Class ImageIOImageData

java.lang.Object
  extended by org.newdawn.slick.opengl.ImageIOImageData
All Implemented Interfaces:
ImageData, LoadableImageData

public class ImageIOImageData
extends java.lang.Object
implements LoadableImageData

An image data provider that uses ImageIO to retrieve image data in a format suitable for creating OpenGL textures. This implementation is used when formats not natively supported by the library are required.

Author:
kevin

Constructor Summary
ImageIOImageData()
           
 
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 imageToByteBuffer(java.awt.image.BufferedImage image, boolean flipped, boolean forceAlpha, int[] transparent)
           
 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

ImageIOImageData

public ImageIOImageData()
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()

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()

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()

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()

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()

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[])

imageToByteBuffer

public java.nio.ByteBuffer imageToByteBuffer(java.awt.image.BufferedImage image,
                                             boolean flipped,
                                             boolean forceAlpha,
                                             int[] transparent)

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.