SPH
Public Member Functions | Static Public Member Functions | List of all members
Rgba Class Reference

#include <Color.h>

Public Member Functions

 Rgba ()=default
 
 Rgba (const float r, const float g, const float b, const float a=1.f)
 
 Rgba (const float gray, const float a=1.f)
 
 Rgba (const Rgba &other)
 
 Rgba (const wxColour &other)
 
Rgbaoperator= (const Rgba &other)
 
 operator wxColour () const
 
float & r ()
 
float r () const
 
float & g ()
 
float g () const
 
float & b ()
 
float b () const
 
float & a ()
 
float a () const
 
Rgba operator* (const float value) const
 Multiplies the intensity of the color by given factor. More...
 
Rgba operator/ (const float value) const
 Divides the intensity of the color by given factor. More...
 
Rgba operator* (const Rgba &other) const
 Multiplies the color by other color, component-wise. More...
 
Rgba operator+ (const Rgba &other) const
 Returns the sum of two colors, component-wise. More...
 
Rgbaoperator+= (const Rgba &other)
 
bool operator== (const Rgba &other) const
 
bool operator!= (const Rgba &other) const
 
float intensity () const
 Returns the average intensity of the color. More...
 
Rgba over (const Rgba &other) const
 Blends two colors together using "over" operation. More...
 
Rgba darken (const float amount) const
 Returns a color darker by given factor. More...
 
Rgba brighten (const float amount) const
 Returns a color brighter by given factor. More...
 
Rgba inverse () const
 Returns an inverse color. More...
 
Rgba blend (const Rgba &other, const float amount) const
 Computes a linear interpolation of two color. More...
 
Rgba saturate (const float value) const
 Retuns a color with modified saturation. More...
 

Static Public Member Functions

static Rgba red ()
 
static Rgba green ()
 
static Rgba blue ()
 
static Rgba black ()
 
static Rgba white ()
 
static Rgba gray (const float value=0.5f)
 
static Rgba transparent ()
 

Detailed Description

Definition at line 8 of file Color.h.

Constructor & Destructor Documentation

◆ Rgba() [1/5]

Rgba::Rgba ( )
default

◆ Rgba() [2/5]

Rgba::Rgba ( const float  r,
const float  g,
const float  b,
const float  a = 1.f 
)
inline

Definition at line 18 of file Color.h.

◆ Rgba() [3/5]

Rgba::Rgba ( const float  gray,
const float  a = 1.f 
)
inlineexplicit

Definition at line 21 of file Color.h.

◆ Rgba() [4/5]

Rgba::Rgba ( const Rgba other)
inline

Definition at line 24 of file Color.h.

◆ Rgba() [5/5]

Rgba::Rgba ( const wxColour &  other)
inlineexplicit

Definition at line 27 of file Color.h.

Member Function Documentation

◆ a() [1/2]

float& Rgba::a ( )
inline

Definition at line 63 of file Color.h.

◆ a() [2/2]

float Rgba::a ( ) const
inline

Definition at line 67 of file Color.h.

◆ b() [1/2]

float& Rgba::b ( )
inline

Definition at line 55 of file Color.h.

◆ b() [2/2]

float Rgba::b ( ) const
inline

Definition at line 59 of file Color.h.

◆ black()

static Rgba Rgba::black ( )
inlinestatic

Definition at line 190 of file Color.h.

◆ blend()

Rgba Rgba::blend ( const Rgba other,
const float  amount 
) const
inline

Computes a linear interpolation of two color.

For amount 0, function returns this color, for amount 1 it returns the other color.

Definition at line 158 of file Color.h.

◆ blue()

static Rgba Rgba::blue ( )
inlinestatic

Definition at line 186 of file Color.h.

◆ brighten()

Rgba Rgba::brighten ( const float  amount) const
inline

Returns a color brighter by given factor.

Parameters
amountValue in interval [0, INFTY], where 0 = current color, 1 = 100% more brighter, etc.

Definition at line 145 of file Color.h.

◆ darken()

Rgba Rgba::darken ( const float  amount) const
inline

Returns a color darker by given factor.

Parameters
amountValue in interval [0, 1], where 0 = current color, 1 = black.

Definition at line 137 of file Color.h.

◆ g() [1/2]

float& Rgba::g ( )
inline

Definition at line 47 of file Color.h.

◆ g() [2/2]

float Rgba::g ( ) const
inline

Definition at line 51 of file Color.h.

◆ gray()

static Rgba Rgba::gray ( const float  value = 0.5f)
inlinestatic

Definition at line 198 of file Color.h.

◆ green()

static Rgba Rgba::green ( )
inlinestatic

Definition at line 182 of file Color.h.

◆ intensity()

float Rgba::intensity ( ) const
inline

Returns the average intensity of the color.

Definition at line 115 of file Color.h.

◆ inverse()

Rgba Rgba::inverse ( ) const
inline

Returns an inverse color.

Definition at line 151 of file Color.h.

◆ operator wxColour()

Rgba::operator wxColour ( ) const
inlineexplicit

Definition at line 35 of file Color.h.

◆ operator!=()

bool Rgba::operator!= ( const Rgba other) const
inline

Definition at line 110 of file Color.h.

◆ operator*() [1/2]

Rgba Rgba::operator* ( const float  value) const
inline

Multiplies the intensity of the color by given factor.

The alpha value is not affected by this operation.

Definition at line 74 of file Color.h.

◆ operator*() [2/2]

Rgba Rgba::operator* ( const Rgba other) const
inline

Multiplies the color by other color, component-wise.

Warning
The resulting color has the alpha value of the left-hand side color, i.e. this operation is not commutative!

Definition at line 89 of file Color.h.

◆ operator+()

Rgba Rgba::operator+ ( const Rgba other) const
inline

Returns the sum of two colors, component-wise.

Warning
The resulting color has the alpha value of the left-hand side color, i.e. this operation is not commutative!

Definition at line 97 of file Color.h.

◆ operator+=()

Rgba& Rgba::operator+= ( const Rgba other)
inline

Definition at line 101 of file Color.h.

◆ operator/()

Rgba Rgba::operator/ ( const float  value) const
inline

Divides the intensity of the color by given factor.

The alpha value is not affected by this operation.

Definition at line 81 of file Color.h.

◆ operator=()

Rgba& Rgba::operator= ( const Rgba other)
inline

Definition at line 30 of file Color.h.

◆ operator==()

bool Rgba::operator== ( const Rgba other) const
inline

Definition at line 106 of file Color.h.

◆ over()

Rgba Rgba::over ( const Rgba other) const
inline

Blends two colors together using "over" operation.

Definition at line 120 of file Color.h.

◆ r() [1/2]

float& Rgba::r ( )
inline

Definition at line 39 of file Color.h.

◆ r() [2/2]

float Rgba::r ( ) const
inline

Definition at line 43 of file Color.h.

◆ red()

static Rgba Rgba::red ( )
inlinestatic

Definition at line 178 of file Color.h.

◆ saturate()

Rgba Rgba::saturate ( const float  value) const
inline

Retuns a color with modified saturation.

Parameters
valueValues greater than 1 increase the saturation, values lower than 1 decrease it. For zero, a gray color is returned.

Definition at line 166 of file Color.h.

◆ transparent()

static Rgba Rgba::transparent ( )
inlinestatic

Definition at line 202 of file Color.h.

◆ white()

static Rgba Rgba::white ( )
inlinestatic

Definition at line 194 of file Color.h.


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