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[])
- Constructs an IndexColorModel from the given arrays of red,
green, and blue components.
-
IndexColorModel(int, int, byte[], byte[], byte[], int)
- Constructs an IndexColorModel from the given arrays of red,
green, and blue components.
-
IndexColorModel(int, int, byte[], byte[], byte[], byte[])
- Constructs an IndexColorModel from the given arrays of red,
green, blue and alpha components.
-
IndexColorModel(int, int, byte[], int, boolean)
- Constructs an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components.
-
IndexColorModel(int, int, byte[], int, boolean, int)
- Constructs an IndexColorModel from a single arrays of packed
red, green, blue and optional alpha components.
-
getAlpha(int)
- Returns the alpha transparency value for the specified pixel in the
range 0-255.
-
getAlphas(byte[])
- Copies the array of alpha transparency values into the given array.
-
getBlue(int)
- Returns the blue color compoment for the specified pixel in the
range 0-255.
-
getBlues(byte[])
- Copies the array of blue color components into the given array.
-
getGreen(int)
- Returns the green color compoment for the specified pixel in the
range 0-255.
-
getGreens(byte[])
- Copies the array of green color components into the given array.
-
getMapSize()
- Returns the size of the color component arrays in this IndexColorModel.
-
getRGB(int)
- Returns the color of the pixel in the default RGB color model.
-
getRed(int)
- Returns the red color compoment for the specified pixel in the
range 0-255.
-
getReds(byte[])
- Copies 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[])
- 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.
- 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[])
- Copies the array of red color components into the given array. Only
the initial entries of the array as specified by getMapSize() are
written.
getGreens
public final void getGreens(byte g[])
- Copies the array of green color components into the given array. Only
the initial entries of the array as specified by getMapSize() are
written.
getBlues
public final void getBlues(byte b[])
- Copies 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[])
- 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.
getRed
public final int getRed(int pixel)
- Returns 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)
- Returns 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)
- Returns 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)
- Returns 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)
- Returns 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