NDEVR
API Documentation

A color defined by hue, saturation, and luminosity components. More...

Inheritance diagram for HSLColor:
[legend]
Collaboration diagram for HSLColor:
[legend]

Public Member Functions

constexpr HSLColor ()
 Constructs a default HSLColor with all components set to invalid.
 HSLColor (const ACIColor &)
 Constructs an HSLColor by converting from an ACIColor.
constexpr HSLColor (const Angle< HSLAngleType > &h, fltp04 s, fltp04 b, fltp04 a=1.0f)
 Constructs an HSLColor from an angle and single-precision floating-point components.
constexpr HSLColor (const Angle< HSLAngleType > &h, fltp08 s, fltp08 b, fltp08 a=1.0)
 Constructs an HSLColor from an angle and double-precision floating-point components.
constexpr HSLColor (const Angle< HSLAngleType > &h, uint01 s, uint01 b, uint01 a=255)
 Constructs an HSLColor from an angle and integer components.
constexpr HSLColor (const HSLColor &color)=default
 Copy constructor.
 HSLColor (const RGBColor &)
 Constructs an HSLColor by converting from an RGBColor.
constexpr HSLColor (const Vector< 4, fltp04 > &color)
 Constructs an HSLColor from a 4-component float vector (hue degrees, saturation, brightness, alpha).
 HSLColor (const XYZColor &)
 Constructs an HSLColor by converting from an XYZColor.
constexpr HSLColor (fltp04 h, fltp04 s, fltp04 b, fltp04 a=1.0f)
 Constructs an HSLColor from single-precision hue in degrees and normalized components.
constexpr HSLColor (fltp08 h, fltp08 s, fltp08 b, fltp08 a=1.0f)
 Constructs an HSLColor from double-precision hue in degrees and normalized components.
constexpr HSLColor (uint01 h, uint01 s, uint01 b, uint01 a=255)
 Constructs an HSLColor from integer components, converting hue from a 0-255 range to degrees.
fltp04 getAF () const
 Gets the alpha component as a normalized float (0.0-1.0).
fltp04 getBF () const
 Gets the brightness component as a normalized float (0.0-1.0).
template<class t_type>
t_type getHDeg () const
 Gets the hue component in degrees, converted to the specified type.
uint01 getHI () const
 Gets the hue component as a uint01 index in the range 0-255.
fltp04 getSF () const
 Gets the saturation component as a normalized float (0.0-1.0).
bool operator!= (const HSLColor &color) const
 Checks inequality between two HSLColor values.
bool operator== (const HSLColor &color) const
 Checks equality between two HSLColor values.
template<class t_type>
void setHDeg (const t_type &val)
 Sets the hue component from a value in degrees.
void setHI (uint01 val)
 Sets the hue component from a uint01 index in the range 0-255.

Public Attributes

uint01 alpha
 The alpha (opacity) component, stored as 0-255.
uint01 brightness
 The brightness (luminosity) component, stored as 0-255.
Angle< HSLAngleTypehue
 The hue component, representing the color angle on the color wheel.
uint01 saturation
 The saturation component, stored as 0-255.

Detailed Description

A color defined by hue, saturation, and luminosity components.


The HSL (Hue, Saturation, Luminosity) color model defines a color space in terms of three constituent components hue, brightness and luminosity

See also
RGBColor, HSBColor, LABColor, XYZColor

Definition at line 50 of file HSLColor.h.

Constructor & Destructor Documentation

◆ HSLColor() [1/11]

HSLColor::HSLColor ( const HSLColor & color)
constexprdefault

Copy constructor.

Parameters
[in]colorThe HSLColor to copy.

References HSLColor().

◆ HSLColor() [2/11]

HSLColor::HSLColor ( const Angle< HSLAngleType > & h,
uint01 s,
uint01 b,
uint01 a = 255 )
inlineconstexpr

Constructs an HSLColor from an angle and integer components.

Parameters
[in]hThe hue as an Angle.
[in]sThe saturation as a uint01 (0-255).
[in]bThe brightness as a uint01 (0-255).
[in]aThe alpha as a uint01 (0-255), defaults to 255 (fully opaque).

Definition at line 79 of file HSLColor.h.

References alpha, brightness, hue, and saturation.

◆ HSLColor() [3/11]

HSLColor::HSLColor ( uint01 h,
uint01 s,
uint01 b,
uint01 a = 255 )
inlineconstexpr

Constructs an HSLColor from integer components, converting hue from a 0-255 range to degrees.

Parameters
[in]hThe hue as a uint01 (0-255), mapped to 0-360 degrees.
[in]sThe saturation as a uint01 (0-255).
[in]bThe brightness as a uint01 (0-255).
[in]aThe alpha as a uint01 (0-255), defaults to 255 (fully opaque).

Definition at line 92 of file HSLColor.h.

References alpha, brightness, cast(), DEGREES, hue, and saturation.

◆ HSLColor() [4/11]

HSLColor::HSLColor ( const Angle< HSLAngleType > & h,
fltp08 s,
fltp08 b,
fltp08 a = 1.0 )
inlineconstexpr

Constructs an HSLColor from an angle and double-precision floating-point components.

Parameters
[in]hThe hue as an Angle.
[in]sThe saturation as a normalized double (0.0-1.0).
[in]bThe brightness as a normalized double (0.0-1.0).
[in]aThe alpha as a normalized double (0.0-1.0), defaults to 1.0 (fully opaque).

Definition at line 106 of file HSLColor.h.

References alpha, brightness, cast(), hue, and saturation.

◆ HSLColor() [5/11]

HSLColor::HSLColor ( const Angle< HSLAngleType > & h,
fltp04 s,
fltp04 b,
fltp04 a = 1.0f )
inlineconstexpr

