lux::ColorSystem Class Reference

#include <color.h>

Collaboration diagram for lux::ColorSystem:
[legend]

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 ToRGBConstrained (const XYZColor &color) const
XYZColor ToXYZ (const RGBColor &color) const
bool Constrain (float lum, RGBColor &rgb) const
RGBColor Limit (const RGBColor &rgb, int method) const

Public 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 XYZToRGB [3][3]
 Corresponding conversion matrix from XYZ to RGB.
float RGBToXYZ [3][3]
 Corresponding conversion matrix from RGB to XYZ.

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 246 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 53 of file color.cpp.

References lux::dot(), lux::Invert3x3(), luminance, cimg_library::matrix(), lux::Multiply3x3(), RGBToXYZ, lux::Transform3x3(), xBlue, xGreen, xRed, xWhite, XYZToRGB, yBlue, yGreen, yRed, and yWhite.


Member Function Documentation

bool lux::ColorSystem::Constrain ( float  lum,
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 133 of file color.cpp.

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

Referenced by ToRGBConstrained().

RGBColor lux::ColorSystem::Limit ( const RGBColor rgb,
int  method 
) const
RGBColor lux::ColorSystem::ToRGBConstrained ( const 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 263 of file color.h.

References lux::Color::c, Constrain(), XYZToRGB, and lux::XYZColor::Y().

Referenced by lux::FlexImageFilm::WriteImage2().

XYZColor lux::ColorSystem::ToXYZ ( const RGBColor color  )  const [inline]
Parameters:
[in] color A color in RGB space
Returns:
The color converted in XYZ space

Definition at line 277 of file color.h.

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

Referenced by lux::FlexImageFilm::ComputeGroupScale().


Member Data Documentation

White intensity.

Definition at line 291 of file color.h.

Referenced by ColorSystem(), Constrain(), and Limit().

Corresponding conversion matrix from RGB to XYZ.

Definition at line 293 of file color.h.

Referenced by ColorSystem(), Limit(), and ToXYZ().

Definition at line 289 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Definition at line 288 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Definition at line 287 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Definition at line 290 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Corresponding conversion matrix from XYZ to RGB.

Definition at line 292 of file color.h.

Referenced by ColorSystem(), and ToRGBConstrained().

Blue coordinates.

Definition at line 289 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Green coordinates.

Definition at line 288 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

Red coordinates.

Definition at line 287 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().

White coordinates.

Definition at line 290 of file color.h.

Referenced by ColorSystem(), and lux::lux_png_error().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208