CColor Class Reference
[Utility classes]

This class represents a color. More...

#include <CColor.h>

List of all members.

Public Member Functions

 CColor (float r=0, float g=0, float b=0, float a=0)
 This is the CColor simple constructor.
float & operator[] (int i)
 This operator returns a reference to the color component corresponding to the index.
float operator[] (int i) const
 This const operator returns the color component corresponding to the index.
void Clamp (void)
 This function clamps the four components of the color between 0 and 1.
CColor operator+ (const CColor &c) const
 This operator adds two colors.
CColor operator * (const CColor &c) const
 This operator multiplies two colors.
CColor operator * (float k) const
 This operator returns the product of a color and a scalar.
CColor operator+= (const CColor &c)
 This operator is the same as + with an additionnal assignment.
CColor operator-= (const CColor &c)
 This operator is the same as - with an additionnal assignment.
CColor operator *= (const CColor &c)
 This operator is the same as * with an additionnal assignment.
CColor operator *= (float k)
 This operator is the same as * with an additionnal assignment.

Private Attributes

float red
float green
float blue
float alpha

Friends

CColor operator * (float k, const CColor &c)
 This operator returns the product of a scalar and a color.
std::ostream & operator<< (std::ostream &o, const CColor &c)
 This operator prints the value of the color.


Detailed Description

This class represents a color.

It holds four reel numbers meant to be clamped between 0 and 1.

Definition at line 21 of file CColor.h.


Constructor & Destructor Documentation

CColor::CColor ( float  r = 0,
float  g = 0,
float  b = 0,
float  a = 0 
) [inline]

This is the CColor simple constructor.

Definition at line 27 of file CColor.h.

References alpha, blue, green, and red.

Referenced by operator *(), and operator+().


Member Function Documentation

float& CColor::operator[] ( int  i  )  [inline]

This operator returns a reference to the color component corresponding to the index.

Definition at line 39 of file CColor.h.

References alpha, blue, green, and red.

float CColor::operator[] ( int  i  )  const [inline]

This const operator returns the color component corresponding to the index.

Definition at line 55 of file CColor.h.

References alpha, blue, green, and red.

void CColor::Clamp ( void   )  [inline]

This function clamps the four components of the color between 0 and 1.

Definition at line 71 of file CColor.h.

References alpha, blue, green, and red.

Referenced by CCommandExecutor::Execute().

CColor CColor::operator+ ( const CColor c  )  const [inline]

This operator adds two colors.

$ A + B = \left ( A_r+B_r , A_g+B_g , A_b+B_b , A_a+B_a \right ) $

Definition at line 99 of file CColor.h.

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

CColor CColor::operator * ( const CColor c  )  const [inline]

This operator multiplies two colors.

$ A * B = \left ( A_r*B_r , A_g*B_g , A_b*B_b , A_a*B_a \right ) $

Definition at line 110 of file CColor.h.

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

CColor CColor::operator * ( float  k  )  const [inline]

This operator returns the product of a color and a scalar.

$ k*A = \left ( k A_r , k A_g , k A_b, k A_a \right ) $

Definition at line 121 of file CColor.h.

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

CColor CColor::operator+= ( const CColor c  )  [inline]

This operator is the same as + with an additionnal assignment.

Definition at line 133 of file CColor.h.

References alpha, blue, green, and red.

CColor CColor::operator-= ( const CColor c  )  [inline]

This operator is the same as - with an additionnal assignment.

Definition at line 145 of file CColor.h.

References alpha, blue, green, and red.

CColor CColor::operator *= ( const CColor c  )  [inline]

This operator is the same as * with an additionnal assignment.

Definition at line 157 of file CColor.h.

References alpha, blue, green, and red.

CColor CColor::operator *= ( float  k  )  [inline]

This operator is the same as * with an additionnal assignment.

Definition at line 169 of file CColor.h.

References alpha, blue, green, and red.


Friends And Related Function Documentation

CColor operator * ( float  k,
const CColor c 
) [friend]

This operator returns the product of a scalar and a color.

$ A*k = \left ( k A_r , k A_g , k A_b , k A_a \right ) $

Definition at line 193 of file CColor.h.

std::ostream& operator<< ( std::ostream &  o,
const CColor c 
) [friend]

This operator prints the value of the color.

Definition at line 201 of file CColor.h.


Member Data Documentation

float CColor::red [private]

Red component of the color.

Definition at line 182 of file CColor.h.

Referenced by CColor(), Clamp(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-=(), operator<<(), and operator[]().

float CColor::green [private]

Green component of the color.

Definition at line 183 of file CColor.h.

Referenced by CColor(), Clamp(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-=(), operator<<(), and operator[]().

float CColor::blue [private]

Blue component of the color.

Definition at line 184 of file CColor.h.

Referenced by CColor(), Clamp(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-=(), operator<<(), and operator[]().

float CColor::alpha [private]

Alpha component of the color.

Definition at line 185 of file CColor.h.

Referenced by CColor(), Clamp(), operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-=(), operator<<(), and operator[]().


The documentation for this class was generated from the following file:
Generated on Fri Dec 5 03:20:33 2008 for Mathematical Ray-tracer by  doxygen 1.5.4