A ColorModel class that specifies a translation from pixel values
to alpha, red, green, and blue color components for pixels which
represent indices into a fixed colormap. An optional transparent
pixel value can be supplied which indicates a completely transparent
pixel, regardless of any alpha value recorded for that pixel value.
This color model is similar to an X11 PseudoColor visual.
Many of the methods in this class are final. The reason for
this is that the underlying native graphics code makes assumptions
about the layout and operation of this class and those assumptions
are reflected in the implementations of the methods here that are
marked final. You can subclass this class for other reaons, but
you cannot override or modify the behaviour of those methods.
Returns the index of the transparent pixel in this IndexColorModel
or -1 if there is no transparent pixel.
IndexColorModel
public IndexColorModel(int bits,
int size,
byte r[],
byte g[],
byte b[])
Constructs an IndexColorModel from the given arrays of red,
green, and blue components. Pixels described by this color
model will all have alpha components of 255 (fully opaque).
All of the arrays specifying the color components must have
at least the specified number of entries.
Parameters:
bits - The number of bits each pixel occupies.
size - The size of the color component arrays.
r - The array of red color components.
g - The array of green color components.
b - The array of blue color components.
IndexColorModel
public IndexColorModel(int bits,
int size,
byte r[],
byte g[],
byte b[],
int trans)
Constructs an IndexColorModel from the given arrays of red,
green, and blue components. Pixels described by this color
model will all have alpha components of 255 (fully opaque),
except for the indicated transparent pixel. All of the arrays
specifying the color components must have at least the specified
number of entries.
Parameters:
bits - The number of bits each pixel occupies.
size - The size of the color component arrays.
r - The array of red color components.
g - The array of green color components.
b - The array of blue color components.
trans - The index of the transparent pixel.
IndexColorModel
public IndexColorModel(int bits,
int size,
byte r[],
byte g[],
byte b[],
byte a[])
Constructs an IndexColorModel from the given arrays of red,
green, blue and alpha components. All of the arrays specifying
the color components must have at least the specified number
of entries.
Parameters:
bits - The number of bits each pixel occupies.
size - The size of the color component arrays.
r - The array of red color components.
g - The array of green color components.
b - The array of blue color components.
a - The array of alpha value components.
IndexColorModel
public IndexColorModel(int bits,
int size,
byte cmap[],
int start,
boolean hasalpha)
Constructs an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components. The array
must have enough values in it to fill all of the needed
component arrays of the specified size.
Parameters:
bits - The number of bits each pixel occupies.
size - The size of the color component arrays.
cmap - The array of color components.
start - The starting offset of the first color component.
hasalpha - Indicates whether alpha values are contained in
the cmap array.
IndexColorModel
public IndexColorModel(int bits,
int size,
byte cmap[],
int start,
boolean hasalpha,
int trans)
Constructs an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components. The specified
transparent index represents a pixel which will be considered
entirely transparent regardless of any alpha value specified
for it. The array must have enough values in it to fill all
of the needed component arrays of the specified size.
Parameters:
bits - The number of bits each pixel occupies.
size - The size of the color component arrays.
cmap - The array of color components.
start - The starting offset of the first color component.
hasalpha - Indicates whether alpha values are contained in
the cmap array.
Copies the array of alpha transparency values into the given array. Only
the initial entries of the array as specified by getMapSize() will
be written.