Constructs an HSLColor from an angle and single-precision floating-point components.

Parameters
[in]hThe hue as an Angle.
[in]sThe saturation as a normalized float (0.0-1.0).
[in]bThe brightness as a normalized float (0.0-1.0).
[in]aThe alpha as a normalized float (0.0-1.0), defaults to 1.0 (fully opaque).

Definition at line 120 of file HSLColor.h.

References alpha, brightness, cast(), hue, and saturation.

◆ HSLColor() [6/11]

HSLColor::HSLColor ( fltp08 h,
fltp08 s,
fltp08 b,
fltp08 a = 1.0f )
inlineconstexpr

Constructs an HSLColor from double-precision hue in degrees and normalized components.

Parameters
[in]hThe hue in degrees as a double.
[in]sThe saturation as a normalized double (0.0-1.0).
[in]bThe brightness as a normalized double (0.0-1.0).
[in]aThe alpha as a normalized double (0.0-1.0), defaults to 1.0 (fully opaque).

Definition at line 134 of file HSLColor.h.

References alpha, brightness, cast(), DEGREES, hue, and saturation.

◆ HSLColor() [7/11]

HSLColor::HSLColor ( fltp04 h,
fltp04 s,
fltp04 b,
fltp04 a = 1.0f )
inlineconstexpr

Constructs an HSLColor from single-precision hue in degrees and normalized components.

Parameters
[in]hThe hue in degrees as a float.
[in]sThe saturation as a normalized float (0.0-1.0).
[in]bThe brightness as a normalized float (0.0-1.0).
[in]aThe alpha as a normalized float (0.0-1.0), defaults to 1.0 (fully opaque).

Definition at line 148 of file HSLColor.h.

References alpha, brightness, cast(), DEGREES, hue, and saturation.

◆ HSLColor() [8/11]

HSLColor::HSLColor ( const Vector< 4, fltp04 > & color)
inlineconstexpr

Constructs an HSLColor from a 4-component float vector (hue degrees, saturation, brightness, alpha).

Parameters
[in]colorA vector where X=hue in degrees, Y=saturation (0-1), Z=brightness (0-1), W=alpha (0-1).

Definition at line 158 of file HSLColor.h.

References alpha, brightness, cast(), DEGREES, hue, and saturation.

◆ HSLColor() [9/11]

HSLColor::HSLColor ( const ACIColor & )
explicit

Constructs an HSLColor by converting from an ACIColor.

Parameters
[in]ACIColorThe ACI color to convert from.

◆ HSLColor() [10/11]

HSLColor::HSLColor ( const RGBColor & )
explicit

Constructs an HSLColor by converting from an RGBColor.

Parameters
[in]RGBColorThe RGB color to convert from.

◆ HSLColor() [11/11]

HSLColor::HSLColor ( const XYZColor & )
explicit

Constructs an HSLColor by converting from an XYZColor.

Parameters
[in]XYZColorThe XYZ color to convert from.

Member Function Documentation

◆ getAF()

fltp04 HSLColor::getAF ( ) const
inline

Gets the alpha component as a normalized float (0.0-1.0).

Returns
The alpha as a float in the range 0.0 to 1.0.

Definition at line 235 of file HSLColor.h.

References alpha, and cast().

◆ getBF()

fltp04 HSLColor::getBF ( ) const
inline

Gets the brightness component as a normalized float (0.0-1.0).

Returns
The brightness as a float in the range 0.0 to 1.0.

Definition at line 219 of file HSLColor.h.

References brightness, and cast().

◆ getHDeg()

template<class t_type>
t_type HSLColor::getHDeg ( ) const
inline

Gets the hue component in degrees, converted to the specified type.

Returns
The hue in degrees, cast to t_type.

Definition at line 184 of file HSLColor.h.

References cast(), DEGREES, and hue.

◆ getHI()

uint01 HSLColor::getHI ( ) const
inline

Gets the hue component as a uint01 index in the range 0-255.

Returns
The hue mapped to a 0-255 integer range.

Definition at line 201 of file HSLColor.h.

References cast(), hue, and Angle< t_type >::INDEX_PI.

◆ getSF()

fltp04 HSLColor::getSF ( ) const
inline

Gets the saturation component as a normalized float (0.0-1.0).

Returns
The saturation as a float in the range 0.0 to 1.0.

Definition at line 227 of file HSLColor.h.

References cast(), and saturation.

◆ operator!=()

bool HSLColor::operator!= ( const HSLColor & color) const
inline

Checks inequality between two HSLColor values.

Parameters
[in]colorThe HSLColor to compare against.
Returns
True if any component (hue, saturation, brightness, alpha) differs.

Definition at line 256 of file HSLColor.h.

References HSLColor(), alpha, brightness, hue, and saturation.

◆ operator==()

bool HSLColor::operator== ( const HSLColor & color) const
inline

Checks equality between two HSLColor values.

Parameters
[in]colorThe HSLColor to compare against.
Returns
True if all components (hue, saturation, brightness, alpha) are equal.

Definition at line 244 of file HSLColor.h.

References HSLColor(), alpha, brightness, hue, and saturation.

◆ setHDeg()

template<class t_type>
void HSLColor::setHDeg ( const t_type & val)
inline

Sets the hue component from a value in degrees.

Parameters
[in]valThe hue value in degrees to set.

Definition at line 193 of file HSLColor.h.

References cast(), DEGREES, and hue.

◆ setHI()

void HSLColor::setHI ( uint01 val)
inline

Sets the hue component from a uint01 index in the range 0-255.

Parameters
[in]valThe hue as a 0-255 integer, mapped to the full angular range.

Definition at line 210 of file HSLColor.h.

References hue, and Angle< t_type >::INDEX_PI.


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