GF4J 0.9.4 Beta

gameframe.graphics
Class BitmapData

java.lang.Object
  |
  +--gameframe.graphics.BitmapData
All Implemented Interfaces:
java.lang.Cloneable

public class BitmapData
extends java.lang.Object
implements java.lang.Cloneable

Represents the bitmap data loaded from a bitmap file.

Since:
GameFrame for Java 0.9.3
Version:
GameFrame for Java 0.9.4
Author:
Pasi Keränen 16. Feb 2000

Field Summary
static int NOT_USED
          The value of any key color component if it is not used.
 
Constructor Summary
BitmapData(int[] aPixels, int width, int height, int pitch)
          Constructs a bitmap data object that has the given parameters.
BitmapData(int[] aPixels, int width, int height, int pitch, int[] aPalette)
          Constructs a bitmap data object that has the given parameters.
BitmapData(int[] aPixels, int width, int height, int pitch, int keyColorRed, int keyColorGreen, int keyColorBlue)
          Constructs a bitmap data object that has the given parameters.
BitmapData(int[] aPixels, int width, int height, int pitch, int keyColorRed, int keyColorGreen, int keyColorBlue, int[] aPalette)
          Constructs a bitmap data object that has the given parameters.
 
Method Summary
 BitmapData getCopy()
          Returns a copy of the bitmap data.
 int getHeight()
          Returns the height of the bitmap.
 int getKeyColorBlue()
          Returns the red component of the keycolor.
 int getKeyColorGreen()
          Returns the red component of the keycolor.
 int getKeyColorRed()
          Returns the red component of the keycolor.
 int getNumBlueBits()
          Returns the number of bits used for the red component in a pixel.
 int getNumGreenBits()
          Returns the number of bits used for the red component in a pixel.
 int getNumRedBits()
          Returns the number of bits used for the red component in a pixel.
 int[] getPalette()
          Returns the palette array in the default color format.
 int getPitch()
          Returns the number of pixels that needs to be travelled in the pixel array in order to step one pixel down in the bitmap.
 int[] getPixels()
          Returns the pixel data array in the default color format.
 int getWidth()
          Returns the width of the bitmap.
 boolean isKeyColourInUse()
          Returns whether this bitmap data uses the keycolor or not.
 boolean isPaletted()
          Returns whether this image data uses a palette or not.
 void setColourBits(int numRedBits, int numGreenBits, int numBlueBits)
          Sets the colour bits (the number of bits used for each colour).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_USED

public static final int NOT_USED
The value of any key color component if it is not used.
Constructor Detail

BitmapData

public BitmapData(int[] aPixels,
                  int width,
                  int height,
                  int pitch)
Constructs a bitmap data object that has the given parameters.
Parameters:
aPixels - The pixels in default colour format.
width - The width of the bitmap.
height - The height of the bitmap.
pitch - The number of pixels to step one pixel downwards.

BitmapData

public BitmapData(int[] aPixels,
                  int width,
                  int height,
                  int pitch,
                  int keyColorRed,
                  int keyColorGreen,
                  int keyColorBlue)
Constructs a bitmap data object that has the given parameters.
Parameters:
aPixels - The pixels in default colour format.
width - The width of the bitmap.
height - The height of the bitmap.
pitch - The number of pixels to step one pixel downwards.
keyColorRed - The alpha key colours red component value.
keyColorGreen - The alpha key colours green component value.
keyColorBlue - The alpha key colours blue component value.
aPalette - The palette array (in default RGB format).

BitmapData

public BitmapData(int[] aPixels,
                  int width,
                  int height,
                  int pitch,
                  int[] aPalette)
Constructs a bitmap data object that has the given parameters.
Parameters:
aPixels - The pixels in default colour format.
width - The width of the bitmap.
height - The height of the bitmap.
pitch - The number of pixels to step one pixel downwards.
aPalette - The palette array (in default RGB format).

BitmapData

public BitmapData(int[] aPixels,
                  int width,
                  int height,
                  int pitch,
                  int keyColorRed,
                  int keyColorGreen,
                  int keyColorBlue,
                  int[] aPalette)
Constructs a bitmap data object that has the given parameters.
Parameters:
aPixels - The pixels in default colour format.
width - The width of the bitmap.
height - The height of the bitmap.
pitch - The number of pixels to step one pixel downwards.
keyColorRed - The alpha key colours red component value.
keyColorGreen - The alpha key colours green component value.
keyColorBlue - The alpha key colours blue component value.
aPalette - The palette array (in default RGB format).
Method Detail

getPixels

public int[] getPixels()
Returns the pixel data array in the default color format.
Returns:
Pixel data array

getNumRedBits

public int getNumRedBits()
Returns the number of bits used for the red component in a pixel.
Returns:
The number of bits for red colour.

getNumGreenBits

public int getNumGreenBits()
Returns the number of bits used for the red component in a pixel.
Returns:
The number of bits for red colour.

getNumBlueBits

public int getNumBlueBits()
Returns the number of bits used for the red component in a pixel.
Returns:
The number of bits for red colour.

setColourBits

public void setColourBits(int numRedBits,
                          int numGreenBits,
                          int numBlueBits)
Sets the colour bits (the number of bits used for each colour).
Parameters:
numRedBits - The number of bits used for the red colour.
numGreenBits - The number of bits used for the green colour.
numBlueBits - The number of bits used for the blue colour.

isPaletted

public final boolean isPaletted()
Returns whether this image data uses a palette or not.
Returns:
True if the image is paletted, false if not.

getPalette

public int[] getPalette()
Returns the palette array in the default color format.
Returns:
Palette array.

getWidth

public int getWidth()
Returns the width of the bitmap.
Returns:
Width of the bitmap

getPitch

public int getPitch()
Returns the number of pixels that needs to be travelled in the pixel array in order to step one pixel down in the bitmap.
Returns:
The pitch of the bitmap.

getHeight

public int getHeight()
Returns the height of the bitmap.
Returns:
Height of the bitmap

getKeyColorRed

public int getKeyColorRed()
Returns the red component of the keycolor. Valid only if bitmap was loaded as alphabitmap.
Returns:
Red component of the keycolor.

getKeyColorGreen

public int getKeyColorGreen()
Returns the red component of the keycolor. Valid only if bitmap was loaded as alphabitmap.
Returns:
Red component of the keycolor.

getKeyColorBlue

public int getKeyColorBlue()
Returns the red component of the keycolor. Valid only if bitmap was loaded as alphabitmap.
Returns:
Red component of the keycolor.

isKeyColourInUse

public boolean isKeyColourInUse()
Returns whether this bitmap data uses the keycolor or not.
Returns:
True if keycolour is defined or false if not.

getCopy

public BitmapData getCopy()
Returns a copy of the bitmap data.
Returns:
A copy of the bitmap data.

GF4J 0.9.4 Beta