org.newdawn.slick.opengl
Class PNGImageData

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

public class PNGImageData
extends java.lang.Object
implements LoadableImageData

The PNG imge data source that is pure java reading PNGs

Author:
Matthias Mann (original code)

Constructor Summary
PNGImageData()
          Create a new PNG image data that can read image data from PNG formated files
 
Method Summary
 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
 boolean hasAlpha()
          Check if this PNG has a an alpha channel
 boolean isRGB()
          Check if the PNG is RGB formatted
 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

PNGImageData

public PNGImageData()
Create a new PNG image data that can read image data from PNG formated files

Method Detail

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

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

hasAlpha

public boolean hasAlpha()
Check if this PNG has a an alpha channel

Returns:
True if the PNG has an alpha channel

isRGB

public boolean isRGB()
Check if the PNG is RGB formatted

Returns:
True if the PNG is RGB formatted

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

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

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

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


Copyright © 2006 New Dawn Software. All Rights Reserved.