Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.image.ComponentColorModel

java.lang.Object
    |
    +----java.awt.image.ColorModel
            |
            +----java.awt.image.ComponentColorModel

public class ComponentColorModel
extends ColorModel
A ColorModel class that can handle an arbitrary ColorSpace and an array of color components to match the ColorSpace. This class can be used to represent most color models on most types of GraphicsDevices.

See Also:
ColorModel

Fields inherited from class java.awt.image.ColorModel
 pixel_bits, transferType
 

Constructor Summary
 ComponentColorModel(ColorSpace colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency)
Constructs a ComponentColorModel from the specified parameters.
 

Method Summary
ColorModel  coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
Forces the Raster data to match the state specified in the isAlphaPremultiplied variable, assuming the data is currently correctly described by this ColorModel.
WritableRaster  createCompatibleWritableRaster(int w, int h)
Creates a WritableRaster with the specified width and height, that has a channel layout compatible with this ColorModel.
boolean  equals(Object obj)
Compares this color model with another for equality.
int  getAlpha(int pixel)
Returns the alpha color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int  getAlpha(Object inData)
Returns the alpha component for the specified pixel, scaled from 0 to 255.
int  getBlue(int pixel)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int  getBlue(Object inData)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int[]  getComponents(int pixel, int[] components, int offset)
Returns an array of all of the components given a pixel in the current color model.
int[]  getComponents(Object inPixel, int[] components, int offset)
Returns an array of all of the components given a pixel array in the current color model.
int  getGreen(int pixel)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int  getGreen(Object inData)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
Object  getPixelData(int rgb, Object inData)
Returns a pixel array given a pixel in the default RGB color model.
int  getRed(int pixel)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int  getRed(Object inData)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
int  getRGB(int pixel)
Returns the color of the pixel in the default RGB color model.
int  getRGB(Object inData)
Returns a pixel in the default RGB color model given a pixel array in the current color model.
boolean  isCompatibleRaster(Raster raster)
Returns true if raster is compatible with this ColorModel and false if it is not.
int  setComponents(int[] components, int offset)
Returns a pixel, given a discrete components (unpacked color/alpha values) in this color model.
Object  setComponents(int[] components, int offset, Object obj)
Returns a pixel array, given a discrete components (unpacked color/alpha values) in this color model.
 
Methods inherited from class java.awt.image.ColorModel
 coerceData, createCompatibleWritableRaster, equals, finalize, getAlpha, getAlpha, getBlue, getBlue, getColorSpace, getComponents, getComponents, getComponents, getComponentSize, getComponentSize, getGreen, getGreen, getMaxComponentSize, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelData, getPixelSize, getRed, getRed, getRGB, getRGB, getRGBdefault, getTransparency, hasAlpha, isAlphaPremultiplied, isCompatibleRaster, setComponents, setComponents, toString
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentColorModel

public ComponentColorModel(ColorSpace colorSpace,
                           int[] bits,
                           boolean hasAlpha,
                           boolean isAlphaPremultiplied,
                           int transparency)
Constructs a ComponentColorModel from the specified parameters. The bits array specifies the number of significant bits per component in the color model (color components and alpha). An IllegalArgumentException will be thrown if the length of the array does not match the number of components. If hasAlpha is true, then the boolean, isAlphaPremultiplied, specifies how to interpret color data that are passed to this ColorModel. If it is true, the color data will have been multiplied with alpha.
Parameters:
colorSpace - ColorSpace associated with this color model
bits - Number of significant bits per component
hasAlpha - If true, this color model supports alpha.
isAlphaPremultiplied - If true, alpha is premultiplied.
transparency - Specifies what alpha values can be represented by this color model.
See Also:
ColorSpace, Transparency
Method Detail

getRed

public int getRed(int pixel)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. An IllegalArgumentException will be thrown if there is more than one component in this ColorModel.
Overrides:
getRed in class ColorModel

getGreen

public int getGreen(int pixel)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. An IllegalArgumentException will be thrown if there is more than one component in this ColorModel.
Overrides:
getGreen in class ColorModel

getBlue

public int getBlue(int pixel)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. An IllegalArgumentException will be thrown if there is more than one component in this ColorModel.
Overrides:
getBlue in class ColorModel

getAlpha

public int getAlpha(int pixel)
Returns the alpha color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. An IllegalArgumentException will be thrown if there is more than one component in this ColorModel.
Overrides:
getAlpha in class ColorModel

