Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ColourSystem Class Reference

#include <ColourSystem.h>

List of all members.


Public Members

 ColourSystem ( Chroma primary1, Chroma primary2, Chroma primary3, Chroma whitePoint, ClrReal whiteLum = 1.0 )
Colour GamutToXYZ (const Colour &csClr)
Convert device colour to CIE XYZ colour.

Bool XYZIsOutOfGamut (const Colour &cieXYZ)
Returns true if the colour can't be represented by this device.

Colour XYZToGamut (const Colour &cieXYZ)
Convert CIE XYZ colour to device colour, and constrain the result to be within its gamut. More...

Colour XYZToGamutClip (const Colour &cieXYZ)
Do the same, but also clip result to [1, 1, 1].

Bool ChromaIsOutOfGamut (const Chroma &cieChroma)
Returns true if the colour can't be represented by this device.

Colour ChromaToGamut (const Chroma &cieChroma)
Convert CIE chromaticity to colour system colour of unit luminance.

ClrReal Luminance (const Colour &csClr)
Finds the luminance of csClr.

ClrMat toXYZ
ClrMat fromXYZ
Chroma prim0
Chroma prim1
Chroma prim2
Chroma white
ClrReal whiteLum


Detailed Description

A colour system is a way from transforming from a CIE tristimulous colour to a particular three-primary device.

The colour mapping is specified by the (x,y) chromaticities of the three primary colours of the system, and the chromaticity and luminance of the system's white point. (From this, the luminances of the primaries can be derived.) See Foley & van Dam, p586.

See ColourSystem.h for various predefined colours systems and illuminants.

Sources: http://www.inforamp.net/~poynton/ColorFAQ.html, http://www.efg2.com/lab/Graphics/Colors/Chromaticity.htm

Notes.

CIE Y matches the eye's spectral efficiency curve thus it measures the colour's *luminance*, in candela.

X and Z are orthogonal to luminance; varying them does not affect the luminance (or perceived brightness) of the colour, just its hue.

We can find the luminance of an RGB colour by simply transforming it back to XYZ space, and then taking the Y component. Thus if w = toXYZ[1], then dot(w, clr) is clr's luminance. The Luminance() method is provided for this.

To convert a chrominance/luminance (x, y, Y) specification into an XYZ colour requires:

        form XYZ corresponding to x, y
            clr = [x, y, 1.0 - y - x]
        normalise to a luminance of 1.0
            clr /= y;
        multiply through by luminance
            clr *= Y;   
    

Beware: converting a (say) unit luminance chroma to RGB will give you colours that are equally perceptually bright. This may not be what you want: if you try to display such a range of chromas, for instance, the white point will get mapped to [1, 1, 1], but bluish hues will be mapped so that the blue component is much bigger than 1, because of our relative insensitivity to blue.

In such cases, you probably want the brightest-possible device colour corresponding to each specified chroma, so...

        form XYZ corresponding to x, y
            clr = [x, y, 1.0 - y - x]
        convert to RGB
            clr = cs.XYZToGamut(clr);
        normalise to brightest possible RGB
            clr /= MaxCmpt(clr);
    

Definition at line 21 of file ColourSystem.h.


Constructor & Destructor Documentation

ColourSystem::ColourSystem (Chroma primary1, Chroma primary2, Chroma primary3, Chroma whitePoint, ClrReal whiteLuminance = 1.0)

Definition at line 74 of file ColourSystem.cc.


Member Function Documentation

Bool ColourSystem::ChromaIsOutOfGamut (const Chroma & cieChroma)

Returns true if the colour can't be represented by this device.

Definition at line 173 of file ColourSystem.cc.

Colour ColourSystem::ChromaToGamut (const Chroma & cieChroma)

Convert CIE chromaticity to colour system colour of unit luminance.

Definition at line 158 of file ColourSystem.cc.

Colour ColourSystem::GamutToXYZ (const Colour & csClr) [inline]

Convert device colour to CIE XYZ colour.

Definition at line 34 of file ColourSystem.h.

ClrReal ColourSystem::Luminance (const Colour & csClr) [inline]

Finds the luminance of csClr.

Definition at line 55 of file ColourSystem.h.

Bool ColourSystem::XYZIsOutOfGamut (const Colour & cieXYZ)

Returns true if the colour can't be represented by this device.

Definition at line 168 of file ColourSystem.cc.

Colour ColourSystem::XYZToGamut (const Colour & cieXYZ)

Convert CIE XYZ colour to device colour, and constrain the result to be within its gamut.

Transform from CIE XYZ space to the colour system's space (usually RGB), and saturate it to keep it within the system's gamut if necessary.

The version of this at http://www.fourmilab.ch/documents/specrend is buggy -- its choice of clip axis can be wrong.

Definition at line 112 of file ColourSystem.cc.

Colour ColourSystem::XYZToGamutClip (const Colour & cieXYZ)

Do the same, but also clip result to [1, 1, 1].

Definition at line 147 of file ColourSystem.cc.


Member Data Documentation

ClrMat ColourSystem::fromXYZ

Definition at line 62 of file ColourSystem.h.

Chroma ColourSystem::prim0

Definition at line 66 of file ColourSystem.h.

Chroma ColourSystem::prim1

Definition at line 67 of file ColourSystem.h.

Chroma ColourSystem::prim2

Definition at line 68 of file ColourSystem.h.

ClrMat ColourSystem::toXYZ

Definition at line 61 of file ColourSystem.h.

Chroma ColourSystem::white

Definition at line 69 of file ColourSystem.h.

ClrReal ColourSystem::whiteLum

Definition at line 70 of file ColourSystem.h.


The documentation for this class was generated from the following files:
Generated at Sat Aug 5 00:17:05 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000