cpe::color Class Reference

Public Member Functions

 color ()
 Generate a color, value=(0,0,0)=black.
 
 color (octet r, octet g, octet b)
 Direct constructor with values.
 
 color (int r, int g, int b)
 Direct constructor with values as integer (truncated in [0,255])
 
int red () const
 get the red value
 
int green () const
 get the green value
 
int blue () const
 get the blue value
 
octetred ()
 set the red value
 
octetgreen ()
 set the green value
 
octetblue ()
 set the blue value
 
std::string to_string () const
 convert the color into string
 

Static Public Member Functions

static double norm (const color &c1, const color &c2)
 Compute the norm between two colors.
 

Private Attributes

octet r
 internal storage for red component
 
octet g
 internal storage for green component
 
octet b
 internal storage for blue component
 

Detailed Description

Storage class for a color Store the color as (r,g,b) value. Each component belongs in [0,255]

Constructor & Destructor Documentation

cpe::color::color ( )

Generate a color, value=(0,0,0)=black.

References b, g, and r.

cpe::color::color ( octet  r,
octet  g,
octet  b 
)

Direct constructor with values.

cpe::color::color ( int  r,
int  g,
int  b 
)

Direct constructor with values as integer (truncated in [0,255])

References b, g, and r.

Member Function Documentation

int cpe::color::blue ( ) const

get the blue value

References b.

Referenced by norm().

+ Here is the caller graph for this function:

octet & cpe::color::blue ( )

set the blue value

References b.

int cpe::color::green ( ) const

get the green value

References g.

Referenced by norm().

+ Here is the caller graph for this function:

octet & cpe::color::green ( )

set the green value

References g.

double cpe::color::norm ( const color c1,
const color c2 
)
static

Compute the norm between two colors.

Compute the Euclidian distance sqrt((r2-r1)^2+(g2-g1)^2+(b2-b1)^2)

References blue(), green(), and red().

+ Here is the call graph for this function:

int cpe::color::red ( ) const

get the red value

References r.

Referenced by norm().

+ Here is the caller graph for this function:

octet & cpe::color::red ( )

set the red value

References r.

std::string cpe::color::to_string ( ) const

convert the color into string

References b, g, and r.

Referenced by cpe::operator<<().

+ Here is the caller graph for this function:

Member Data Documentation

octet cpe::color::b
private

internal storage for blue component

Referenced by blue(), color(), and to_string().

octet cpe::color::g
private

internal storage for green component

Referenced by color(), green(), and to_string().

octet cpe::color::r
private

internal storage for red component

Referenced by color(), red(), and to_string().


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