Class CIELabColorSpace
java.lang.Object
java.awt.color.ColorSpace
org.apache.xmlgraphics.java2d.color.CIELabColorSpace
- All Implemented Interfaces:
Serializable
This class defines the CIE L*a*b* (CIE 1976) color space. Valid values for L* are between 0
and 100, for a* and b* between -127 and +127.
- See Also:
-
Field Summary
Fields inherited from class ColorSpace
CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using the D65 white point.CIELabColorSpace(float[] whitePoint) CIE Lab space constructor which allows to give an arbitrary white point. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]fromCIEXYZ(float[] colorvalue) float[]fromRGB(float[] rgbvalue) static float[]Returns the D50 white point.static float[]Returns the D65 white point.floatgetMaxValue(int component) floatgetMinValue(int component) getName(int component) float[]Returns the configured white point.float[]toCIEXYZ(float[] colorvalue) float[]toCIEXYZNative(float l, float a, float b) Transforms a color value assumed to be in thisColorSpaceinto the CS_CIEXYZ conversion color space.toColor(float[] colorvalue, float alpha) Creates aColorinstance from color values usually used by the L*a*b* color space by scaling them to the 0.0..1.0 range expected by Color's constructor.toColor(float l, float a, float b, float alpha) Creates aColorinstance from color values usually used by the L*a*b* color space by scaling them to the 0.0..1.0 range expected by Color's constructor.float[]toNativeComponents(float[] comps) Converts normalized (0..1) color components to CIE L*a*b*'s native value range.float[]toRGB(float[] colorvalue) Methods inherited from class ColorSpace
getInstance, getNumComponents, getType, isCS_sRGB
-
Constructor Details
-
CIELabColorSpace
public CIELabColorSpace()Default constructor using the D65 white point. -
CIELabColorSpace
public CIELabColorSpace(float[] whitePoint) CIE Lab space constructor which allows to give an arbitrary white point.- Parameters:
whitePoint- the white point in XYZ coordinates (valid values: 0.0f to 1.0f, although values slightly larger than 1.0f are common)
-
-
Method Details
-
getD65WhitePoint
public static float[] getD65WhitePoint()Returns the D65 white point.- Returns:
- the D65 white point.
-
getD50WhitePoint
public static float[] getD50WhitePoint()Returns the D50 white point.- Returns:
- the D50 white point.
-
getWhitePoint
public float[] getWhitePoint()Returns the configured white point.- Returns:
- the white point in CIE XYZ coordinates
-
getMinValue
public float getMinValue(int component) - Overrides:
getMinValuein classColorSpace
-
getMaxValue
public float getMaxValue(int component) - Overrides:
getMaxValuein classColorSpace
-
getName
- Overrides:
getNamein classColorSpace
-
fromCIEXYZ
public float[] fromCIEXYZ(float[] colorvalue) - Specified by:
fromCIEXYZin classColorSpace
-
fromRGB
public float[] fromRGB(float[] rgbvalue) - Specified by:
fromRGBin classColorSpace
-
toCIEXYZ
public float[] toCIEXYZ(float[] colorvalue) - Specified by:
toCIEXYZin classColorSpace
-
toCIEXYZNative
public float[] toCIEXYZNative(float l, float a, float b) Transforms a color value assumed to be in thisColorSpaceinto the CS_CIEXYZ conversion color space. This method uses component values in CIE Lab's native color ranges rather than the normalized values between 0 and 1.- Parameters:
l- the L* component (values between 0 and 100)a- the a* component (usually between -128 and +128)b- the b* component (usually between -128 and +128)- Returns:
- the XYZ color values
- See Also:
-
toRGB
public float[] toRGB(float[] colorvalue) - Specified by:
toRGBin classColorSpace
-
toNativeComponents
public float[] toNativeComponents(float[] comps) Converts normalized (0..1) color components to CIE L*a*b*'s native value range.- Parameters:
comps- the normalized components.- Returns:
- the denormalized components
-
toColor
Creates aColorinstance from color values usually used by the L*a*b* color space by scaling them to the 0.0..1.0 range expected by Color's constructor.- Parameters:
colorvalue- the original color values (native value range, i.e. not normalized to 0.0..1.0)alpha- the alpha component- Returns:
- the requested color instance
-
toColor
Creates aColorinstance from color values usually used by the L*a*b* color space by scaling them to the 0.0..1.0 range expected by Color's constructor.- Parameters:
l- the L* component (values between 0 and 100)a- the a* component (usually between -128 and +127)b- the b* component (usually between -128 and +127)alpha- the alpha component (values between 0 and 1)- Returns:
- the requested color instance
-