getRGB

public int getRGB(int pixel)
Returns the color of the pixel in the default RGB color model. An IllegalArgumentException will be thrown if there is more than one component in this ColorModel. This method will throw an IllegalArgumentException since this ColorModel is unable to extract alpha and color components from a single integer pixel.
Overrides:
getRGB in class ColorModel

getRed

public int getRed(Object inData)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. The returned value will be a non pre-multiplied color (i.e. if the alpha is premultiplied, this method will divide it out before it is returned). If the alpha value is 0, the color will be 0.
Overrides:
getRed in class ColorModel

getGreen

public int getGreen(Object inData)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. The returned value will be a non pre-multiplied color (i.e. if the alpha is premultiplied, this method will divide it out before it is returned). If the alpha value is 0, the color will be 0.
Overrides:
getGreen in class ColorModel

getBlue

public int getBlue(Object inData)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. The returned value will be a this method will divide it out before it is returned). If the alpha value is 0, the color will be 0.
Overrides:
getBlue in class ColorModel

getAlpha

public int getAlpha(Object inData)
Returns the alpha component for the specified pixel, scaled from 0 to 255. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference.
Overrides:
getAlpha in class ColorModel

getRGB

public int getRGB(Object inData)
Returns a pixel in the default RGB color model given a pixel array in the current color model. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. The returned value will be a non pre-multiplied color (i.e. if the alpha is premultiplied, this method will divide it out before it is returned). If the alpha value is 0, the color will be 0.
Overrides:
getRGB in class ColorModel
See Also:
getRGBdefault

getPixelData

public Object getPixelData(int rgb,
                           Object inData)
Returns a pixel array given a pixel in the default RGB color model. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. This pixel array can then be passed to the setPixelData method of a Raster object. If the pixel variable is null, a new array will be allocated. The pixel array will be returned.
Overrides:
getPixelData in class ColorModel

getComponents

public int[] getComponents(int pixel,
                           int[] components,
                           int offset)
Returns an array of all of the components given a pixel in the current color model. If the color model is not an IndexColorModel or DirectColorModel, an IllegalArgumentException will be thrown. This can be used to retrieve the components for a specific pixel in a PackedColorModel. If the components array is null, a new array will be allocated. The components array will be returned.
Overrides:
getComponents in class ColorModel

getComponents

public int[] getComponents(Object inPixel,
                           int[] components,
                           int offset)
Returns an array of all of the components given a pixel array in the current color model. The pixel array is described by a discrete array of data elements of type transferType passed in as an object reference. This can be used to retrieve the components for a specific pixel in a PackedColorModel. If the components array is null, a new array will be allocated. The components array will be returned.
Overrides:
getComponents in class ColorModel

setComponents

public int setComponents(int[] components,
                         int offset)
Returns a pixel, given a discrete components (unpacked color/alpha values) in this color model.
Overrides:
setComponents in class ColorModel

setComponents

public Object setComponents(int[] components,
                            int offset,
                            Object obj)
Returns a pixel array, given a discrete components (unpacked color/alpha values) in this color model. The pixel is described by a discrete array of data elements of type transferType passed in as an object reference. The returned array can be passed to the setPixelData methods of Raster. objects.
Overrides:
setComponents in class ColorModel

coerceData

public ColorModel coerceData(WritableRaster raster,
                             boolean isAlphaPremultiplied)
Forces the Raster data to match the state specified in the isAlphaPremultiplied variable, assuming the data is currently correctly described by this ColorModel. It may multiply or divide the color Raster data by alpha, or do nothing if the data is in the correct state. If the data needs to be coerced, this method will also return an instance of this ColorModel with the isAlphaPremultiplied flag set appropriately.
Overrides:
coerceData in class ColorModel

isCompatibleRaster

public boolean isCompatibleRaster(Raster raster)
Returns true if raster is compatible with this ColorModel and false if it is not.
Overrides:
isCompatibleRaster in class ColorModel

createCompatibleWritableRaster

public WritableRaster createCompatibleWritableRaster(int w,
                                                     int h)
Creates a WritableRaster with the specified width and height, that has a channel layout compatible with this ColorModel.
Overrides:
createCompatibleWritableRaster in class ColorModel
See Also:
WritableRaster

equals

public boolean equals(Object obj)
Compares this color model with another for equality.
Overrides:
equals in class ColorModel

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.