@subsubheading Measurement-based Color Spaces @noindent @cindex tristimulus The @dfn{tristimulus} color spaces are those whose component values @cindex tristimulus are proportional measurements of light intensity. The CIEXYZ(1931) system provides 3 sets of spectra to dot-product with a spectrum of interest. The result of those dot-products is coordinates in CIEXYZ space. All tristimuls color spaces are related to CIEXYZ by linear transforms, namely matrix multiplication. Of the color spaces listed here, CIEXYZ and RGB709 are tristimulus spaces. @deftp {Color Space} CIEXYZ The CIEXYZ color space covers the full @dfn{gamut}. @cindex gamut It is the basis for color-space conversions. CIEXYZ is a list of three inexact numbers between 0.0 and 1.1. '(0. 0. 0.) is black; '(1. 1. 1.) is white. @end deftp @defun ciexyz->color xyz @var{xyz} must be a list of 3 numbers. If @var{xyz} is valid CIEXYZ coordinates, then @code{ciexyz->color} returns the color specified by @var{xyz}; otherwise returns #f. @end defun @defun color:ciexyz x y z Returns the CIEXYZ color composed of @var{x}, @var{y}, @var{z}. If the coordinates do not encode a valid CIEXYZ color, then an error is signaled. @end defun @defun color->ciexyz color Returns the list of 3 numbers encoding @var{color} in CIEXYZ. @end defun @deftp {Color Space} RGB709 BT.709-4 (03/00) @cite{Parameter values for the HDTV standards for production and international programme exchange} specifies parameter values for chromaticity, sampling, signal format, frame rates, etc., of high definition television signals. An RGB709 color is represented by a list of three inexact numbers between 0.0 and 1.0. '(0. 0. 0.) is black '(1. 1. 1.) is white. @end deftp @defun rgb709->color rgb @var{rgb} must be a list of 3 numbers. If @var{rgb} is valid RGB709 coordinates, then @code{rgb709->color} returns the color specified by @var{rgb}; otherwise returns #f. @end defun @defun color:rgb709 r g b Returns the RGB709 color composed of @var{r}, @var{g}, @var{b}. If the coordinates do not encode a valid RGB709 color, then an error is signaled. @end defun @defun color->rgb709 color Returns the list of 3 numbers encoding @var{color} in RGB709. @end defun @subsubheading Perceptual Uniformity @noindent Although properly encoding the chromaticity, tristimulus spaces do not match the logarithmic response of human visual systems to intensity. Minimum detectable differences between colors correspond to a smaller range of distances (6:1) in the L*a*b* and L*u*v* spaces than in tristimulus spaces (80:1). For this reason, color distances are computed in L*a*b* (or L*C*h). @deftp {Color Space} L*a*b* Is a CIE color space which better matches the human visual system's perception of color. It is a list of three numbers: @itemize @bullet @item 0 <= L* <= 100 (CIE @dfn{Lightness}) @cindex Lightness @item -500 <= a* <= 500 @item -200 <= b* <= 200 @end itemize @end deftp @defun l*a*b*->color L*a*b* white-point @var{L*a*b*} must be a list of 3 numbers. If @var{L*a*b*} is valid L*a*b* coordinates, then @code{l*a*b*->color} returns the color specified by @var{L*a*b*}; otherwise returns #f. @end defun @defun color:l*a*b* L* a* b* white-point Returns the L*a*b* color composed of @var{L*}, @var{a*}, @var{b*} with @var{white-point}. @defunx color:l*a*b* L* a* b* Returns the L*a*b* color composed of @var{L*}, @var{a*}, @var{b*}. If the coordinates do not encode a valid L*a*b* color, then an error is signaled. @end defun @defun color->l*a*b* color white-point Returns the list of 3 numbers encoding @var{color} in L*a*b* with @var{white-point}. @defunx color->l*a*b* color Returns the list of 3 numbers encoding @var{color} in L*a*b*. @end defun @deftp {Color Space} L*u*v* Is another CIE encoding designed to better match the human visual system's perception of color. @end deftp @defun l*u*v*->color L*u*v* white-point @var{L*u*v*} must be a list of 3 numbers. If @var{L*u*v*} is valid L*u*v* coordinates, then @code{l*u*v*->color} returns the color specified by @var{L*u*v*}; otherwise returns #f. @end defun @defun color:l*u*v* L* u* v* white-point Returns the L*u*v* color composed of @var{L*}, @var{u*}, @var{v*} with @var{white-point}. @defunx color:l*u*v* L* u* v* Returns the L*u*v* color composed of @var{L*}, @var{u*}, @var{v*}. If the coordinates do not encode a valid L*u*v* color, then an error is signaled. @end defun @defun color->l*u*v* color white-point Returns the list of 3 numbers encoding @var{color} in L*u*v* with @var{white-point}. @defunx color->l*u*v* color Returns the list of 3 numbers encoding @var{color} in L*u*v*. @end defun @subsubheading Cylindrical Coordinates @noindent HSL (Hue Saturation Lightness), HSV (Hue Saturation Value), HSI (Hue Saturation Intensity) and HCI (Hue Chroma Intensity) are cylindrical color spaces (with angle hue). But these spaces are all defined in terms device-dependent RGB spaces. @noindent One might wonder if there is some fundamental reason why intuitive specification of color must be device-dependent. But take heart! A cylindrical system can be based on L*a*b* and is used for predicting how close colors seem to observers. @deftp {Color Space} L*C*h Expresses the *a and b* of L*a*b* in polar coordinates. It is a list of three numbers: @itemize @bullet @item 0 <= L* <= 100 (CIE @dfn{Lightness}) @cindex Lightness @item C* (CIE @dfn{Chroma}) is the distance from the neutral (gray) axis. @cindex Chroma @item 0 <= h <= 360 (CIE @dfn{Hue}) is the angle. @cindex Hue @end itemize The colors by quadrant of h are: @multitable @columnfractions .20 .60 .20 @item 0 @tab red, orange, yellow @tab 90 @item 90 @tab yellow, yellow-green, green @tab 180 @item 180 @tab green, cyan (blue-green), blue @tab 270 @item 270 @tab blue, purple, magenta @tab 360 @end multitable @end deftp @defun l*c*h->color L*C*h white-point @var{L*C*h} must be a list of 3 numbers. If @var{L*C*h} is valid L*C*h coordinates, then @code{l*c*h->color} returns the color specified by @var{L*C*h}; otherwise returns #f. @end defun @defun color:l*c*h L* C* h white-point Returns the L*C*h color composed of @var{L*}, @var{C*}, @var{h} with @var{white-point}. @defunx color:l*c*h L* C* h Returns the L*C*h color composed of @var{L*}, @var{C*}, @var{h}. If the coordinates do not encode a valid L*C*h color, then an error is signaled. @end defun @defun color->l*c*h color white-point Returns the list of 3 numbers encoding @var{color} in L*C*h with @var{white-point}. @defunx color->l*c*h color Returns the list of 3 numbers encoding @var{color} in L*C*h. @end defun @subsubheading Digital Color Spaces @noindent The color spaces discussed so far are impractical for image data because of numerical precision and computational requirements. In 1998 the IEC adopted @cite{A Standard Default Color Space for the Internet - sRGB} (@url{http://www.w3.org/Graphics/Color/sRGB}). sRGB was cleverly designed to employ the 24-bit (256x256x256) color encoding already in widespread use; and the 2.2 gamma intrinsic to CRT monitors. @noindent Conversion from CIEXYZ to digital (sRGB) color spaces is accomplished by conversion first to a RGB709 tristimulus space with D65 white-point; then each coordinate is individually subjected to the same non-linear mapping. Inverse operations in the reverse order create the inverse transform. @deftp {Color Space} sRGB Is "A Standard Default Color Space for the Internet". Most display monitors will work fairly well with sRGB directly. Systems using ICC profiles @ftindex ICC Profile @footnote{ @noindent A comprehensive encoding of transforms between CIEXYZ and device color spaces is the International Color Consortium profile format, ICC.1:1998-09: @quotation The intent of this format is to provide a cross-platform device profile format. Such device profiles can be used to translate color data created on one device into another device's native color space. @end quotation } should work very well with sRGB. @end deftp @defun srgb->color rgb @var{rgb} must be a list of 3 numbers. If @var{rgb} is valid sRGB coordinates, then @code{srgb->color} returns the color specified by @var{rgb}; otherwise returns #f. @end defun @defun color:srgb r g b Returns the sRGB color composed of @var{r}, @var{g}, @var{b}. If the coordinates do not encode a valid sRGB color, then an error is signaled. @end defun @deftp {Color Space} xRGB Represents the equivalent sRGB color with a single 24-bit integer. The most significant 8 bits encode red, the middle 8 bits blue, and the least significant 8 bits green. @end deftp @defun color->srgb color Returns the list of 3 integers encoding @var{color} in sRGB. @end defun @defun color->xrgb color Returns the 24-bit integer encoding @var{color} in sRGB. @end defun @defun xrgb->color k Returns the sRGB color composed of the 24-bit integer @var{k}. @end defun @deftp {Color Space} e-sRGB Is "Photography - Electronic still picture imaging - Extended sRGB color encoding" (PIMA 7667:2001). It extends the gamut of sRGB; and its higher precision numbers provide a larger dynamic range. A triplet of integers represent e-sRGB colors. Three precisions are supported: @table @r @item e-sRGB10 0 to 1023 @item e-sRGB12 0 to 4095 @item e-sRGB16 0 to 65535 @end table @end deftp @defun e-srgb->color precision rgb @var{precision} must be the integer 10, 12, or 16. @var{rgb} must be a list of 3 numbers. If @var{rgb} is valid e-sRGB coordinates, then @code{e-srgb->color} returns the color specified by @var{rgb}; otherwise returns #f. @end defun @defun color:e-srgb 10 r g b Returns the e-sRGB10 color composed of integers @var{r}, @var{g}, @var{b}. @defunx color:e-srgb 12 r g b Returns the e-sRGB12 color composed of integers @var{r}, @var{g}, @var{b}. @defunx color:e-srgb 16 r g b Returns the e-sRGB16 color composed of integers @var{r}, @var{g}, @var{b}. If the coordinates do not encode a valid e-sRGB color, then an error is signaled. @end defun @defun color->e-srgb precision color @var{precision} must be the integer 10, 12, or 16. @code{color->e-srgb} returns the list of 3 integers encoding @var{color} in sRGB10, sRGB12, or sRGB16. @end defun