lecui 1.0.0-alpha.20
lecui C++ user interface library
Public Member Functions | List of all members
liblec::lecui::color Class Reference

RGBA color on a standard 0 to 255 scale. For the alpha channel 0 is transparent and 255 is opaque. More...

#include <lecui.h>

Public Member Functions

 color ()
 Color constructor. Makes opaque black (0, 0, 0, 255).
 
 color (const unsigned short red, const unsigned short green, const unsigned short blue, const unsigned short alpha)
 Color constructor. More...
 
unsigned short & red ()
 Get or set the red property. More...
 
unsigned short get_red () const
 Get the red property. More...
 
colorred (const unsigned short &red)
 Set the red property. More...
 
unsigned short & green ()
 Get or set the green property. More...
 
unsigned short get_green () const
 Get the green property. More...
 
colorgreen (const unsigned short &green)
 Set the green property. More...
 
unsigned short & blue ()
 Get or set the blue property. More...
 
unsigned short get_blue () const
 Get the blue property. More...
 
colorblue (const unsigned short &blue)
 Set the blue property. More...
 
unsigned short & alpha ()
 Get or set the alpha property. More...
 
unsigned short get_alpha () const
 Get the alpha property. More...
 
coloralpha (const unsigned short &alpha)
 Set the alpha property. More...
 
colordarken (const float &percentage)
 Darken the color. More...
 
colorlighten (const float &percentage)
 Lighten the color. More...
 
bool operator== (const color &param)
 Check whether two colors are equal. All properties are considered. More...
 
bool operator!= (const color &param)
 Check whether two colors are NOT equal. All properties are considered. More...
 

Detailed Description

RGBA color on a standard 0 to 255 scale. For the alpha channel 0 is transparent and 255 is opaque.

Constructor & Destructor Documentation

◆ color()

liblec::lecui::color::color ( const unsigned short  red,
const unsigned short  green,
const unsigned short  blue,
const unsigned short  alpha 
)

Color constructor.

Parameters
redThe red channel, on a scale of 0 to 255.
greenThe green channel, on a scale of 0 to 255.
blueThe blue channel, on a scale of 0 to 255.
alphaThe alpha channel, on a scale of 0 to 255.

Member Function Documentation

◆ alpha() [1/2]

unsigned short & liblec::lecui::color::alpha ( )

Get or set the alpha property.

Returns
A reference to the property, from 0 to 255 inclusive.

◆ alpha() [2/2]

color & liblec::lecui::color::alpha ( const unsigned short &  alpha)

Set the alpha property.

Parameters
alphaThe property, from 0 to 255 inclusive.
Returns
A reference to the modified object.

◆ blue() [1/2]

unsigned short & liblec::lecui::color::blue ( )

Get or set the blue property.

Returns
A reference to the property, from 0 to 255 inclusive.

◆ blue() [2/2]

color & liblec::lecui::color::blue ( const unsigned short &  blue)

Set the blue property.

Parameters
blueThe property, from 0 to 255 inclusive.
Returns
A reference to the modified object.

◆ darken()

color & liblec::lecui::color::darken ( const float &  percentage)

Darken the color.

Parameters
percentageThe percentage to darken by.
Returns
A reference to the modified object.

◆ get_alpha()

unsigned short liblec::lecui::color::get_alpha ( ) const

Get the alpha property.

Returns
The property, from 0 to 255 inclusive.

◆ get_blue()

unsigned short liblec::lecui::color::get_blue ( ) const

Get the blue property.

Returns
The property, from 0 to 255 inclusive.

◆ get_green()

unsigned short liblec::lecui::color::get_green ( ) const

Get the green property.

Returns
The property, from 0 to 255 inclusive.

◆ get_red()

unsigned short liblec::lecui::color::get_red ( ) const

Get the red property.

Returns
The property, from 0 to 255 inclusive.

◆ green() [1/2]

unsigned short & liblec::lecui::color::green ( )

Get or set the green property.

Returns
A reference to the property, from 0 to 255 inclusive.

◆ green() [2/2]

color & liblec::lecui::color::green ( const unsigned short &  green)

Set the green property.

Parameters
greenThe property, from 0 to 255 inclusive.
Returns
A reference to the modified object.

◆ lighten()

color & liblec::lecui::color::lighten ( const float &  percentage)

Lighten the color.

Parameters
percentageThe percentage to lighten by.
Returns
A reference to the modified object.

◆ operator!=()

bool liblec::lecui::color::operator!= ( const color param)

Check whether two colors are NOT equal. All properties are considered.

Parameters
paramThe color to compare to.
Returns
Returns true if the colors are NOT equal, else returns false.

◆ operator==()

bool liblec::lecui::color::operator== ( const color param)

Check whether two colors are equal. All properties are considered.

Parameters
paramThe color to compare to.
Returns
Returns true if the colors are equal, else returns false.

◆ red() [1/2]

unsigned short & liblec::lecui::color::red ( )

Get or set the red property.

Returns
A reference to the property, from 0 to 255 inclusive.

◆ red() [2/2]

color & liblec::lecui::color::red ( const unsigned short &  red)

Set the red property.

Parameters
redThe property, from 0 to 255 inclusive.
Returns
A reference to the modified object.

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