NDEVR
API Documentation

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

Collaboration diagram for HSBColor:
[legend]

Public Member Functions

 HSBColor ()
 Default constructor.
 HSBColor (const ACIColor &)
 Constructs an HSBColor by converting from an ACIColor.
constexpr HSBColor (const Angle< HSBAngleType > &h, fltp04 s, fltp04 b, fltp04 a=1.0f)
 Constructs an HSBColor from single-precision floating-point values.
constexpr HSBColor (const Angle< HSBAngleType > &h, fltp08 s, fltp08 b, fltp08 a=1.0)
 Constructs an HSBColor from double-precision floating-point values.
constexpr HSBColor (const Angle< HSBAngleType > &h, uint01 s, uint01 b, uint01 a=255)
 Constructs an HSBColor from integer component values.
 HSBColor (const RGBColor &)
 Constructs an HSBColor by converting from an RGBColor.
 HSBColor (const Vector< 4, fltp04 > &color)
 Constructs an HSBColor from a 4-component floating-point vector.
 HSBColor (const XYZColor &)
 Constructs an HSBColor by converting from an XYZColor.
constexpr HSBColor (fltp04 h, fltp04 s, fltp04 b, fltp04 a=1.0f)
 Constructs an HSBColor from raw single-precision values with hue in degrees.
constexpr HSBColor (fltp08 h, fltp08 s, fltp08 b, fltp08 a=1.0f)
 Constructs an HSBColor from raw double-precision values with hue in degrees.
fltp04 getAF () const
 Gets the alpha as a normalized float (0.0-1.0).
fltp04 getBF () const
 Gets the brightness as a normalized float (0.0-1.0).
fltp04 getBS () const
 Gets the saturation as a normalized float (0.0-1.0).
template<class t_type>
t_type getHDeg () const
 Gets the hue component in degrees, cast to the requested type.
bool operator!= (const HSBColor &color) const
 Checks inequality between two HSBColor instances.
bool operator== (const HSBColor &color) const
 Checks equality between two HSBColor instances.
template<class t_type>
void setHDeg (const t_type &val)
 Sets the hue component from a value in degrees.

Static Public Member Functions

static HSBColor ConvertColor (const LABColor &current_color, const PrimitiveAlignedBuffer< std::pair< LABColor, LABColor >, 32 > &pairs, bool preserve_brightness, bool preserve_alpha)
 Converts a LABColor to an HSBColor using a set of LAB color mapping pairs.

Public Attributes

uint01 alpha
 The alpha (opacity) component, ranging from 0 (transparent) to 255 (opaque).
uint01 brightness
 The brightness component, ranging from 0 to 255.
Angle< HSBAngleTypehue
 The hue component as an angle, ranging from 0 to 360 degrees.
uint01 saturation
 The saturation component, ranging from 0 to 255.

Detailed Description

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


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

Hue: the color type (such as red, blue, or yellow). Ranges from 0 to 360 (each value corresponds to one color: 0 is red, 45 is a shade of orange and 55 is a shade of yellow).

Saturation: the saturation of the color.

Brightness: the brightness of the color. Ranges from 0 to 100% (0 is always black; depending on the saturation, 100 may be white or a more or less saturated color).

See also
RGBColor, HSLColor, LABColor, XYZColor

Definition at line 61 of file HSBColor.h.

Constructor & Destructor Documentation

◆ HSBColor() [1/10]

HSBColor::HSBColor ( )
inline

Default constructor.

Leaves all components uninitialized.

Definition at line 72 of file HSBColor.h.

Referenced by ConvertColor(), operator!=(), and operator==().

◆ HSBColor() [2/10]

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

Constructs an HSBColor from integer component values.

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

Definition at line 81 of file HSBColor.h.

References alpha, brightness, hue, and saturation.

◆ HSBColor() [3/10]

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

Constructs an HSBColor from double-precision floating-point values.

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

Definition at line 95 of file HSBColor.h.

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

◆ HSBColor() [4/10]

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

Constructs an HSBColor from single-precision floating-point values.

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

Definition at line 109 of file HSBColor.h.

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

◆ HSBColor() [5/10]

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

Constructs an HSBColor from raw double-precision values with hue in degrees.

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

Definition at line 123 of file HSBColor.h.

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

◆ HSBColor() [6/10]

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

Constructs an HSBColor from raw single-precision values with hue in degrees.

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

Definition at line 137 of file HSBColor.h.

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

◆ HSBColor() [7/10]

HSBColor::HSBColor ( const Vector< 4, fltp04 > & color)
explicit

Constructs an HSBColor from a 4-component floating-point vector.

Parameters
[in]colorA vector containing hue, saturation, brightness, and alpha components.

◆ HSBColor() [8/10]

HSBColor::HSBColor ( const ACIColor & )
explicit

Constructs an HSBColor by converting from an ACIColor.

Parameters
[in]colorThe ACIColor to convert from.

◆ HSBColor() [9/10]

HSBColor::HSBColor ( const RGBColor & )
explicit

Constructs an HSBColor by converting from an RGBColor.

Parameters
[in]colorThe RGBColor to convert from.

◆ HSBColor() [10/10]

HSBColor::HSBColor ( const XYZColor & )
explicit

Constructs an HSBColor by converting from an XYZColor.

Parameters
[in]colorThe XYZColor to convert from.

Member Function Documentation

◆ ConvertColor()

HSBColor HSBColor::ConvertColor ( const LABColor & current_color,
const PrimitiveAlignedBuffer< std::pair< LABColor, LABColor >, 32 > & pairs,
bool preserve_brightness,
bool preserve_alpha )
static

Converts a LABColor to an HSBColor using a set of LAB color mapping pairs.

Parameters
[in]current_colorThe LABColor to convert.
[in]pairsA buffer of LABColor pairs defining the source-to-target color mapping.
[in]preserve_brightnessWhether to preserve the original brightness during conversion.
[in]preserve_alphaWhether to preserve the original alpha during conversion.
Returns
The resulting HSBColor after conversion.

References HSBColor().

◆ getAF()

fltp04 HSBColor::getAF ( ) const
inline

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

Returns
The alpha component scaled to the range 0.0 to 1.0.

Definition at line 201 of file HSBColor.h.

References alpha, and cast().

◆ getBF()

fltp04 HSBColor::getBF ( ) const
inline

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

Returns
The brightness component scaled to the range 0.0 to 1.0.

Definition at line 185 of file HSBColor.h.

References brightness, and cast().

◆ getBS()

fltp04 HSBColor::getBS ( ) const
inline

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

Returns
The saturation component scaled to the range 0.0 to 1.0.

Definition at line 193 of file HSBColor.h.

References cast(), and saturation.

◆ getHDeg()

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

Gets the hue component in degrees, cast to the requested type.

Returns
The hue angle in degrees.

Definition at line 168 of file HSBColor.h.

References cast(), DEGREES, and hue.

◆ operator!=()

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

Checks inequality between two HSBColor instances.

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

Definition at line 222 of file HSBColor.h.

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

◆ operator==()

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

Checks equality between two HSBColor instances.

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

Definition at line 210 of file HSBColor.h.

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

◆ setHDeg()

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

Sets the hue component from a value in degrees.

Parameters
[in]valThe hue angle in degrees.

Definition at line 177 of file HSBColor.h.

References cast(), DEGREES, and hue.


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