java.awt.image
Class DirectColorModel

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.image.ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel 
      extended by java.awt.image.PackedColorModel sample code for java.awt.image.PackedColorModel definition code for java.awt.image.PackedColorModel 
          extended by java.awt.image.DirectColorModel
All Implemented Interfaces:
Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency

public class DirectColorModel
extends PackedColorModel sample code for java.awt.image.PackedColorModel definition code for java.awt.image.PackedColorModel

The DirectColorModel class is a ColorModel class that works with pixel values that represent RGB color and alpha information as separate samples and that pack all samples for a single pixel into a single int, short, or byte quantity. This class can be used only with ColorSpaces of type ColorSpace.TYPE_RGB. In addition, for each component of the ColorSpace, the minimum normalized component value obtained via the getMinValue() method of ColorSpace must be 0.0, and the maximum value obtained via the getMaxValue() method must be 1.0 (these min/max values are typical for RGB spaces). There must be three color samples in the pixel values and there can be a single alpha sample. For those methods that use a primitive array pixel representation of type transferType, the array length is always one. The transfer types supported are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT. Color and alpha samples are stored in the single element of the array in bits indicated by bit masks. Each bit mask must be contiguous and masks must not overlap. The same masks apply to the single int pixel representation used by other methods. The correspondence of masks and color/alpha samples is as follows:

The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. A DirectColorModel is typically used with image data which uses masks to define packed samples. For example, a DirectColorModel can be used in conjunction with a SinglePixelPackedSampleModel to construct a BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage . Normally the masks used by the SampleModel sample code for java.awt.image.SampleModel definition code for java.awt.image.SampleModel and the ColorModel would be the same. However, if they are different, the color interpretation of pixel data will be done according to the masks of the ColorModel.

A single int pixel representation is valid for all objects of this class, since it is always possible to represent pixel values used with this class in a single int. Therefore, methods which use this representation will not throw an IllegalArgumentException due to an invalid pixel value.

This color model is similar to an X11 TrueColor visual. The default RGB ColorModel specified by the getRGBdefault sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault() method is a DirectColorModel with the following parameters:

 Number of bits:        32
 Red mask:              0x00ff0000
 Green mask:            0x0000ff00
 Blue mask:             0x000000ff
 Alpha mask:            0xff000000
 Color space:           sRGB
 isAlphaPremultiplied:  False
 Transparency:          Transparency.TRANSLUCENT
 transferType:          DataBuffer.TYPE_INT
 

Many of the methods in this class are final. This is because 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 reasons, but you cannot override or modify the behavior of those methods.

See Also:
ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel , ColorSpace sample code for java.awt.color.ColorSpace definition code for java.awt.color.ColorSpace , SinglePixelPackedSampleModel sample code for java.awt.image.SinglePixelPackedSampleModel definition code for java.awt.image.SinglePixelPackedSampleModel , BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage , ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault()

Field Summary
 
Fields inherited from class java.awt.image.ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
pixel_bits, transferType sample code for java.awt.image.ColorModel.transferType definition code for java.awt.image.ColorModel.transferType
 
Fields inherited from interface java.awt.Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency
BITMASK sample code for java.awt.Transparency.BITMASK definition code for java.awt.Transparency.BITMASK , OPAQUE sample code for java.awt.Transparency.OPAQUE definition code for java.awt.Transparency.OPAQUE , TRANSLUCENT sample code for java.awt.Transparency.TRANSLUCENT definition code for java.awt.Transparency.TRANSLUCENT
 
Constructor Summary
DirectColorModel sample code for java.awt.image.DirectColorModel.DirectColorModel(java.awt.color.ColorSpace, int, int, int, int, int, boolean, int) definition code for java.awt.image.DirectColorModel.DirectColorModel(java.awt.color.ColorSpace, int, int, int, int, int, boolean, int) (ColorSpace sample code for java.awt.color.ColorSpace definition code for java.awt.color.ColorSpace  space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int transferType)
          Constructs a DirectColorModel from the specified parameters.
DirectColorModel sample code for java.awt.image.DirectColorModel.DirectColorModel(int, int, int, int) definition code for java.awt.image.DirectColorModel.DirectColorModel(int, int, int, int) (int bits, int rmask, int gmask, int bmask)
          Constructs a DirectColorModel from the specified masks that indicate which bits in an int pixel representation contain the red, green and blue color samples.
