| java.lang.Object java.awt.image.ColorModel
All known Subclasses: java.awt.image.IndexColorModel, java.awt.image.DirectColorModel,
ColorModel | abstract public class ColorModel implements Transparency(Code) | | A class that encapsulates the methods for translating from pixel values
to alpha, red, green, and blue color components for an image. This
class is abstract.
See Also: IndexColorModel See Also: DirectColorModel version: 1.22 02/20/02 author: Jim Graham |
Constructor Summary | |
public | ColorModel(int bits) Constructs a ColorModel which describes a pixel of the specified
number of bits. | protected | ColorModel(int pixel_bits, int[] bits, ColorSpace cspace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType) Constructs a ColorModel that translates pixel values
to color/alpha components. |
Method Summary | |
public boolean | equals(Object obj) Tests if the specified Object is an instance of
ColorModel and if it equals this
ColorModel . | public void | finalize() Disposes of system resources associated with this
ColorModel once this ColorModel is no
longer referenced. | abstract public int | getAlpha(int pixel) The subclass must provide a function which provides the alpha
color compoment for the specified pixel. | abstract public int | getBlue(int pixel) The subclass must provide a function which provides the blue
color compoment for the specified pixel. | final public ColorSpace | getColorSpace() Returns the ColorSpace associated with this
ColorModel . | public int | getComponentSize(int componentIdx) Returns the number of bits for the specified color/alpha component.
Color components are indexed in the order specified by the
ColorSpace . | public int[] | getComponentSize() Returns an array of the number of bits per color/alpha component. | final static int | getDefaultTransferType(int pixel_bits) | abstract public int | getGreen(int pixel) The subclass must provide a function which provides the green
color compoment for the specified pixel. | public int | getNumColorComponents() Returns the number of color components in this
ColorModel . | public int | getNumComponents() Returns the number of components, including alpha, in this
ColorModel . | public int | getPixelSize() Returns the number of bits per pixel described by this ColorModel. | public int | getRGB(int pixel) Returns the color of the pixel in the default RGB color model. | public static ColorModel | getRGBdefault() Return a ColorModel which describes the default format for
integer RGB values used throughout the AWT image interfaces. | abstract public int | getRed(int pixel) The subclass must provide a function which provides the red
color compoment for the specified pixel. | final public int | getTransferType() Returns the transfer type of this ColorModel . | public int | getTransparency() Returns the transparency. | final public boolean | hasAlpha() Returns whether or not alpha is supported in this
ColorModel . | public int | hashCode() Returns the hash code for this ColorModel. | final public boolean | isAlphaPremultiplied() Returns whether or not the alpha has been premultiplied in the
pixel values to be translated by this ColorModel . | public String | toString() Returns the String representation of the contents of
this ColorModel object. |
isAlphaPremultiplied | boolean isAlphaPremultiplied(Code) | | |
numColorComponents | int numColorComponents(Code) | | |
numComponents | int numComponents(Code) | | |
pixel_bits | protected int pixel_bits(Code) | | |
supportsAlpha | boolean supportsAlpha(Code) | | |
transparency | int transparency(Code) | | |
ColorModel | public ColorModel(int bits)(Code) | | Constructs a ColorModel which describes a pixel of the specified
number of bits.
|
ColorModel | protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)(Code) | | Constructs a ColorModel that translates pixel values
to color/alpha components. Color components will be in the
specified ColorSpace . pixel_bits is the
number of bits in the pixel values. The bits array
specifies the number of significant bits per color and alpha component.
Its length should be the number of components in the
ColorSpace if there is no alpha information in the
pixel values, or one more than this number if there is alpha
information. hasAlpha indicates whether or not alpha
information is present. The boolean
isAlphaPremultiplied specifies how to interpret pixel
values in which color and alpha information are represented as
separate spatial bands. If the boolean
is true , color samples are assumed to have been
multiplied by the alpha sample. The transparency
specifies what alpha values can be represented by this color model.
The transfer type is the type of primitive array used to represent
pixel values. Note that the bits array contains the number of
significant bits per color/alpha component after the translation
from pixel values. For example, for an
IndexColorModel with pixel_bits equal to
16, the bits array might have four elements with each element set
to 8.
Parameters: pixel_bits - the number of bits in the pixel values Parameters: bits - array that specifies the number of significant bitsper color and alpha component Parameters: cspace - the specified ColorSpace Parameters: hasAlpha - true if alpha information is present;false otherwise Parameters: isAlphaPremultiplied - true if color samples areassumed to be premultiplied by the alpha samples;false otherwise Parameters: transparency - what alpha values can be represented by thiscolor model Parameters: transferType - the type of the array used to represent pixelvalues throws: IllegalArgumentException - if the length ofthe bit array is less than the number of color or alphacomponents in this ColorModel , or if thetransparency is not a valid value. throws: IllegalArgumentException - if the sum of the numberof bits in bits is less than 1 or ifany of the elements in bits is less than 0. See Also: java.awt.Transparency |
equals | public boolean equals(Object obj)(Code) | | Tests if the specified Object is an instance of
ColorModel and if it equals this
ColorModel .
Parameters: obj - the Object to test for equality true if the specified Object is an instance of ColorModel and equals thisColorModel ; false otherwise. |
finalize | public void finalize()(Code) | | Disposes of system resources associated with this
ColorModel once this ColorModel is no
longer referenced.
|
getAlpha | abstract public int getAlpha(int pixel)(Code) | | The subclass must provide a function which provides the alpha
color compoment for the specified pixel.
The alpha transparency value ranging from 0 to 255 |
getBlue | abstract public int getBlue(int pixel)(Code) | | The subclass must provide a function which provides the blue
color compoment for the specified pixel.
The blue color component ranging from 0 to 255 |
getColorSpace | final public ColorSpace getColorSpace()(Code) | | Returns the ColorSpace associated with this
ColorModel .
the ColorSpace of thisColorModel . |
getComponentSize | public int getComponentSize(int componentIdx)(Code) | | Returns the number of bits for the specified color/alpha component.
Color components are indexed in the order specified by the
ColorSpace . Typically, this order reflects the name
of the color space type. For example, for TYPE_RGB, index 0
corresponds to red, index 1 to green, and index 2
to blue. If this ColorModel supports alpha, the alpha
component corresponds to the index following the last color
component.
Parameters: componentIdx - the index of the color/alpha component the number of bits for the color/alpha component at thespecified index. throws: ArrayIndexOutOfBoundsException - if componentIdx is greater than the number of components orless than zero throws: NullPointerException - if the number of bits array is null |
getComponentSize | public int[] getComponentSize()(Code) | | Returns an array of the number of bits per color/alpha component.
The array contains the color components in the order specified by the
ColorSpace , followed by the alpha component, if
present.
an array of the number of bits per color/alpha component |
getDefaultTransferType | final static int getDefaultTransferType(int pixel_bits)(Code) | | |
getGreen | abstract public int getGreen(int pixel)(Code) | | The subclass must provide a function which provides the green
color compoment for the specified pixel.
The green color component ranging from 0 to 255 |
getNumComponents | public int getNumComponents()(Code) | | Returns the number of components, including alpha, in this
ColorModel . This is equal to the number of color
components, optionally plus one, if there is an alpha component.
the number of components in this ColorModel |
getPixelSize | public int getPixelSize()(Code) | | Returns the number of bits per pixel described by this ColorModel.
|
getRGBdefault | public static ColorModel getRGBdefault()(Code) | | Return a ColorModel which describes the default format for
integer RGB values used throughout the AWT image interfaces.
The format for the RGB values is an integer with 8 bits
each of alpha, red, green, and blue color components ordered
correspondingly from the most significant byte to the least
significant byte, as in: 0xAARRGGBB
|
getRed | abstract public int getRed(int pixel)(Code) | | The subclass must provide a function which provides the red
color compoment for the specified pixel.
The red color component ranging from 0 to 255 |
getTransferType | final public int getTransferType()(Code) | | Returns the transfer type of this ColorModel .
The transfer type is the type of primitive array used to represent
pixel values as arrays.
the transfer type. |
hasAlpha | final public boolean hasAlpha()(Code) | | Returns whether or not alpha is supported in this
ColorModel .
true if alpha is supported in thisColorModel ; false otherwise. |
hashCode | public int hashCode()(Code) | | Returns the hash code for this ColorModel.
a hash code for this ColorModel. |
isAlphaPremultiplied | final public boolean isAlphaPremultiplied()(Code) | | Returns whether or not the alpha has been premultiplied in the
pixel values to be translated by this ColorModel .
If the boolean is true , this ColorModel
is to be used to interpret pixel values in which color and alpha
information are represented as separate spatial bands, and color
samples are assumed to have been multiplied by the
alpha sample.
true if the alpha values are premultipliedin the pixel values to be translated by thisColorModel ; false otherwise. |
toString | public String toString()(Code) | | Returns the String representation of the contents of
this ColorModel object.
a String representing the contents of thisColorModel object. |
|
|