lux::ColorSystem Class Reference

#include <color.h>

List of all members.

Public Member Functions

 ColorSystem (float xR, float yR, float xG, float yG, float xB, float yB, float xW, float yW, float lum=1.)
RGBColor Convert (XYZColor &color) const
bool Constrain (const XYZColor &xyz, RGBColor &rgb) const

Protected Attributes

float xRed
float yRed
 Red coordinates.
float xGreen
float yGreen
 Green coordinates.
float xBlue
float yBlue
 Blue coordinates.
float xWhite
float yWhite
 White coordinates.
float luminance
 White intensity.
float conversion [3][3]
 Corresponding conversion matrix from XYZ to RGB.


Detailed Description

A colour system is defined by the CIE x and y coordinates of its three primary illuminants and the x and y coordinates of the white point. The additional definition of the white point intensity allow for intensity adaptation

Definition at line 270 of file color.h.


Constructor & Destructor Documentation

lux::ColorSystem::ColorSystem ( float  xR,
float  yR,
float  xG,
float  yG,
float  xB,
float  yB,
float  xW,
float  yW,
float  lum = 1. 
)

Parameters:
[in] xR x value of red in xyY space
[in] yR y value of red in xyY space
[in] xG x value of green in xyY space
[in] yG y value of green in xyY space
[in] xB x value of blue in xyY space
[in] yB y value of blue in xyY space
[in] xW x value of white in xyY space
[in] yW y value of white in xyY space
[in] lum Y (intensity) value of white in xyY space
Initialize a colorspace conversion instance by providing reference values of red, green, blue and white point. This functions computes the corresponding convertion matrix from XYZ space to RGB space.

Definition at line 100 of file color.cpp.

References conversion, lux::dot(), lux::inverse(), luminance, cimg_library::matrix(), lux::multiply(), xBlue, xGreen, xRed, xWhite, yBlue, yGreen, yRed, and yWhite.


Member Function Documentation

bool lux::ColorSystem::Constrain ( const XYZColor xyz,
RGBColor rgb 
) const

Parameters:
[in] xyz The color in XYZ space
[in,out] rgb The same color in RGB space
Returns:
Whether the RGB representation was modified or not
Return values:
true The color has been modified
false The color was inside the representable gamut: no modification occured
If the requested RGB shade contains a negative weight for one of the primaries, it lies outside the colour gamut accessible from the given triple of primaries. Desaturate it by mixing with the white point of the colour system so as to reduce the primary with the negative weight to zero. This is equivalent to finding the intersection on the CIE diagram of a line drawn between the white point and the requested colour with the edge of the Maxwell triangle formed by the three primaries. This function tries not to change the overall intensity, only the tint is shifted to be inside the representable gamut.

Definition at line 167 of file color.cpp.

References lux::Color::c, lux::InsideGamut(), Lerp(), and luminance.

RGBColor lux::ColorSystem::Convert ( XYZColor color  )  const [inline]

Parameters:
[in] color A color in XYZ space
Returns:
The color converted in RGB space
Determine the contribution of each primary in a linear combination which sums to the desired chromaticity. If the requested chromaticity falls outside the Maxwell triangle (colour gamut) formed by the three primaries, one of the R, G, or B weights will be negative. Use Constrain() to desaturate an outside-gamut colour to the closest representation within the available gamut.
See also:
Constrain

Definition at line 287 of file color.h.

References lux::Color::c, and conversion.


Member Data Documentation

float lux::ColorSystem::conversion[3][3] [protected]

Corresponding conversion matrix from XYZ to RGB.

Definition at line 301 of file color.h.

Referenced by ColorSystem(), and Convert().

float lux::ColorSystem::luminance [protected]

White intensity.

Definition at line 300 of file color.h.

Referenced by ColorSystem(), and Constrain().

float lux::ColorSystem::xBlue [protected]

Definition at line 298 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::xGreen [protected]

Definition at line 297 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::xRed [protected]

Definition at line 296 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::xWhite [protected]

Definition at line 299 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::yBlue [protected]

Blue coordinates.

Definition at line 298 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::yGreen [protected]

Green coordinates.

Definition at line 297 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::yRed [protected]

Red coordinates.

Definition at line 296 of file color.h.

Referenced by ColorSystem().

float lux::ColorSystem::yWhite [protected]

White coordinates.

Definition at line 299 of file color.h.

Referenced by ColorSystem().


The documentation for this class was generated from the following files:

Generated on Tue Nov 10 01:36:39 2009 for lux by  doxygen 1.5.9