org.newdawn.slick
Class ImageBuffer

java.lang.Object
  extended by org.newdawn.slick.ImageBuffer
All Implemented Interfaces:
ImageData

public class ImageBuffer
extends java.lang.Object
implements ImageData

A utility for creating images from pixel operations Expected usage is: ImageBuffer buffer = new ImageBuffer(320,200); buffer.setRGBA(100,100,50,50,20,255); .. Image image = buffer.getImage();

Author:
kevin

Constructor Summary
ImageBuffer(int width, int height)
           
 
Method Summary
 int getDepth()
          Get the last bit depth read from a TGA
 int getHeight()
          Get the last height read from a TGA
 Image getImage()
          Get an image generated based on this buffer
 Image getImage(int filter)
          Get an image generated based on this buffer
 java.nio.ByteBuffer getImageBufferData()
          Get the store image
 byte[] getRGBA()
          Retrieve the raw data stored within the image buffer
 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
 void setRGBA(int x, int y, int r, int g, int b, int a)
          Set a pixel in the image buffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageBuffer

public ImageBuffer(int width,
                   int height)
Parameters:
width -
height -
Method Detail

getRGBA

public byte[] getRGBA()
Retrieve the raw data stored within the image buffer

Returns:
The raw data in RGBA packed format from within the image buffer

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

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

setRGBA

public void setRGBA(int x,
                    int y,
                    int r,
                    int g,
                    int b,
                    int a)
Set a pixel in the image buffer

Parameters:
x - The x position of the pixel to set
y - The y position of the pixel to set
r - The red component to set (0->255)
g - The green component to set (0->255)
b - The blue component to set (0->255)
a - The alpha component to set (0->255)

getImage

public Image getImage()
Get an image generated based on this buffer

Returns:
The image generated from this buffer

getImage

public Image getImage(int filter)
Get an image generated based on this buffer

Parameters:
filter - The filtering method to use when scaling this image
Returns:
The image generated from this buffer


Copyright © 2006 New Dawn Software. All Rights Reserved.