Rgb Struct Reference

Represents an RGB color. More...

#include <rgb.h>

List of all members.

Public Member Functions

 Rgb ()
 Initialize all components to zero.
 Rgb (float c)
 Initialize all components to the given real number c.
 Rgb (float _r, float _g, float _b)
 Initialize all components to the corresponding given values.
Rgb operator+ (const Rgb &other) const
 Add the given RGB other to this and return the result.
Rgb operator- (const Rgb &other) const
 Subtract the given RGB other from this and return the result.
Rgb operator+ (float c) const
 Add the given real number c to every component of this and return the result.
Rgboperator+= (const Rgb &other)
 Add the given RGB other to this and set this to the result.
Rgb operator* (const Rgb &other) const
 Component-wisely multiply the given RGB other to this and return the result.
Rgb operator* (float c) const
 Multiply the given real number c with this and return the result.
Rgboperator*= (const Rgb &other)
 Component-wisely multiply the given RGB other to this and then set this to the result.
Rgb operator/ (const Rgb &other) const
 Divide all the components of this with the corresponding components of other and return the result.
Rgb operator/ (float c) const
 Divide all the components of this with the given real number c and return the result.
bool is_near (const Rgb &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
 intensity of the color red
float g
 intensity of the color green
float b
 intensity of the color blue


Detailed Description

Represents an RGB color.

Constructor & Destructor Documentation

Rgb::Rgb (  )  [inline]

Initialize all components to zero.

Rgb::Rgb ( float  c  )  [inline]

Initialize all components to the given real number c.

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

Initialize all components to the corresponding given values.


Member Function Documentation

bool Rgb::is_near ( const Rgb 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Member Data Documentation

float Rgb::b

intensity of the color blue

float Rgb::g

intensity of the color green

float Rgb::r

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