Class java.awt.image.IndexColorModel
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.image.IndexColorModel
java.lang.Object
|
+----java.awt.image.ColorModel
|
+----java.awt.image.IndexColorModel
- public class IndexColorModel
- extends ColorModel
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.
- See Also:
- ColorModel
-
IndexColorModel(int, int, byte[], byte[], byte[])
- Construct an IndexColorModel from the given arrays of red,
green, and blue components.
-
IndexColorModel(int, int, byte[], byte[], byte[], int)
- Construct an IndexColorModel from the given arrays of red,
green, and blue components.
-
IndexColorModel(int, int, byte[], byte[], byte[], byte[])
- Construct an IndexColorModel from the given arrays of red,
green, blue and alpha components.
-
IndexColorModel(int, int, byte[], int, boolean)
- Construct an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components.
-
IndexColorModel(int, int, byte[], int, boolean, int)
- Construct an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components.
-
getAlpha(int)
- Return the alpha transparency value for the specified pixel in the
range 0-255.
-
getAlphas(byte[])
- Copy the array of alpha transparency values into the given array.
-
getBlue(int)
- Return the blue color compoment for the specified pixel in the
range 0-255.
-
getBlues(byte[])
- Copy the array of blue color components into the given array.
-
getGreen(int)
- Return the green color compoment for the specified pixel in the
range 0-255.
-
getGreens(byte[])
- Copy the array of green color components into the given array.
-
getMapSize()
- Returns the size of the color component arrays in this IndexColorModel.
-
getRGB(int)
- Return the color of the pixel in the default RGB color model.
-
getRed(int)
- Return the red color compoment for the specified pixel in the
range 0-255.
-
getReds(byte[])
- Copy the array of red color components into the given array.
-
getTransparentPixel()
- 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[])
- Construct 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)
- Construct 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[])
- Construct 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)
- Construct 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)
- Construct 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.
- trans - The index of the fully transparent pixel.
getMapSize
public final int getMapSize()
- Returns the size of the color component arrays in this IndexColorModel.
getTransparentPixel
public final int getTransparentPixel()
- Returns the index of the transparent pixel in this IndexColorModel
or -1 if there is no transparent pixel.
getReds
public final void getReds(byte r[])
- Copy the array of red color components into the given array. Only
the initial entries of the array as specified by getMapSize() will
be written.
getGreens
public final void getGreens(byte g[])
- Copy the array of green color components into the given array. Only
the initial entries of the array as specified by getMapSize() will
be written.
getBlues
public final void getBlues(byte b[])
- Copy the array of blue color components into the given array. Only
the initial entries of the array as specified by getMapSize() will
be written.
getAlphas
public final void getAlphas(byte a[])
- Copy the array of alpha transparency values into the given array. Only
the initial entries of the array as specified by getMapSize() will
be written.
getRed
public final int getRed(int pixel)
- Return the red color compoment for the specified pixel in the
range 0-255.
- Overrides:
- getRed in class ColorModel
getGreen
public final int getGreen(int pixel)
- Return the green color compoment for the specified pixel in the
range 0-255.
- Overrides:
- getGreen in class ColorModel
getBlue
public final int getBlue(int pixel)
- Return the blue color compoment for the specified pixel in the
range 0-255.
- Overrides:
- getBlue in class ColorModel
getAlpha
public final int getAlpha(int pixel)
- Return the alpha transparency value for the specified pixel in the
range 0-255.
- Overrides:
- getAlpha in class ColorModel
getRGB
public final int getRGB(int pixel)
- Return the color of the pixel in the default RGB color model.
- Overrides:
- getRGB in class ColorModel
- See Also:
- getRGBdefault
All Packages Class Hierarchy This Package Previous Next Index