Class CIELabColorSpace
- java.lang.Object
-
- java.awt.color.ColorSpace
-
- org.apache.xmlgraphics.java2d.color.CIELabColorSpace
-
- All Implemented Interfaces:
java.io.Serializable
public class CIELabColorSpace extends java.awt.color.ColorSpaceThis 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.
-
-
Field Summary
-
Fields inherited from class java.awt.color.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
Constructors Constructor Description CIELabColorSpace()Default constructor using the D65 white point.CIELabColorSpace(float[] whitePoint)CIE Lab space constructor which allows to give an arbitrary white point.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description float[]fromCIEXYZ(float[] colorvalue)float[]fromRGB(float[] rgbvalue)static float[]getD50WhitePoint()Returns the D50 white point.static float[]getD65WhitePoint()Returns the D65 white point.floatgetMaxValue(int component)floatgetMinValue(int component)java.lang.StringgetName(int component)float[]getWhitePoint()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.java.awt.ColortoColor(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.java.awt.ColortoColor(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)
-
-
-
Constructor Detail
-
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 Detail
-
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 classjava.awt.color.ColorSpace
-
getMaxValue
public float getMaxValue(int component)
- Overrides:
getMaxValuein classjava.awt.color.ColorSpace
-
getName
public java.lang.String getName(int component)
- Overrides:
getNamein classjava.awt.color.ColorSpace
-
fromCIEXYZ
public float[] fromCIEXYZ(float[] colorvalue)
- Specified by:
fromCIEXYZin classjava.awt.color.ColorSpace
-
fromRGB
public float[] fromRGB(float[] rgbvalue)
- Specified by:
fromRGBin classjava.awt.color.ColorSpace
-
toCIEXYZ
public float[] toCIEXYZ(float[] colorvalue)
- Specified by:
toCIEXYZin classjava.awt.color.ColorSpace
-
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:
toCIEXYZ(float[])
-
toRGB
public float[] toRGB(float[] colorvalue)
- Specified by:
toRGBin classjava.awt.color.ColorSpace
-
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
public java.awt.Color 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.- 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
public java.awt.Color 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.- 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
-
-