aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
aest::colors::BasicRGB< Gamut, Transfer > Class Template Referencefinalexport

A color in an RGB color space: the primaries and white point of Gamut, with channels encoded by Transfer. More...

Inheritance diagram for aest::colors::BasicRGB< Gamut, Transfer >:
aest::colors::ColorBase< BasicRGB< Gamut, Transfer > >

Public Member Functions

constexpr BasicRGB ()
 Default constructor initializes the color to opaque black (0, 0, 0, 1).
constexpr BasicRGB (const float r, const float g, const float b, const float a=1.0f)
 Construct a color from floating-point RGBA values.
Color Channels
constexpr float red () const noexcept
 Get the red channel value.
constexpr float green () const noexcept
 Get the green channel value.
constexpr float blue () const noexcept
 Get the blue channel value.
Public Member Functions inherited from aest::colors::ColorBase< BasicRGB< Gamut, Transfer > >
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 BasicRGB< Gamut, Transfer > opacity (const float alpha) const
 Returns a new color with the same channels and the specified alpha value.

Static Public Attributes

static constexpr std::string_view TYPE = RGBName<Gamut, Transfer>::VALUE
 Color space name, used by the std::formatter specialization.

Additional Inherited Members

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

Detailed Description

template<RGBGamut Gamut, TransferFunction Transfer>
class aest::colors::BasicRGB< Gamut, Transfer >

A color in an RGB color space: the primaries and white point of Gamut, with channels encoded by Transfer.

With tf::Linear the channels are proportional to light: they are clamped at 0 only, so they hold HDR values, and the space has the ColorArithmetic operators, since blending and lighting are physically correct only there. With an encoding such as tf::SRGB the channels are clamped to the 0-1 range and have no arithmetic. Convert between spaces with convert(): a color outside the target gamut clips at 0.

Use it through the aliases, such as SRGB, LinSRGB or DisplayP3.

Template Parameters
GamutThe gamut tag, such as gamut::SRGB
TransferThe transfer function tag, such as tf::SRGB or tf::Linear

Definition at line 292 of file Gamut.cppm.

Constructor & Destructor Documentation

◆ BasicRGB() [1/2]

template<RGBGamut Gamut, TransferFunction Transfer>
aest::colors::BasicRGB< Gamut, Transfer >::BasicRGB ( )
inlineconstexpr

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

Definition at line 302 of file Gamut.cppm.

◆ BasicRGB() [2/2]

template<RGBGamut Gamut, TransferFunction Transfer>
aest::colors::BasicRGB< Gamut, Transfer >::BasicRGB ( const float r,
const float g,
const float b,
const float a = 1.0f )
inlineconstexpr

Construct a color from floating-point RGBA values.

Parameters
[in]rRed channel value
[in]gGreen channel value
[in]bBlue channel value
[in]aAlpha channel value (default 1.0)
Precondition
Every channel is finite: NaN and infinities are undefined behavior.

Definition at line 314 of file Gamut.cppm.

Member Function Documentation

◆ blue()

template<RGBGamut Gamut, TransferFunction Transfer>
float aest::colors::BasicRGB< Gamut, Transfer >::blue ( ) const
inlinenodiscardconstexprnoexcept

Get the blue channel value.

Returns
The blue channel value, in the range of Transfer

Definition at line 336 of file Gamut.cppm.

◆ green()

template<RGBGamut Gamut, TransferFunction Transfer>
float aest::colors::BasicRGB< Gamut, Transfer >::green ( ) const
inlinenodiscardconstexprnoexcept

Get the green channel value.

Returns
The green channel value, in the range of Transfer

Definition at line 330 of file Gamut.cppm.

◆ red()

template<RGBGamut Gamut, TransferFunction Transfer>
float aest::colors::BasicRGB< Gamut, Transfer >::red ( ) const
inlinenodiscardconstexprnoexcept

Get the red channel value.

Returns
The red channel value, in the range of Transfer

Definition at line 324 of file Gamut.cppm.

Member Data Documentation

◆ TYPE

template<RGBGamut Gamut, TransferFunction Transfer>
std::string_view aest::colors::BasicRGB< Gamut, Transfer >::TYPE = RGBName<Gamut, Transfer>::VALUE
staticconstexpr

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

Definition at line 299 of file Gamut.cppm.


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