JHotDraw 7.6

org.jhotdraw.color
Class CIELABColorSpace

java.lang.Object
  extended by java.awt.color.ColorSpace
      extended by org.jhotdraw.color.CIELABColorSpace
All Implemented Interfaces:
java.io.Serializable, NamedColorSpace

public class CIELABColorSpace
extends java.awt.color.ColorSpace
implements NamedColorSpace

The 1976 CIE L*a*b* color space (CIELAB).

The L* coordinate of an object is the lightness intensity as measured on a scale from 0 to 100, where 0 represents black and 100 represents white.

The a* coordinate of an object represents the position of the object’s color on a pure green and pure red scale, where -127 represents pure green and +127 represents pure red.

The b* coordinate represents the position of the object’s color on a pure blue and pure yellow scale, where -127 represents pure blue and +127 represents pure yellow.

The distance that can be calculated between two colors, is directly proportional to the difference between the two colors as perceived by the human eye.

The above description has been derived from http://www.optelvision.com/documents/optel-vision-s-explanation-on-cielab-color-space.pdf

Version:
$Id: CIELABColorSpace.java 717 2010-11-21 12:30:57Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Nested Class Summary
static class CIELABColorSpace.OutsideGamutHandling
           
 
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
CIELABColorSpace()
           
 
Method Summary
 float[] fromCIEXYZ(float[] colorvalue)
          XYT to Lab.
 float[] fromRGB(float[] rgbvalue)
           
 float getMaxValue(int component)
           
 float getMinValue(int component)
           
 java.lang.String getName()
           
 java.lang.String getName(int component)
           
 CIELABColorSpace.OutsideGamutHandling getOutsideGamutHandling()
           
static void main(java.lang.String[] arg)
           
 void setOutsideGamutHandling(CIELABColorSpace.OutsideGamutHandling b)
           
 float[] toCIEXYZ(float[] colorvalue)
          Lab to XYZ.
 float[] toRGB(float[] colorvalue)
           
 
Methods inherited from class java.awt.color.ColorSpace
getInstance, getNumComponents, getType, isCS_sRGB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CIELABColorSpace

public CIELABColorSpace()
Method Detail

toRGB

public float[] toRGB(float[] colorvalue)
Specified by:
toRGB in class java.awt.color.ColorSpace

fromRGB

public float[] fromRGB(float[] rgbvalue)
Specified by:
fromRGB in class java.awt.color.ColorSpace

toCIEXYZ

public float[] toCIEXYZ(float[] colorvalue)
Lab to XYZ.
 X = xr*Xw;
 Y = yr*Yw;
 Z = zr*Zw;
 
where
 xr = fx^3, if fx^3 > eps
    = (116*fx - 16)/k, if fx^3 <= eps

 yr = ((L+16)/116)^3, if L > k*eps
    = L/k, if L <= k*eps

 zr = fz^3, if fz^3 > eps
    = (116*fz - 16)/k, if fz^3 <= eps

 fx = a/500+fy

 fz = fy - b / 200

 fy = (L+16)/116

 eps = 216/24389
 k = 24389/27
 
Source: http://www.brucelindbloom.com/index.html?Equations.html

Specified by:
toCIEXYZ in class java.awt.color.ColorSpace
Parameters:
colorvalue - Lab color value.
Returns:
CIEXYZ color value.

fromCIEXYZ

public float[] fromCIEXYZ(float[] colorvalue)
XYT to Lab.
 L = 116*fy - 16
 a = 500 * (fx - fy)
 b = 200 * (fy - fz)
 
where
 fx = xr^(1/3), if xr > eps
    = (k*xr + 16) / 116 if xr <= eps

 fy = yr^(1/3), if yr > eps
    = (k*yr + 16) / 116 if yr <= eps

 fz = zr^(1/3), if zr > eps
    = (k*zr + 16) / 116 if zr <= eps

 xr = X / Xw
 yr = Y / Yw
 zr = Z / Zw

 eps = 216/24389
 k = 24389/27
 
Source: http://www.brucelindbloom.com/index.html?Equations.html

Specified by:
fromCIEXYZ in class java.awt.color.ColorSpace
Parameters:
colorvalue - CIEXYZ color value.
Returns:
Lab color value.

getName

public java.lang.String getName()
Specified by:
getName in interface NamedColorSpace

getMinValue

public float getMinValue(int component)
Overrides:
getMinValue in class java.awt.color.ColorSpace

getMaxValue

public float getMaxValue(int component)
Overrides:
getMaxValue in class java.awt.color.ColorSpace

getName

public java.lang.String getName(int component)
Overrides:
getName in class java.awt.color.ColorSpace

setOutsideGamutHandling

public void setOutsideGamutHandling(CIELABColorSpace.OutsideGamutHandling b)

getOutsideGamutHandling

public CIELABColorSpace.OutsideGamutHandling getOutsideGamutHandling()

main

public static void main(java.lang.String[] arg)

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.