libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
XYZColor Class Reference

CIE XYZ color value. More...

#include <xyzcolor.h>

Public Types

using DataType = Array< double, 3 >
 Underlying storage type for the three XYZ components.
 

Public Member Functions

 XYZColor ()
 Constructs an invalid XYZColor with all components set to -1.0.
 
 XYZColor (const DataType &val)
 Constructs an XYZColor from a DataType array.
 
 XYZColor (double x, double y, double z)
 Constructs an XYZColor from individual component values.
 
bool isValid () const
 Returns true if all components are in the valid [0.0, 1.0] range.
 
const DataTypedata () const
 Returns a const reference to the underlying data array.
 
DataTypedata ()
 Returns a mutable reference to the underlying data array.
 
double x ()
 Returns the X component.
 
double y ()
 Returns the Y component.
 
double z ()
 Returns the Z component.
 
void set (double x, double y, double z)
 Sets all three XYZ components.
 
void setX (double val)
 Sets the X component.
 
void setY (double val)
 Sets the Y component.
 
void setZ (double val)
 Sets the Z component.
 
XYZColor lerp (const XYZColor &val, double t) const
 Returns a linearly interpolated XYZColor between this and val.
 
 operator String ()
 Converts to a String using toString().
 
String toString () const
 Returns a string representation of the XYZ color.
 

Detailed Description

CIE XYZ color value.

Represents a color in the CIE 1931 XYZ color space as three double-precision components. Valid component values are in the [0.0, 1.0] range. A default-constructed XYZColor uses -1.0 for all components to indicate an invalid/uninitialized state.

Constructor & Destructor Documentation

◆ XYZColor() [1/2]

XYZColor::XYZColor ( const DataType val)
inline

Constructs an XYZColor from a DataType array.

Parameters
valThe array containing X, Y, and Z values.

◆ XYZColor() [2/2]

XYZColor::XYZColor ( double  x,
double  y,
double  z 
)
inline

Constructs an XYZColor from individual component values.

Parameters
xThe X (luminance-related) component.
yThe Y (luminance) component.
zThe Z (blue-related) component.

Member Function Documentation

◆ lerp()

XYZColor XYZColor::lerp ( const XYZColor val,
double  t 
) const
inline

Returns a linearly interpolated XYZColor between this and val.

Parameters
valThe target color to interpolate towards.
tThe interpolation factor, where 0.0 returns this color and 1.0 returns val.
Returns
The interpolated XYZColor.

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