Color object or, via a ColorModel
object, of an Image, a BufferedImage, or a
GraphicsDevice. It contains methods that transform colors in a
specific color space to/from sRGB and to/from a well-defined CIEXYZ color
space.
For purposes of the methods in this class, colors are represented as arrays
of color components represented as floats in a normalized range defined by
each ColorSpace. For many ColorSpaces (e.g. sRGB), this range
is 0.0 to 1.0. However, some ColorSpaces have components whose values
have a different range. Methods are provided to inquire per component minimum
and maximum normalized values.
Several variables are defined for purposes of referring to color space types
(e.g. TYPE_RGB, TYPE_XYZ, etc.) and to refer to specific
color spaces (e.g. CS_sRGB and CS_CIEXYZ). sRGB is a proposed
standard RGB color space. For more information, see
http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html.
The purpose of the methods to transform to/from the well-defined CIEXYZ color
space is to support conversions between any two color spaces at a reasonably
high degree of accuracy. It is expected that particular implementations of
subclasses of ColorSpace (e.g. ICC_ColorSpace) will support
high performance conversion based on underlying platform color management
systems.
The CS_CIEXYZ space used by the toCIEXYZ/fromCIEXYZ methods
can be described as follows:
CIEXYZ viewing illuminance: 200 lux viewing white point: CIE D50 media white point: "that of a perfectly reflecting diffuser" -- D50 media black point: 0 lux or 0 Reflectance flare: 1 percent surround: 20percent of the media white point media description: reflection print (i.e., RLAB, Hunt viewing media) note: For developers creating an ICC profile for this conversion space, the following is applicable. Use a simple Von Kries white point adaptation folded into the 3X3 matrix parameters and fold the flare and surround effects into the three one-dimensional lookup tables (assuming one uses the minimal model for monitors).
ICC_ColorSpace
| Modifier and Type | Class and Description |
|---|---|
| private static interface | ColorSpace.
The lazy cache of singletons for the predefined built-in color spaces. |
| Modifier and Type | Field and Description |
|---|---|
| private transient volatile String[] | compName
Lazy-initialized names of components in the color space. |
| public static final int | CS_CIEXYZ
The built-in CIEXYZ conversion color space defined above. |
| public static final int | CS_GRAY
The built-in linear gray scale color space. |
| public static final int | CS_LINEAR_RGB
The built-in linear RGB color space. |
| public static final int | CS_PYCC
The built-in Photo YCC conversion color space. |
| public static final int | CS_sRGB
The built-in sRGB color space defined at http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html. |
| private final int | |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.2 for interoperability. |
| private final int | |
| public static final int | TYPE_2CLR
Generic 2 component color spaces. |
| public static final int | TYPE_3CLR
Generic 3 component color spaces. |
| public static final int | TYPE_4CLR
Generic 4 component color spaces. |
| public static final int | TYPE_5CLR
Generic 5 component color spaces. |
| public static final int | TYPE_6CLR
Generic 6 component color spaces. |
| public static final int | TYPE_7CLR
Generic 7 component color spaces. |
| public static final int | TYPE_8CLR
Generic 8 component color spaces. |
| public static final int | TYPE_9CLR
Generic 9 component color spaces. |
| public static final int | TYPE_ACLR
Generic 10 component color spaces. |
| public static final int | TYPE_BCLR
Generic 11 component color spaces. |
| public static final int | TYPE_CCLR
Generic 12 component color spaces. |
| public static final int | TYPE_CMY
Any of the family of CMY color spaces. |
| public static final int | TYPE_CMYK
Any of the family of CMYK color spaces. |
| public static final int | TYPE_DCLR
Generic 13 component color spaces. |
| public static final int | TYPE_ECLR
Generic 14 component color spaces. |
| public static final int | TYPE_FCLR
Generic 15 component color spaces. |
| public static final int | TYPE_GRAY
Any of the family of GRAY color spaces. |
| public static final int | TYPE_HLS
Any of the family of HLS color spaces. |
| public static final int | TYPE_HSV
Any of the family of HSV color spaces. |
| public static final int | TYPE_Lab
Any of the family of Lab color spaces. |
| public static final int | TYPE_Luv
Any of the family of Luv color spaces. |
| public static final int | TYPE_RGB
Any of the family of RGB color spaces. |
| public static final int | TYPE_XYZ
Any of the family of XYZ color spaces. |
| public static final int | TYPE_YCbCr
Any of the family of YCbCr color spaces. |
| public static final int | TYPE_Yxy
Any of the family of Yxy color spaces. |
| Access | Constructor and Description |
|---|---|
| protected | ColorSpace(int
one of the type, int ColorSpace type constantsthe number of components in the color space numComponents)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public abstract float[] | Returns: a float array with length equal to the number of components in thisColorSpacea float array with length of at least 3 colorvalue)Transforms a color value assumed to be in the |
| public abstract float[] | Returns: a float array with length equal to the number of components in thisColorSpacea float array with length of at least 3 rgbvalue)Transforms a color value assumed to be in the default |
| public static ColorSpace | Returns: the requestedColorSpace objecta specific color space identified by one of the predefined
class constants (e.g. cspace)CS_sRGB, CS_LINEAR_RGB,
CS_CIEXYZ, CS_GRAY, or CS_PYCC)Returns a |
| public float | Returns: the maximum normalized component valuethe component index component)Returns the maximum normalized color component value for the specified component. |
| public float | Returns: the minimum normalized component valuethe component index component)Returns the minimum normalized color component value for the specified component. |
| public String | Returns: the name of the component at the specified indexthe component index component)Returns the name of the component given the component index. |
| public int | Returns: the number of components in thisColorSpaceReturns the number of components of this ColorSpace. |
| public int | Returns: the type constant that represents the type of thisColorSpaceReturns the color space type of this |
| public boolean | Returns: true if this is a CS_sRGB color space,
false if it is notReturns true if the |
| pack-priv final void | rangeCheck(int
the component index component)Checks that |
| public abstract float[] | Returns: a float array of length 3a float array with length of at least the number of
components in this colorvalue)ColorSpaceTransforms a color value assumed to be in this |
| public abstract float[] | Returns: a float array of length 3a float array with length of at least the number of
components in this colorvalue)ColorSpaceTransforms a color value assumed to be in this |
| compName | back to summary |
|---|---|
| private transient volatile String[] compName Lazy-initialized names of components in the color space. | |
| CS_CIEXYZ | back to summary |
|---|---|
| public static final int CS_CIEXYZ The built-in CIEXYZ conversion color space defined above. | |
| CS_GRAY | back to summary |
|---|---|
| public static final int CS_GRAY The built-in linear gray scale color space. | |
| CS_LINEAR_RGB | back to summary |
|---|---|
| public static final int CS_LINEAR_RGB The built-in linear RGB color space. This space is based on the same RGB
primaries as | |
| CS_PYCC | back to summary |
|---|---|
| public static final int CS_PYCC The built-in Photo YCC conversion color space. | |
| CS_sRGB | back to summary |
|---|---|
| public static final int CS_sRGB The built-in sRGB color space defined at http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html. | |
| numComponents | back to summary |
|---|---|
| private final int numComponents | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.2 for interoperability. | |
| type | back to summary |
|---|---|
| private final int type | |
| TYPE_2CLR | back to summary |
|---|---|
| public static final int TYPE_2CLR Generic 2 component color spaces. | |
| TYPE_3CLR | back to summary |
|---|---|
| public static final int TYPE_3CLR Generic 3 component color spaces. | |
| TYPE_4CLR | back to summary |
|---|---|
| public static final int TYPE_4CLR Generic 4 component color spaces. | |
| TYPE_5CLR | back to summary |
|---|---|
| public static final int TYPE_5CLR Generic 5 component color spaces. | |
| TYPE_6CLR | back to summary |
|---|---|
| public static final int TYPE_6CLR Generic 6 component color spaces. | |
| TYPE_7CLR | back to summary |
|---|---|
| public static final int TYPE_7CLR Generic 7 component color spaces. | |
| TYPE_8CLR | back to summary |
|---|---|
| public static final int TYPE_8CLR Generic 8 component color spaces. | |
| TYPE_9CLR | back to summary |
|---|---|
| public static final int TYPE_9CLR Generic 9 component color spaces. | |
| TYPE_ACLR | back to summary |
|---|---|
| public static final int TYPE_ACLR Generic 10 component color spaces. | |
| TYPE_BCLR | back to summary |
|---|---|
| public static final int TYPE_BCLR Generic 11 component color spaces. | |
| TYPE_CCLR | back to summary |
|---|---|
| public static final int TYPE_CCLR Generic 12 component color spaces. | |
| TYPE_CMY | back to summary |
|---|---|
| public static final int TYPE_CMY Any of the family of CMY color spaces. | |
| TYPE_CMYK | back to summary |
|---|---|
| public static final int TYPE_CMYK Any of the family of CMYK color spaces. | |
| TYPE_DCLR | back to summary |
|---|---|
| public static final int TYPE_DCLR Generic 13 component color spaces. | |
| TYPE_ECLR | back to summary |
|---|---|
| public static final int TYPE_ECLR Generic 14 component color spaces. | |
| TYPE_FCLR | back to summary |
|---|---|
| public static final int TYPE_FCLR Generic 15 component color spaces. | |
| TYPE_GRAY | back to summary |
|---|---|
| public static final int TYPE_GRAY Any of the family of GRAY color spaces. | |
| TYPE_HLS | back to summary |
|---|---|
| public static final int TYPE_HLS Any of the family of HLS color spaces. | |
| TYPE_HSV | back to summary |
|---|---|
| public static final int TYPE_HSV Any of the family of HSV color spaces. | |
| TYPE_Lab | back to summary |
|---|---|
| public static final int TYPE_Lab Any of the family of Lab color spaces. | |
| TYPE_Luv | back to summary |
|---|---|
| public static final int TYPE_Luv Any of the family of Luv color spaces. | |
| TYPE_RGB | back to summary |
|---|---|
| public static final int TYPE_RGB Any of the family of RGB color spaces. | |
| TYPE_XYZ | back to summary |
|---|---|
| public static final int TYPE_XYZ Any of the family of XYZ color spaces. | |
| TYPE_YCbCr | back to summary |
|---|---|
| public static final int TYPE_YCbCr Any of the family of YCbCr color spaces. | |
| TYPE_Yxy | back to summary |
|---|---|
| public static final int TYPE_Yxy Any of the family of Yxy color spaces. | |
| ColorSpace | back to summary |
|---|---|
| protected ColorSpace(int type, int numComponents) Constructs a
| |
| fromCIEXYZ | back to summary |
|---|---|
| public abstract float[] fromCIEXYZ(float[] colorvalue) Transforms a color value assumed to be in the
This method transforms color values using relative colorimetry, as
defined by the International Color Consortium standard. This means that
the XYZ argument values taken by this method are represented relative to
the D50 white point of the
| |
| fromRGB | back to summary |
|---|---|
| public abstract float[] fromRGB(float[] rgbvalue) Transforms a color value assumed to be in the default
This method transforms color values using algorithms designed to produce
the best perceptual match between input and output colors. In order to do
colorimetric conversion of color values, you should use the
| |
| getInstance | back to summary |
|---|---|
| public static ColorSpace getInstance(int cspace) Returns a
| |
| getMaxValue | back to summary |
|---|---|
| public float getMaxValue(int component) Returns the maximum normalized color component value for the specified component. The default implementation in this abstract class returns 1.0 for all components. Subclasses should override this method if necessary.
| |
| getMinValue | back to summary |
|---|---|
| public float getMinValue(int component) Returns the minimum normalized color component value for the specified component. The default implementation in this abstract class returns 0.0 for all components. Subclasses should override this method if necessary.
| |
| getName | back to summary |
|---|---|
| public String getName(int component) Returns the name of the component given the component index.
| |
| getNumComponents | back to summary |
|---|---|
| public int getNumComponents() Returns the number of components of this ColorSpace.
| |
| getType | back to summary |
|---|---|
| public int getType() Returns the color space type of this
| |
| isCS_sRGB | back to summary |
|---|---|
| public boolean isCS_sRGB() Returns true if the
| |
| rangeCheck | back to summary |
|---|---|
| pack-priv final void rangeCheck(int component) Checks that
| |
| toCIEXYZ | back to summary |
|---|---|
| public abstract float[] toCIEXYZ(float[] colorvalue) Transforms a color value assumed to be in this
This method transforms color values using relative colorimetry, as
defined by the International Color Consortium standard. This means that
the XYZ values returned by this method are represented relative to the
D50 white point of the
| |
| toRGB | back to summary |
|---|---|
| public abstract float[] toRGB(float[] colorvalue) Transforms a color value assumed to be in this
This method transforms color values using algorithms designed to produce
the best perceptual match between input and output colors. In order to do
colorimetric conversion of color values, you should use the
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final ColorSpace | |
| public static final ColorSpace | |
| public static final ColorSpace | |
| public static final ColorSpace | |
| public static final ColorSpace |
| GRAY | back to summary |
|---|---|
| public static final ColorSpace GRAY | |
| LRGB | back to summary |
|---|---|
| public static final ColorSpace LRGB | |
| PYCC | back to summary |
|---|---|
| public static final ColorSpace PYCC | |
| SRGB | back to summary |
|---|---|
| public static final ColorSpace SRGB | |
| XYZ | back to summary |
|---|---|
| public static final ColorSpace XYZ | |