Rgba Struct Reference

Represents an RGBA color. More...

#include <rgba.h>

List of all members.

Public Member Functions

 Rgba ()
 Initialize all components to zero.
 Rgba (float c)
 Initialize all components to the given real number c.
 Rgba (float _r, float _g, float _b)
 Initialize the colors to the corresponding given values and the alpha to 1.
 Rgba (float _r, float _g, float _b, float _a)
 Initialize all components to the corresponding given values.
Rgba operator+ (const Rgba &other) const
 Add the given RGBA other to this and return the result.
Rgba operator- (const Rgba &other) const
 Subtract the given RGBA other from this and return the result.
Rgba operator+ (float c) const
 Add the given real number c to every component of this and return the result.
Rgbaoperator+= (const Rgba &other)
 Add the given RGBA other to this and set this to the result.
Rgba operator* (const Rgba &other) const
 Component-wisely multiply the given RGBA other to this and return the result.
Rgba operator* (float c) const
 Multiply the given real number c with this and return the result.
Rgbaoperator*= (const Rgba &other)
 Component-wisely multiply the given RGB other to this and then set this to the result.
Rgba operator/ (const Rgba &other) const
 Divide all the components of this with the corresponding components of other and return the result.
Rgba operator/ (float c) const
 Divide all the components of this with the given real number c and return the result.
void fill_array_4 (float *_a)
 Fill the given array with the values of the components of this.
bool is_near (const Rgba &other, float threshold=EPSILON)
 Check whether all the components of this is within threshold of the corresponding components of other or not.

Public Attributes

float r
 the intensity of the color red
float g
 the intensity of the color green
float b
 the intensity of the color blue
float a
 the transparency.


Detailed Description

Represents an RGBA color.

Constructor & Destructor Documentation

Rgba::Rgba (  )  [inline]

Initialize all components to zero.

Rgba::Rgba ( float  c  )  [inline]

Initialize all components to the given real number c.

Rgba::Rgba ( float  _r,
float  _g,
float  _b 
) [inline]

Initialize the colors to the corresponding given values and the alpha to 1.

Rgba::Rgba ( float  _r,
float  _g,
float  _b,
float  _a 
) [inline]

Initialize all components to the corresponding given values.


Member Function Documentation

void Rgba::fill_array_4 ( float *  _a  )  [inline]

Fill the given array with the values of the components of this.

That is: a[0] is set to r. a[1] is set to g. a[2] is set to b. a[3] is set to a.

bool Rgba::is_near ( const Rgba other,
float  threshold = EPSILON 
) [inline]

Check whether all the components of this is within threshold of the corresponding components of other or not.

Use this method to test approximate equality.

Rgba Rgba::operator* ( float  c  )  const [inline]

Multiply the given real number c with this and return the result.

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

Component-wisely multiply the given RGBA other to this and return the result.

Rgba& Rgba::operator*= ( const Rgba other  )  [inline]

Component-wisely multiply the given RGB other to this and then set this to the result.

Rgba Rgba::operator+ ( float  c  )  const [inline]

Add the given real number c to every component of this and return the result.

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

Add the given RGBA other to this and return the result.

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

Add the given RGBA other to this and set this to the result.

Rgba Rgba::operator- ( const Rgba other  )  const [inline]

Subtract the given RGBA other from this and return the result.

Rgba Rgba::operator/ ( float  c  )  const [inline]

Divide all the components of this with the given real number c and return the result.

Rgba Rgba::operator/ ( const Rgba other  )  const [inline]

Divide all the components of this with the corresponding components of other and return the result.


Member Data Documentation

float Rgba::a

the transparency.

float Rgba::b

the intensity of the color blue

float Rgba::g

the intensity of the color green

float Rgba::r

the intensity of the color red


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

Generated on Tue Sep 8 02:20:35 2009 for cglib by  doxygen 1.5.9