scatter 0.1.0
scatter::Colour Class Reference

define a RGBA colour More...

#include <scatter/Colour.hpp>

Public Member Functions

 Colour ()
 construct a black Colour
 
 Colour (const double &r, const double &g, const double &b, const double &a)
 constructor
 
 Colour (const int &r, const int &g, const int &b, const int &a)
 constructor
 
 Colour (const int &hex)
 constructor
 
virtual ~Colour ()
 destructor
 
const double & r () const
 return the red part
 
const double & g () const
 return the green part
 
const double & b () const
 return the blue part
 
const double & a () const
 return the alpha part
 
bool operator== (const Colour &other) const
 

Static Public Member Functions

static Colour mix (const double &weight, const Colour &colour1, const Colour &colour2)
 [brief description]
 
static Colour createFromHex (const int &hex)
 [brief description]
 

Static Public Attributes

static Colour red
 define red colour
 
static Colour blue
 define blue colour
 
static Colour green
 define green colour
 
static Colour yellow
 define yellow colour
 
static Colour black
 define black colour
 
static Colour white
 define white colour
 
static Colour cyan
 define cyan colour
 
static Colour pink
 define pink colour
 

Protected Member Functions

 Colour (const std::array< double, 4 > &c)
 internal constructor
 

Detailed Description

define a RGBA colour

Constructor & Destructor Documentation

◆ Colour() [1/4]

scatter::Colour::Colour ( const double & r,
const double & g,
const double & b,
const double & a )

constructor

construct a colour with values 0 <= x <= 1

Parameters
rred, 0 <= r <= 1
ggreen , 0 <= g <= 1
bblue, 0 <= b <= 1
aalpha, 0 <= a <= 1

◆ Colour() [2/4]

scatter::Colour::Colour ( const int & r,
const int & g,
const int & b,
const int & a )

constructor

construct a colour with values 0 <= x <= 255

Parameters
rred, 0 <= r <= 255
ggreen , 0 <= g <= 255
bblue, 0 <= b <= 255
aalpha, 0 <= a <= 255

◆ Colour() [3/4]

scatter::Colour::Colour ( const int & hex)

constructor

construct a colour from a hex string

Parameters
hex_stringrgba

◆ ~Colour()

virtual scatter::Colour::~Colour ( )
virtual

destructor

[long description]

◆ Colour() [4/4]

scatter::Colour::Colour ( const std::array< double, 4 > & c)
protected

internal constructor

convenice constructor to be able to iterate over the values for saturating them

Parameters
carray containing r,g,b,a values

Member Function Documentation

◆ a()

const double & scatter::Colour::a ( ) const

return the alpha part

[long description]

◆ b()

const double & scatter::Colour::b ( ) const

return the blue part

[long description]

◆ createFromHex()

static Colour scatter::Colour::createFromHex ( const int & hex)
static

[brief description]

[long description]

Parameters
hex[description]
Returns
[description]

◆ g()

const double & scatter::Colour::g ( ) const

return the green part

[long description]

◆ mix()

static Colour scatter::Colour::mix ( const double & weight,
const Colour & colour1,
const Colour & colour2 )
static

[brief description]

[long description]

Parameters
weight[description]
colour1[description]
colour2[description]
Returns
[description]

◆ r()

const double & scatter::Colour::r ( ) const

return the red part

[long description]


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