qualpal 3.3.0
Loading...
Searching...
No Matches
qualpal::colors::XYZ Class Reference

XYZ color representation (CIE 1931 color space). More...

#include <colors.h>

Public Member Functions

 XYZ ()
 Default constructor initializes XYZ to (0,0,0)
 
 XYZ (const double x, const double y, const double z)
 Construct XYZ from component values.
 
 XYZ (const RGB &rgb)
 Construct XYZ from RGB color.
 
 XYZ (const Lab &lab, const std::array< double, 3 > &white_point={ 0.95047, 1, 1.08883 })
 Construct XYZ from Lab color.
 
 XYZ (const HSL &hsl)
 Construct XYZ from HSL color.
 
 XYZ (const LCHab &lch, const std::array< double, 3 > &white_point={ 0.95047, 1, 1.08883 })
 Construct XYZ from LCHab color.
 
bool operator== (const XYZ &other) const
 equality operator for XYZ colors
 
bool operator!= (const XYZ &other) const
 inequality operator for XYZ colors
 
double x () const
 Get X component.
 
double y () const
 Get Y component (luminance)
 
double z () const
 Get Z component.
 

Detailed Description

XYZ color representation (CIE 1931 color space).

Represents a color in the device-independent CIE 1931 XYZ color space. Used as an intermediate for conversions between RGB and perceptually uniform spaces (Lab, LCHab, DIN99d).

  • X: [0, ~0.95] (roughly red-like)
  • Y: [0, 1] (luminance)
  • Z: [0, ~1.09] (roughly blue-like)

Most conversions use the D65 reference white point by default.

// Create XYZ from RGB
XYZ xyz_from_rgb(RGB(0.5, 0.2, 0.7));
// Modify whitepoint
XYZ xyz_custom_white(0.4, 0.5, 0.6, { 0.96422, 1.0, 0.82521 }); // D50
RGB color representation with values in [0,1] range.
Definition colors.h:92
XYZ color representation (CIE 1931 color space).
Definition colors.h:312
See also
RGB, Lab, LCHab, DIN99d for conversions.

Definition at line 311 of file colors.h.

Constructor & Destructor Documentation

◆ XYZ() [1/5]

qualpal::colors::XYZ::XYZ ( const double  x,
const double  y,
const double  z 
)

Construct XYZ from component values.

Parameters
xX component (roughly red-like)
yY component (luminance)
zZ component (roughly blue-like)

◆ XYZ() [2/5]

qualpal::colors::XYZ::XYZ ( const RGB rgb)

Construct XYZ from RGB color.

Parameters
rgbRGB color to convert from

◆ XYZ() [3/5]

qualpal::colors::XYZ::XYZ ( const Lab lab,
const std::array< double, 3 > &  white_point = { 0.95047, 1, 1.08883 } 
)

Construct XYZ from Lab color.

Parameters
labLab color to convert from
white_pointReference white point (default: D65)

◆ XYZ() [4/5]

qualpal::colors::XYZ::XYZ ( const HSL hsl)

Construct XYZ from HSL color.

Parameters
hslHSL color to convert from

◆ XYZ() [5/5]

qualpal::colors::XYZ::XYZ ( const LCHab lch,
const std::array< double, 3 > &  white_point = { 0.95047, 1, 1.08883 } 
)

Construct XYZ from LCHab color.

Parameters
lchLCHab color to convert from
white_pointReference white point (default: D65)

Member Function Documentation

◆ operator!=()

bool qualpal::colors::XYZ::operator!= ( const XYZ other) const
inline

inequality operator for XYZ colors

Parameters
otherOther XYZ color to compare with
Returns
true if XYZ colors are not equal, false otherwise

Definition at line 376 of file colors.h.

◆ operator==()

bool qualpal::colors::XYZ::operator== ( const XYZ other) const
inline

equality operator for XYZ colors

Parameters
otherOther XYZ color to compare with
Returns
true if both XYZ colors are equal, false otherwise

Definition at line 365 of file colors.h.

◆ x()

double qualpal::colors::XYZ::x ( ) const
inline

Get X component.

Definition at line 379 of file colors.h.

◆ y()

double qualpal::colors::XYZ::y ( ) const
inline

Get Y component (luminance)

Definition at line 381 of file colors.h.

◆ z()

double qualpal::colors::XYZ::z ( ) const
inline

Get Z component.

Definition at line 383 of file colors.h.


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