Core 1.0
Hsl Class Reference

Color in HSL space. More...

#include <color.h>

Public Member Functions

 Hsl (const double &, const double &, const double &)
 Create a color in HSL space.
 Hsl (const Color &)
 Create a color in HSL space.
void Brighten (const double &)
 Brighten the color by changing its luminance, the hue and the saturation are unchanged.
Color ToColor () const
 Convert a color in HSL space to RGB space.

Static Protected Member Functions

static double ToRgb (double, double, double)
 Conversion function.

Protected Attributes

double l = 0.0
 Hue, saturation, luminance.

Friends

class Color

Detailed Description

Color in HSL space.

Constructor & Destructor Documentation

◆ Hsl() [1/2]

Hsl::Hsl ( const double & h,
const double & s,
const double & l )
explicit

Create a color in HSL space.

Parameters
hHue.
sSaturation.
lLightness.

◆ Hsl() [2/2]

Hsl::Hsl ( const Color & c)
explicit

Create a color in HSL space.

Parameters
cColor in RGB space.

Member Function Documentation

◆ Brighten()

void Hsl::Brighten ( const double & b)

Brighten the color by changing its luminance, the hue and the saturation are unchanged.

Like Color::Brighten(), the luminance moves toward white (positive values) or toward black (negative values) by the given fraction of the remaining distance.

Parameters
bReal in [-1,1], use -1 or +1 to converge to black and white respectively.

◆ ToRgb()

double Hsl::ToRgb ( double a,
double b,
double h )
staticprotected

Conversion function.

Parameters
a,bValues.
hHue.