aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
aest::colors::XYZ Class Referencefinalexport

A color in the CIE 1931 XYZ color space, relative to the D65 white point. More...

Inheritance diagram for aest::colors::XYZ:
aest::colors::ColorBase< XYZ > aest::colors::ColorArithmetic< XYZ >

Public Member Functions

constexpr XYZ ()
 Default constructor initializes the color to opaque black (0, 0, 0, 1).
constexpr XYZ (const float x, const float y, const float z, const float a=1.0f)
 Construct a color from XYZ tristimulus values and alpha.
Color Channels
constexpr float x () const noexcept
 Get the X tristimulus value.
constexpr float y () const noexcept
 Get the Y tristimulus value, the relative luminance.
constexpr float z () const noexcept
 Get the Z tristimulus value.
Public Member Functions inherited from aest::colors::ColorBase< XYZ >
constexpr float alpha () const noexcept
 Get the alpha channel value in the 0-1 range.
constexpr float ch1 () const noexcept
 Get the first channel value.
constexpr float ch2 () const noexcept
 Get the second channel value.
constexpr float ch3 () const noexcept
 Get the third channel value.
constexpr XYZ opacity (const float alpha) const
 Returns a new color with the same channels and the specified alpha value.
constexpr XYZ & operator+= (const XYZ &other) noexcept
 Adds another color to this color in place.
constexpr XYZ & operator-= (const XYZ &other) noexcept
 Subtracts another color from this color in place.
constexpr XYZ & operator*= (const XYZ &other) noexcept
 Multiplies this color by another color in place.
constexpr XYZ & operator/= (const float scalar) noexcept
 Divides the color channels of this color in place, keeping its alpha.

Static Public Attributes

static constexpr std::string_view TYPE = "XYZ"
 Color space name, used by the std::formatter specialization.

Additional Inherited Members

Public Attributes inherited from aest::colors::ColorBase< XYZ >
friend Derived
 Lets the derived color reach the private constructor and channels.

Detailed Description

A color in the CIE 1931 XYZ color space, relative to the D65 white point.

XYZ describes any color the eye can see, independently of a display's primaries, and links the RGB gamuts: it is the root of the conversion tree. Y is the relative luminance, so the white of LinSRGB is (0.9505, 1, 1.0891). Channels are not clamped: XYZ itself has no bounds, and colors outside a gamut clip only when converted to it. Like LinSRGB, it is linear in light, so it has the arithmetic operators.

See also
CIE 015:2018

Definition at line 389 of file Color.cppm.

Constructor & Destructor Documentation

◆ XYZ() [1/2]

aest::colors::XYZ::XYZ ( )
inlineconstexpr

Default constructor initializes the color to opaque black (0, 0, 0, 1).

Definition at line 396 of file Color.cppm.

◆ XYZ() [2/2]

aest::colors::XYZ::XYZ ( const float x,
const float y,
const float z,
const float a = 1.0f )
inlineconstexpr

Construct a color from XYZ tristimulus values and alpha.

Parameters
[in]xX tristimulus value, stored as is
[in]yY tristimulus value, the relative luminance, stored as is
[in]zZ tristimulus value, stored as is
[in]aAlpha channel value (default 1.0)
Precondition
Every channel is finite: NaN and infinities are undefined behavior.

Definition at line 408 of file Color.cppm.

Member Function Documentation

◆ x()

float aest::colors::XYZ::x ( ) const
inlinenodiscardconstexprnoexcept

Get the X tristimulus value.

Returns
The X value

Definition at line 418 of file Color.cppm.

◆ y()

float aest::colors::XYZ::y ( ) const
inlinenodiscardconstexprnoexcept

Get the Y tristimulus value, the relative luminance.

Returns
The Y value

Definition at line 424 of file Color.cppm.

◆ z()

float aest::colors::XYZ::z ( ) const
inlinenodiscardconstexprnoexcept

Get the Z tristimulus value.

Returns
The Z value

Definition at line 430 of file Color.cppm.

Member Data Documentation

◆ TYPE

std::string_view aest::colors::XYZ::TYPE = "XYZ"
staticconstexpr

Color space name, used by the std::formatter specialization.

Definition at line 393 of file Color.cppm.


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