xtd 0.2.0
xtd::drawing::helpers::rgb Struct Reference

Definition

The rgb struct.

struct rgb;
The rgb struct.
Definition rgb.hpp:23
Namespace
xtd::drawing::helpers
Library
xtd.drawing

Public Properties

xtd::byte r
 Gets or sets the red component value of this xtd::drawing::helpers::rgb struct.
 
xtd::byte g
 Gets or sets the green component value of this xtd::drawing::helpers::rbg struct.
 
xtd::byte b
 Gets or sets the blue component value of this xtd::drawing::helpers::rbg struct.
 

Public Methods

float get_hue () const noexcept
 Gets the hue-saturation-lightness (HSL) hue value, in degrees, for this xtd::drawing::helpers::rgb structure.
 
float get_lightness () const noexcept
 Gets the hue-saturation-lightness (HSL) lightness value for this xtd::drawing::helpers::rgb structure.
 
float get_saturation () const noexcept
 Gets the hue-saturation-lightness (HSL) saturation value for this xtd::drawing::helpers::rgb structure.
 
std::tuple< float, float, float > to_hsl () const noexcept
 

Public Static Methods

static rgb alpha_blend (const rgb &fore_componant, const rgb &back_componant, double alpha) noexcept
 Returns the weighted average color between the two given colors.
 
static xtd::byte alpha_blend (xtd::byte fore_componant, xtd::byte back_componant, double alpha) noexcept
 Returns the weighted average color component between the two given color components.
 
static rgb from_hsl (float hue, float saturation, float lightness) noexcept
 Creates a xtd::drawing::helpers::rgb strucg from the three HSL component (hue, saturation, and lightness) values.
 

Member Function Documentation

◆ get_hue()

float xtd::drawing::helpers::rgb::get_hue ( ) const
inlinenoexcept

Gets the hue-saturation-lightness (HSL) hue value, in degrees, for this xtd::drawing::helpers::rgb structure.

Returns
The hue, in degrees, of this xtd::drawing::helpers::rgb. The hue is measured in degrees, ranging from 0.0 through 360.0, in HSL color space.

◆ get_lightness()

float xtd::drawing::helpers::rgb::get_lightness ( ) const
inlinenoexcept

Gets the hue-saturation-lightness (HSL) lightness value for this xtd::drawing::helpers::rgb structure.

Returns
The lightness of this xtd::drawing::helpers::rgb. The lightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.

◆ get_saturation()

float xtd::drawing::helpers::rgb::get_saturation ( ) const
inlinenoexcept

Gets the hue-saturation-lightness (HSL) saturation value for this xtd::drawing::helpers::rgb structure.

Returns
The saturation of this xtd::drawing::helpers::rgb. The saturation ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated.

◆ alpha_blend() [1/2]

static rgb xtd::drawing::helpers::rgb::alpha_blend ( const rgb fore_componant,
const rgb back_componant,
double  alpha 
)
inlinestaticnoexcept

Returns the weighted average color between the two given colors.

Parameters
fore_coreThe foreground color.
back_colorThe background color.
alphaThe alpha factor
Returns
The combined color.
Remarks
The alpha of fore_core is conserved.
The red, green and blue values are averages using the following formula:
color = fore_core * (1 - weight) + back_color * weight;
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:49
Thus, a weight value of 1.0 will return the background color, while a value of 0.0 will return the foreground color.

◆ alpha_blend() [2/2]

static xtd::byte xtd::drawing::helpers::rgb::alpha_blend ( xtd::byte  fore_componant,
xtd::byte  back_componant,
double  alpha 
)
inlinestaticnoexcept

Returns the weighted average color component between the two given color components.

Parameters
fore_coreThe foreground color component.
back_colorThe background color component.
alphaThe alpha factor
Returns
The combined color component.
Remarks
The alpha of fore_core is conserved.
The red, green and blue values are averages using the following formula:
color = fore_componant * (1 - weight) + back_componant * weight;
Thus, a weight value of 1.0 will return the background color, while a value of 0.0 will return the foreground color.

◆ from_hsl()

static rgb xtd::drawing::helpers::rgb::from_hsl ( float  hue,
float  saturation,
float  lightness 
)
inlinestaticnoexcept

Creates a xtd::drawing::helpers::rgb strucg from the three HSL component (hue, saturation, and lightness) values.

Parameters
hueThe xtd::drawing::helpers::rgb saturation. The saturation ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated.
saturationThe xtd::drawing::helpers::rgb saturation. The saturation ranges from 0.0 through 1.0, where 0.0 is grayscale and 1.0 is the most saturated.
lightnessThe xtd::drawing::helpers::rgb lightness. The lightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.
Returns
The xtd::drawing::helpers::rgb structure that this method creates.

Member Data Documentation

◆ r

xtd::byte xtd::drawing::helpers::rgb::r

Gets or sets the red component value of this xtd::drawing::helpers::rgb struct.

Parameters
rbyte The red component value of this xtd::drawing::helpers::rgb.

◆ g

xtd::byte xtd::drawing::helpers::rgb::g

Gets or sets the green component value of this xtd::drawing::helpers::rbg struct.

Parameters
rbyte The green component value of this xtd::drawing::helpers::rgb.

◆ b

xtd::byte xtd::drawing::helpers::rgb::b

Gets or sets the blue component value of this xtd::drawing::helpers::rbg struct.

Parameters
rbyte The blue component value of this xtd::drawing::helpers::rgb.

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