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

Constructor Index

 o IndexColorModel(int, int, byte[], byte[], byte[])
Constructs an IndexColorModel from the given arrays of red, green, and blue components.
 o IndexColorModel(int, int, byte[], byte[], byte[], byte[])
Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components.
 o IndexColorModel(int, int, byte[], byte[], byte[], int)
Constructs an IndexColorModel from the given arrays of red, green, and blue components.
 o IndexColorModel(int, int, byte[], int, boolean)
Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components.
 o IndexColorModel(int, int, byte[], int, boolean, int)
Constructs an IndexColorModel from a single arrays of packed red, green, blue and optional alpha components.

Method Index

 o getAlpha(int)
Returns the alpha transparency value for the specified pixel in the range 0-255.
 o getAlphas(byte[])
Copies the array of alpha transparency values into the given array.
 o getBlue(int)
Returns the blue color compoment for the specified pixel in the range 0-255.
 o getBlues(byte[])
Copies the array of blue color components into the given array.
 o getGreen(int)
Returns the green color compoment for the specified pixel in the range 0-255.
 o getGreens(byte[])
Copies the array of green color components into the given array.
 o getMapSize()
Returns the size of the color component arrays in this IndexColorModel.
 o getRed(int)
Returns the red color compoment for the specified pixel in the range 0-255.
 o getReds(byte[])
Copies the array of red color components into the given array.
 o getRGB(int)
Returns the color of the pixel in the default RGB color model.
 o getTransparentPixel()
Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel.

Constructors

 o IndexColorModel
    method IndexColorModel(bits=int, -
                           size=int, -
                           r=byte[], -
                           g=byte[], -
                           b=byte[]) public 
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.
 o IndexColorModel
    method IndexColorModel(bits=int, -
                           size=int, -
                           r=byte[], -
                           g=byte[], -
                           b=byte[], -
                           trans=int) public 
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.
 o IndexColorModel
    method IndexColorModel(bits=int, -
                           size=int, -
                           r=byte[], -
                           g=byte[], -
                           b=byte[], -
                           a=byte[]) public 
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.
 o IndexColorModel
    method IndexColorModel(bits=int, -
                           size=int, -
                           cmap=byte[], -
                           start=int, -
                           hasalpha=boolean) public 
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.
 o IndexColorModel
    method IndexColorModel(bits=int, -
                           size=int, -
                           cmap=byte[], -
                           start=int, -
                           hasalpha=boolean, -
                           trans=int) public 
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.

Methods

 o getMapSize
    method getMapSize() returns int public   final  
Returns the size of the color component arrays in this IndexColorModel.

 o getTransparentPixel
    method getTransparentPixel() returns int public   final  
Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel.

 o getReds
    method getReds(r=byte[])  public   final  
Copies the array of red color components into the given array. Only the initial entries of the array as specified by getMapSize() are written.

 o getGreens
    method getGreens(g=byte[])  public   final  
Copies the array of green color components into the given array. Only the initial entries of the array as specified by getMapSize() are written.

 o getBlues
    method getBlues(b=byte[])  public   final  
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.

 o getAlphas
    method getAlphas(a=byte[])  public   final  
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.

 o getRed
    method getRed(pixel=int) returns int public   final  
Returns the red color compoment for the specified pixel in the range 0-255.

Overrides:
getRed in class ColorModel
 o getGreen
    method getGreen(pixel=int) returns int public   final  
Returns the green color compoment for the specified pixel in the range 0-255.

Overrides:
getGreen in class ColorModel
 o getBlue
    method getBlue(pixel=int) returns int public   final  
Returns the blue color compoment for the specified pixel in the range 0-255.

Overrides:
getBlue in class ColorModel
 o getAlpha
    method getAlpha(pixel=int) returns int public   final  
Returns the alpha transparency value for the specified pixel in the range 0-255.

Overrides:
getAlpha in class ColorModel
 o getRGB
    method getRGB(pixel=int) returns int public   final  
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