aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
aest::colors::BasicHSV< RGB > Class Template Referencefinalexport

A color as hue, saturation and value (brightness), over the encoded RGB space RGB. More...

Inheritance diagram for aest::colors::BasicHSV< RGB >:
aest::colors::ColorBase< BasicHSV< RGB > >

Public Member Functions

constexpr BasicHSV ()
 Default constructor initializes the color to opaque black (0, 0, 0, 1).
constexpr BasicHSV (const float h, const float s, const float v, const float a=1.0f)
 Construct a color from floating-point HSVA values.
Color Channels
constexpr float hue () const noexcept
 Get the hue value in the 0-360 range.
constexpr float saturation () const noexcept
 Get the saturation value in the 0-1 range.
constexpr float brightness () const noexcept
 Get the brightness value in the 0-1 range.
Public Member Functions inherited from aest::colors::ColorBase< BasicHSV< RGB > >
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 BasicHSV< RGB > 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
 Color space name, used by the std::formatter specialization.

Static Private Attributes

static constexpr std::string_view MODEL = "HSV"
 Name of the model, the whole space name over SRGB.
static constexpr auto QUALIFIED_CHARS
 The space name over another RGB space, HSV< + RGB::TYPE + >.

Additional Inherited Members

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

Detailed Description

template<BoundedRGBSpace RGB>
class aest::colors::BasicHSV< RGB >

A color as hue, saturation and value (brightness), over the encoded RGB space RGB.

HSV rearranges the channels of RGB, so it covers the same gamut. The hue is wrapped to the [0, 360) range; saturation and value are clamped to the 0-1 range. Convert to any other space with convert().

Template Parameters
RGBThe encoded RGB space, such as SRGB: its channels must be in the 0-1 range, so linear spaces are rejected.
See also
Smith 1978

Definition at line 99 of file Cylindrical.cppm.

Constructor & Destructor Documentation

◆ BasicHSV() [1/2]

template<BoundedRGBSpace RGB>
aest::colors::BasicHSV< RGB >::BasicHSV ( )
inlineconstexpr

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

Definition at line 115 of file Cylindrical.cppm.

◆ BasicHSV() [2/2]

template<BoundedRGBSpace RGB>
aest::colors::BasicHSV< RGB >::BasicHSV ( const float h,
const float s,
const float v,
const float a = 1.0f )
inlineconstexpr

Construct a color from floating-point HSVA values.

Parameters
[in]hHue in degrees, wrapped to the 0-360 range
[in]sSaturation value
[in]vBrightness value
[in]aAlpha channel value (default 1.0)
Precondition
Every channel is finite: NaN and infinities are undefined behavior.

Definition at line 127 of file Cylindrical.cppm.

Member Function Documentation

◆ brightness()

template<BoundedRGBSpace RGB>
float aest::colors::BasicHSV< RGB >::brightness ( ) const
inlinenodiscardconstexprnoexcept

Get the brightness value in the 0-1 range.

Returns
The color brightness

Definition at line 149 of file Cylindrical.cppm.

◆ hue()

template<BoundedRGBSpace RGB>
float aest::colors::BasicHSV< RGB >::hue ( ) const
inlinenodiscardconstexprnoexcept

Get the hue value in the 0-360 range.

Returns
The color hue

Definition at line 137 of file Cylindrical.cppm.

◆ saturation()

template<BoundedRGBSpace RGB>
float aest::colors::BasicHSV< RGB >::saturation ( ) const
inlinenodiscardconstexprnoexcept

Get the saturation value in the 0-1 range.

Returns
The color saturation

Definition at line 143 of file Cylindrical.cppm.

Member Data Documentation

◆ MODEL

template<BoundedRGBSpace RGB>
std::string_view aest::colors::BasicHSV< RGB >::MODEL = "HSV"
staticconstexprprivate

Name of the model, the whole space name over SRGB.

Definition at line 102 of file Cylindrical.cppm.

◆ QUALIFIED_CHARS

template<BoundedRGBSpace RGB>
auto aest::colors::BasicHSV< RGB >::QUALIFIED_CHARS
staticconstexprprivate
Initial value:
=
join_names<MODEL.size() + RGB::TYPE.size() + 2>({MODEL, "<", RGB::TYPE, ">"})
constexpr std::array< char, Size > join_names(const std::initializer_list< std::string_view > parts)
Concatenate names into a character array, for a color space name built at compile time.
Definition Color.cppm:100
static constexpr std::string_view MODEL
Name of the model, the whole space name over SRGB.

The space name over another RGB space, HSV< + RGB::TYPE + >.

Definition at line 105 of file Cylindrical.cppm.

◆ TYPE

template<BoundedRGBSpace RGB>
std::string_view aest::colors::BasicHSV< RGB >::TYPE
staticconstexpr
Initial value:
=
std::same_as<RGB, SRGB> ? MODEL
: std::string_view{QUALIFIED_CHARS.data(), QUALIFIED_CHARS.size()}
static constexpr auto QUALIFIED_CHARS
The space name over another RGB space, HSL< + RGB::TYPE + >.

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

Definition at line 110 of file Cylindrical.cppm.


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