ge211  2021.5.1
A student game engine
Color::HSLA Struct Reference

Detailed Description

Representation for the hue-saturation-lightness-alpha color model.

See Wikipedia for details on color models.

Definition at line 155 of file ge211_color.hxx.

Public Member Functions

 HSLA (double hue, double saturation, double lightness, double alpha=1.0)
 Constructs a hue-saturation-lightness-alpha color from its unit interval components.
 
Color to_rgba () const
 Converts color to the RGBA color model.
 
Transformations
HSLA rotate_hue (double degrees) const
 Returns a color by rotating the hue, leaving the other properties.
 
HSLA saturate (double unit_amount) const
 Produces a fuller tone by saturating the color. More...
 
HSLA desaturate (double unit_amount) const
 Produces a weaker tone by desaturating the color. More...
 
HSLA lighten (double unit_amount) const
 Produces a tint by lightening the color. More...
 
HSLA darken (double unit_amount) const
 Produces a shade by darkening the color. More...
 
HSLA fade_in (double unit_amount) const
 Increases opacity of the color. More...
 
HSLA fade_out (double unit_amount) const
 Decreases opacity of the color. More...
 

Public Attributes

double hue
 The hue in degrees from 0 to 360. More...
 
double saturation
 The fullness of the color, from 0.0 (grey) to 1.0 (fully saturated).
 
double lightness
 The lightness of the color, from 0.0 (black) to 1.0 (white).
 
double alpha
 The opacity of the color, from 0.0 (fully transparent) to 1.0 (fully opaque).
 

Member Function Documentation

◆ darken()

Color::HSLA darken ( double  unit_amount) const

Produces a shade by darkening the color.

The unit_amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces black.

Definition at line 233 of file ge211_color.cxx.

◆ desaturate()

Color::HSLA desaturate ( double  unit_amount) const

Produces a weaker tone by desaturating the color.

The unit_amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces gray at the same lightness as the original color.

Definition at line 223 of file ge211_color.cxx.

◆ fade_in()

Color::HSLA fade_in ( double  unit_amount) const

Increases opacity of the color.

The unit_amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces a fully opaque color.

Definition at line 238 of file ge211_color.cxx.

◆ fade_out()

Color::HSLA fade_out ( double  unit_amount) const

Decreases opacity of the color.

The // unit_amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces full transparency.

Definition at line 243 of file ge211_color.cxx.

◆ lighten()

Color::HSLA lighten ( double  unit_amount) const

Produces a tint by lightening the color.

The amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces white.

Definition at line 228 of file ge211_color.cxx.

◆ saturate()

Color::HSLA saturate ( double  unit_amount) const

Produces a fuller tone by saturating the color.

The unit_amount must be between 0 and 1, where 0 leaves the color the same, and 1 produces a fully saturated color.

Definition at line 218 of file ge211_color.cxx.

Member Data Documentation

◆ hue

double hue

The hue in degrees from 0 to 360.

0° (and 360°) is red, 120° is green, and 240° is blue.

Definition at line 159 of file ge211_color.hxx.


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