DirectColorModel sample code for java.awt.image.DirectColorModel.DirectColorModel(int, int, int, int, int) definition code for java.awt.image.DirectColorModel.DirectColorModel(int, int, int, int, int) (int bits, int rmask, int gmask, int bmask, int amask)
          Constructs a DirectColorModel from the specified masks that indicate which bits in an int pixel representation contain the red, green and blue color samples and the alpha sample, if present.
 
Method Summary
 ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel coerceData sample code for java.awt.image.DirectColorModel.coerceData(java.awt.image.WritableRaster, boolean) definition code for java.awt.image.DirectColorModel.coerceData(java.awt.image.WritableRaster, boolean) (WritableRaster sample code for java.awt.image.WritableRaster definition code for java.awt.image.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 sample code for java.awt.image.WritableRaster definition code for java.awt.image.WritableRaster createCompatibleWritableRaster sample code for java.awt.image.DirectColorModel.createCompatibleWritableRaster(int, int) definition code for java.awt.image.DirectColorModel.createCompatibleWritableRaster(int, int) (int w, int h)
          Creates a WritableRaster with the specified width and height that has a data layout (SampleModel) compatible with this ColorModel.
 int getAlpha sample code for java.awt.image.DirectColorModel.getAlpha(int) definition code for java.awt.image.DirectColorModel.getAlpha(int) (int pixel)
          Returns the alpha component for the specified pixel, scaled from 0 to 255.
 int getAlpha sample code for java.awt.image.DirectColorModel.getAlpha(java.lang.Object) definition code for java.awt.image.DirectColorModel.getAlpha(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  inData)
          Returns the alpha component for the specified pixel, scaled from 0 to 255.
 int getAlphaMask sample code for java.awt.image.DirectColorModel.getAlphaMask() definition code for java.awt.image.DirectColorModel.getAlphaMask() ()
          Returns the mask indicating which bits in an int pixel representation contain the alpha component.
 int getBlue sample code for java.awt.image.DirectColorModel.getBlue(int) definition code for java.awt.image.DirectColorModel.getBlue(int) (int pixel)
          Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getBlue sample code for java.awt.image.DirectColorModel.getBlue(java.lang.Object) definition code for java.awt.image.DirectColorModel.getBlue(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  inData)
          Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getBlueMask sample code for java.awt.image.DirectColorModel.getBlueMask() definition code for java.awt.image.DirectColorModel.getBlueMask() ()
          Returns the mask indicating which bits in an int pixel representation contain the blue color component.
 int[] getComponents sample code for java.awt.image.DirectColorModel.getComponents(int, int[], int) definition code for java.awt.image.DirectColorModel.getComponents(int, int[], int) (int pixel, int[] components, int offset)
          Returns an array of unnormalized color/alpha components given a pixel in this ColorModel.
 int[] getComponents sample code for java.awt.image.DirectColorModel.getComponents(java.lang.Object, int[], int) definition code for java.awt.image.DirectColorModel.getComponents(java.lang.Object, int[], int) (Object sample code for java.lang.Object definition code for java.lang.Object  pixel, int[] components, int offset)
          Returns an array of unnormalized color/alpha components given a pixel in this ColorModel.
 int getDataElement sample code for java.awt.image.DirectColorModel.getDataElement(int[], int) definition code for java.awt.image.DirectColorModel.getDataElement(int[], int) (int[] components, int offset)
          Returns a pixel value represented as an int in this ColorModel, given an array of unnormalized color/alpha components.
 Object sample code for java.lang.Object definition code for java.lang.Object getDataElements sample code for java.awt.image.DirectColorModel.getDataElements(int[], int, java.lang.Object) definition code for java.awt.image.DirectColorModel.getDataElements(int[], int, java.lang.Object) (int[] components, int offset, Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Returns a data element array representation of a pixel in this ColorModel, given an array of unnormalized color/alpha components.
 Object sample code for java.lang.Object definition code for java.lang.Object getDataElements sample code for java.awt.image.DirectColorModel.getDataElements(int, java.lang.Object) definition code for java.awt.image.DirectColorModel.getDataElements(int, java.lang.Object) (int rgb, Object sample code for java.lang.Object definition code for java.lang.Object  pixel)
          Returns a data element array representation of a pixel in this ColorModel, given an integer pixel representation in the default RGB color model.
 int getGreen sample code for java.awt.image.DirectColorModel.getGreen(int) definition code for java.awt.image.DirectColorModel.getGreen(int) (int pixel)
          Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getGreen sample code for java.awt.image.DirectColorModel.getGreen(java.lang.Object) definition code for java.awt.image.DirectColorModel.getGreen(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  inData)
          Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getGreenMask sample code for java.awt.image.DirectColorModel.getGreenMask() definition code for java.awt.image.DirectColorModel.getGreenMask() ()
          Returns the mask indicating which bits in an int pixel representation contain the green color component.
 int getRed sample code for java.awt.image.DirectColorModel.getRed(int) definition code for java.awt.image.DirectColorModel.getRed(int) (int pixel)
          Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getRed sample code for java.awt.image.DirectColorModel.getRed(java.lang.Object) definition code for java.awt.image.DirectColorModel.getRed(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  inData)
          Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
 int getRedMask sample code for java.awt.image.DirectColorModel.getRedMask() definition code for java.awt.image.DirectColorModel.getRedMask() ()
          Returns the mask indicating which bits in an int pixel representation contain the red color component.
 int getRGB sample code for java.awt.image.DirectColorModel.getRGB(int) definition code for java.awt.image.DirectColorModel.getRGB(int) (int pixel)
          Returns the color/alpha components of the pixel in the default RGB color model format.
 int getRGB sample code for java.awt.image.DirectColorModel.getRGB(java.lang.Object) definition code for java.awt.image.DirectColorModel.getRGB(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  inData)
          Returns the color/alpha components for the specified pixel in the default RGB color model format.
 boolean isCompatibleRaster sample code for java.awt.image.DirectColorModel.isCompatibleRaster(java.awt.image.Raster) definition code for java.awt.image.DirectColorModel.isCompatibleRaster(java.awt.image.Raster) (Raster sample code for java.awt.image.Raster definition code for java.awt.image.Raster  raster)
          Returns true if raster is compatible with this ColorModel and false if it is not.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.image.DirectColorModel.toString() definition code for java.awt.image.DirectColorModel.toString() ()
          Returns a String that represents this DirectColorModel.
 
Methods inherited from class java.awt.image.PackedColorModel sample code for java.awt.image.PackedColorModel definition code for java.awt.image.PackedColorModel
createCompatibleSampleModel sample code for java.awt.image.PackedColorModel.createCompatibleSampleModel(int, int) definition code for java.awt.image.PackedColorModel.createCompatibleSampleModel(int, int) , equals sample code for java.awt.image.PackedColorModel.equals(java.lang.Object) definition code for java.awt.image.PackedColorModel.equals(java.lang.Object) , getAlphaRaster sample code for java.awt.image.PackedColorModel.getAlphaRaster(java.awt.image.WritableRaster) definition code for java.awt.image.PackedColorModel.getAlphaRaster(java.awt.image.WritableRaster) , getMask sample code for java.awt.image.PackedColorModel.getMask(int) definition code for java.awt.image.PackedColorModel.getMask(int) , getMasks sample code for java.awt.image.PackedColorModel.getMasks() definition code for java.awt.image.PackedColorModel.getMasks() , isCompatibleSampleModel sample code for java.awt.image.PackedColorModel.isCompatibleSampleModel(java.awt.image.SampleModel) definition code for java.awt.image.PackedColorModel.isCompatibleSampleModel(java.awt.image.SampleModel)
 
Methods inherited from class java.awt.image.ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
finalize sample code for java.awt.image.ColorModel.finalize() definition code for java.awt.image.ColorModel.finalize() , getColorSpace sample code for java.awt.image.ColorModel.getColorSpace() definition code for java.awt.image.ColorModel.getColorSpace() , getComponentSize sample code for java.awt.image.ColorModel.getComponentSize() definition code for java.awt.image.ColorModel.getComponentSize() , getComponentSize sample code for java.awt.image.ColorModel.getComponentSize(int) definition code for java.awt.image.ColorModel.getComponentSize(int) , getDataElement sample code for java.awt.image.ColorModel.getDataElement(float[], int) definition code for java.awt.image.ColorModel.getDataElement(float[], int) , getDataElements sample code for java.awt.image.ColorModel.getDataElements(float[], int, java.lang.Object) definition code for java.awt.image.ColorModel.getDataElements(float[], int, java.lang.Object) , getNormalizedComponents sample code for java.awt.image.ColorModel.getNormalizedComponents(int[], int, float[], int) definition code for java.awt.image.ColorModel.getNormalizedComponents(int[], int, float[], int) , getNormalizedComponents sample code for java.awt.image.ColorModel.getNormalizedComponents(java.lang.Object, float[], int) definition code for java.awt.image.ColorModel.getNormalizedComponents(java.lang.Object, float[], int) , getNumColorComponents sample code for java.awt.image.ColorModel.getNumColorComponents() definition code for java.awt.image.ColorModel.getNumColorComponents() , getNumComponents sample code for java.awt.image.ColorModel.getNumComponents() definition code for java.awt.image.ColorModel.getNumComponents() , getPixelSize sample code for java.awt.image.ColorModel.getPixelSize() definition code for java.awt.image.ColorModel.getPixelSize() , getRGBdefault sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault() , getTransferType sample code for java.awt.image.ColorModel.getTransferType() definition code for java.awt.image.ColorModel.getTransferType() , getTransparency sample code for java.awt.image.ColorModel.getTransparency() definition code for java.awt.image.ColorModel.getTransparency() , getUnnormalizedComponents sample code for java.awt.image.ColorModel.getUnnormalizedComponents(float[], int, int[], int) definition code for java.awt.image.ColorModel.getUnnormalizedComponents(float[], int, int[], int) , hasAlpha sample code for java.awt.image.ColorModel.hasAlpha() definition code for java.awt.image.ColorModel.hasAlpha() , hashCode sample code for java.awt.image.ColorModel.hashCode() definition code for java.awt.image.ColorModel.hashCode() , isAlphaPremultiplied sample code for java.awt.image.ColorModel.isAlphaPremultiplied() definition code for java.awt.image.ColorModel.isAlphaPremultiplied()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

DirectColorModel sample code for java.awt.image.DirectColorModel(int, int, int, int) definition code for java.awt.image.DirectColorModel(int, int, int, int)

public DirectColorModel(int bits,
                        int rmask,
                        int gmask,
                        int bmask)
Constructs a DirectColorModel from the specified masks that indicate which bits in an int pixel representation contain the red, green and blue color samples. As pixel values do not contain alpha information, all pixels are treated as opaque, which means that alpha = 1.0. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. The ColorSpace is the default sRGB space. The transparency value is Transparency.OPAQUE. The transfer type is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT that can hold a single pixel.

Parameters:
bits - the number of bits in the pixel values; for example, the sum of the number of bits in the masks.
rmask - specifies a mask indicating which bits in an integer pixel contain the red component
gmask - specifies a mask indicating which bits in an integer pixel contain the green component
bmask - specifies a mask indicating which bits in an integer pixel contain the blue component

DirectColorModel sample code for java.awt.image.DirectColorModel(int, int, int, int, int) definition code for java.awt.image.DirectColorModel(int, int, int, int, int)

public DirectColorModel(int bits,
                        int rmask,
                        int gmask,
                        int bmask,
                        int amask)
Constructs a DirectColorModel from the specified masks that indicate which bits in an int pixel representation contain the red, green and blue color samples and the alpha sample, if present. If amask is 0, pixel values do not contain alpha information and all pixels are treated as opaque, which means that alpha = 1.0. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. Alpha, if present, is not premultiplied. The ColorSpace is the default sRGB space. The transparency value is Transparency.OPAQUE if no alpha is present, or Transparency.TRANSLUCENT otherwise. The transfer type is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT that can hold a single pixel.

Parameters:
bits - the number of bits in the pixel values; for example, the sum of the number of bits in the masks.
rmask - specifies a mask indicating which bits in an integer pixel contain the red component
gmask - specifies a mask indicating which bits in an integer pixel contain the green component
bmask - specifies a mask indicating which bits in an integer pixel contain the blue component
amask - specifies a mask indicating which bits in an integer pixel contain the alpha component

DirectColorModel sample code for java.awt.image.DirectColorModel(java.awt.color.ColorSpace, int, int, int, int, int, boolean, int) definition code for java.awt.image.DirectColorModel(java.awt.color.ColorSpace, int, int, int, int, int, boolean, int)

public DirectColorModel(ColorSpace sample code for java.awt.color.ColorSpace definition code for java.awt.color.ColorSpace  space,
                        int bits,
                        int rmask,
                        int gmask,
                        int bmask,
                        int amask,
                        boolean isAlphaPremultiplied,
                        int transferType)
Constructs a DirectColorModel from the specified parameters. Color components are in the specified ColorSpace, which must be of type ColorSpace.TYPE_RGB and have minimum normalized component values which are all 0.0 and maximum values which are all 1.0. The masks specify which bits in an int pixel representation contain the red, green and blue color samples and the alpha sample, if present. If amask is 0, pixel values do not contain alpha information and all pixels are treated as opaque, which means that alpha = 1.0. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. If there is alpha, the boolean isAlphaPremultiplied specifies how to interpret color and alpha samples in pixel values. If the boolean is true, color samples are assumed to have been multiplied by the alpha sample. The transparency value is Transparency.OPAQUE, if no alpha is present, or Transparency.TRANSLUCENT otherwise. The transfer type is the type of primitive array used to represent pixel values and must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT.

Parameters:
space - the specified ColorSpace
bits - the number of bits in the pixel values; for example, the sum of the number of bits in the masks.
rmask - specifies a mask indicating which bits in an integer pixel contain the red component
gmask - specifies a mask indicating which bits in an integer pixel contain the green component
bmask - specifies a mask indicating which bits in an integer pixel contain the blue component
amask - specifies a mask indicating which bits in an integer pixel contain the alpha component
isAlphaPremultiplied - true if color samples are premultiplied by the alpha sample; false otherwise
transferType - the type of array used to represent pixel values
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if space is not a TYPE_RGB space or if the min/max normalized component values are not 0.0/1.0.
Method Detail

getRedMask sample code for java.awt.image.DirectColorModel.getRedMask() definition code for java.awt.image.DirectColorModel.getRedMask()

public final int getRedMask()
Returns the mask indicating which bits in an int pixel representation contain the red color component.

Returns:
the mask, which indicates which bits of the int pixel representation contain the red color sample.

getGreenMask sample code for java.awt.image.DirectColorModel.getGreenMask() definition code for java.awt.image.DirectColorModel.getGreenMask()

public final int getGreenMask()
Returns the mask indicating which bits in an int pixel representation contain the green color component.

Returns:
the mask, which indicates which bits of the int pixel representation contain the green color sample.

getBlueMask sample code for java.awt.image.DirectColorModel.getBlueMask() definition code for java.awt.image.DirectColorModel.getBlueMask()

public final int getBlueMask()
Returns the mask indicating which bits in an int pixel representation contain the blue color component.

Returns:
the mask, which indicates which bits of the int pixel representation contain the blue color sample.

getAlphaMask sample code for java.awt.image.DirectColorModel.getAlphaMask() definition code for java.awt.image.DirectColorModel.getAlphaMask()

public final int getAlphaMask()
Returns the mask indicating which bits in an int pixel representation contain the alpha component.

Returns:
the mask, which indicates which bits of the int pixel representation contain the alpha sample.

getRed sample code for java.awt.image.DirectColorModel.getRed(int) definition code for java.awt.image.DirectColorModel.getRed(int)

public final int getRed(int pixel)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value is a non pre-multiplied value. Thus, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, for example, the red value is 0.

Specified by:
getRed sample code for java.awt.image.ColorModel.getRed(int) definition code for java.awt.image.ColorModel.getRed(int) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
pixel - the specified pixel
Returns:
the red color component for the specified pixel, from 0 to 255 in the sRGB ColorSpace.

getGreen sample code for java.awt.image.DirectColorModel.getGreen(int) definition code for java.awt.image.DirectColorModel.getGreen(int)

public final int getGreen(int pixel)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value is a non pre-multiplied value. Thus, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, for example, the green value is 0.

Specified by:
getGreen sample code for java.awt.image.ColorModel.getGreen(int) definition code for java.awt.image.ColorModel.getGreen(int) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
pixel - the specified pixel
Returns:
the green color component for the specified pixel, from 0 to 255 in the sRGB ColorSpace.

getBlue sample code for java.awt.image.DirectColorModel.getBlue(int) definition code for java.awt.image.DirectColorModel.getBlue(int)

public final int getBlue(int pixel)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. A color conversion is done if necessary. The pixel value is specified as an int. The returned value is a non pre-multiplied value. Thus, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, for example, the blue value is 0.

Specified by:
getBlue sample code for java.awt.image.ColorModel.getBlue(int) definition code for java.awt.image.ColorModel.getBlue(int) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
pixel - the specified pixel
Returns:
the blue color component for the specified pixel, from 0 to 255 in the sRGB ColorSpace.

getAlpha sample code for java.awt.image.DirectColorModel.getAlpha(int) definition code for java.awt.image.DirectColorModel.getAlpha(int)

public final int getAlpha(int pixel)
Returns the alpha component for the specified pixel, scaled from 0 to 255. The pixel value is specified as an int.

Specified by:
getAlpha sample code for java.awt.image.ColorModel.getAlpha(int) definition code for java.awt.image.ColorModel.getAlpha(int) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
pixel - the specified pixel
Returns:
the value of the alpha component of pixel from 0 to 255.

getRGB sample code for java.awt.image.DirectColorModel.getRGB(int) definition code for java.awt.image.DirectColorModel.getRGB(int)

public final int getRGB(int pixel)
Returns the color/alpha components of the pixel in the default RGB color model format. A color conversion is done if necessary. The pixel value is specified as an int. The returned value is in a non pre-multiplied format. Thus, if the alpha is premultiplied, this method divides it out of the color components. If the alpha value is 0, for example, the color values are each 0.

Overrides:
getRGB sample code for java.awt.image.ColorModel.getRGB(int) definition code for java.awt.image.ColorModel.getRGB(int) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
pixel - the specified pixel
Returns:
the RGB value of the color/alpha components of the specified pixel.
See Also:
ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault()

getRed sample code for java.awt.image.DirectColorModel.getRed(java.lang.Object) definition code for java.awt.image.DirectColorModel.getRed(java.lang.Object)

public int getRed(Object sample code for java.lang.Object definition code for java.lang.Object  inData)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. The returned value is a non pre-multiplied value. Thus, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, for example, the red value is 0. If inData is not a primitive array of type transferType, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported transferType. An UnsupportedOperationException is thrown if this transferType is not supported by this ColorModel.

Overrides:
getRed sample code for java.awt.image.ColorModel.getRed(java.lang.Object) definition code for java.awt.image.ColorModel.getRed(java.lang.Object) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
inData - the array containing the pixel value
Returns:
the value of the red component of the specified pixel.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if inData is not large enough to hold a pixel value for this color model
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if inData is not a primitive array of type transferType
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if this transferType is not supported by this color model

getGreen sample code for java.awt.image.DirectColorModel.getGreen(java.lang.Object) definition code for java.awt.image.DirectColorModel.getGreen(java.lang.Object)

public int getGreen(Object sample code for java.lang.Object definition code for java.lang.Object  inData)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. A color conversion is done if necessary. The pixel value is specified by an array of data elements of type transferType passed in as an object reference. The returned value is a non pre-multiplied value. Thus, if the alpha is premultiplied, this method divides it out before returning the value. If the alpha value is 0, for example, the green value is 0. If inData is not a primitive array of type transferType, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException is thrown if inData is not large enough to hold a pixel value for this ColorModel. Since DirectColorModel can be subclassed, subclasses inherit the implementation of this method and if they don't override it then they throw an exception if they use an unsupported transferType. An UnsupportedOperationException is thrown if this transferType is not supported by this ColorModel.

Overrides:
getGreen sample code for java.awt.image.ColorModel.getGreen(java.lang.Object) definition code for java.awt.image.ColorModel.getGreen(java.lang.Object) in class ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel
Parameters:
inData - the array containing the pixel value
Returns:
the value of the green component of the specified pixel.
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if inData is not large enough to hold a pixel value for this color model
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if inData is not a primitive array of type transferType
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if this transferType is not supported by this color model

getBlue sample code for java.awt.image.DirectColorModel.getBlue(java.lang.Object) definition code for java.awt.image.DirectColorModel.getBlue(java.lang.Object)

public int getBlue(Object sample code for java.lang.Object