Class CIELabColorSpace

    • 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
      • fromCIEXYZ

        public float[] fromCIEXYZ​(float[] colorvalue)
        Specified by:
        fromCIEXYZ in class ColorSpace
      • fromRGB

        public float[] fromRGB​(float[] rgbvalue)
        Specified by:
        fromRGB in class ColorSpace
      • toCIEXYZ

        public float[] toCIEXYZ​(float[] colorvalue)
        Specified by:
        toCIEXYZ in class ColorSpace
      • toCIEXYZNative

        public float[] toCIEXYZNative​(float l,
                                      float a,
                                      float b)
        Transforms a color value assumed to be in this ColorSpace into 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:
        toRGB in class 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 Color toColor​(float[] colorvalue,
                             float alpha)
        Creates a Color instance 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 Color toColor​(float l,
                             float a,
                             float b,
                             float alpha)
        Creates a Color instance 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