CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csColor Class Reference

A class used to represent a color in RGB space. More...

#include <csutil/cscolor.h>

Inheritance diagram for csColor:

csColor4 List of all members.

Public Member Functions

 csColor ()
 Initialize a color object (contents undefined).
 csColor (float r, float g, float b)
 Initialize a color object with given R,G,B components.
 csColor (const csColor &c)
 Initialize a color object with an existing color.
void Set (float r, float g, float b)
 Set color to given R,G,B components.
void Set (const csColor &c)
 Set color to given color.
void Clamp (float r, float g, float b)
 Clamp color to given R,G,B values.
void ClampDown ()
 Make sure color components are not negative.
csColoroperator= (const csColor &c)
 Assign one color object to another.
csColoroperator *= (float f)
 Multiply this color by a scalar value.
csColoroperator+= (const csColor &c)
 Add another color to this one.
csColoroperator-= (const csColor &c)
 Subtract another color to this one.
bool operator== (const csColor &c) const
 Compare equality of two colors.
bool operator!= (const csColor &c) const
 Compare inequality of two colors.
void Add (float r, float g, float b)
 Add given R,G,B components to color.
void Subtract (float r, float g, float b)
 Subtract given R,G,B components from color.

Public Attributes

float red
 Red (0..1).
float green
 Green (0..1).
float blue
 Blue (0..1).

Detailed Description

A class used to represent a color in RGB space.

This class is similar to csRGBpixel and csRGBcolor except that it uses floating-point values to store R,G,B values.

Definition at line 29 of file cscolor.h.


Constructor & Destructor Documentation

csColor::csColor  )  [inline]
 

Initialize a color object (contents undefined).

Definition at line 40 of file cscolor.h.

csColor::csColor float  r,
float  g,
float  b
[inline]
 

Initialize a color object with given R,G,B components.

Definition at line 42 of file cscolor.h.

csColor::csColor const csColor c  )  [inline]
 

Initialize a color object with an existing color.

Definition at line 45 of file cscolor.h.

References blue, green, and red.


Member Function Documentation

void csColor::Add float  r,
float  g,
float  b
[inline]
 

Add given R,G,B components to color.

Definition at line 86 of file cscolor.h.

void csColor::Clamp float  r,
float  g,
float  b
[inline]
 

Clamp color to given R,G,B values.

Definition at line 54 of file cscolor.h.

void csColor::ClampDown  )  [inline]
 

Make sure color components are not negative.

Definition at line 61 of file cscolor.h.

csColor& csColor::operator *= float  f  )  [inline]
 

Multiply this color by a scalar value.

Reimplemented in csColor4.

Definition at line 71 of file cscolor.h.

bool csColor::operator!= const csColor c  )  const [inline]
 

Compare inequality of two colors.

Definition at line 83 of file cscolor.h.

References blue, green, and red.

csColor& csColor::operator+= const csColor c  )  [inline]
 

Add another color to this one.

Reimplemented in csColor4.

Definition at line 74 of file cscolor.h.

References blue, green, and red.

csColor& csColor::operator-= const csColor c  )  [inline]
 

Subtract another color to this one.

Reimplemented in csColor4.

Definition at line 77 of file cscolor.h.

References blue, green, and red.

csColor& csColor::operator= const csColor c  )  [inline]
 

Assign one color object to another.

Reimplemented in csColor4.

Definition at line 68 of file cscolor.h.

References blue, green, and red.

bool csColor::operator== const csColor c  )  const [inline]
 

Compare equality of two colors.

Definition at line 80 of file cscolor.h.

References blue, green, and red.

void csColor::Set const csColor c  )  [inline]
 

Set color to given color.

Reimplemented in csColor4.

Definition at line 51 of file cscolor.h.

References blue, green, and red.

void csColor::Set float  r,
float  g,
float  b
[inline]
 

Set color to given R,G,B components.

Reimplemented in csColor4.

Definition at line 48 of file cscolor.h.

void csColor::Subtract float  r,
float  g,
float  b
[inline]
 

Subtract given R,G,B components from color.

Definition at line 89 of file cscolor.h.


Member Data Documentation

float csColor::blue
 

Blue (0..1).

Definition at line 37 of file cscolor.h.

Referenced by csColor(), csColor4::operator!=(), operator!=(), csColor4::operator+=(), operator+=(), csColor4::operator-=(), operator-=(), csColor4::operator=(), operator=(), csColor4::operator==(), operator==(), csColor4::Set(), and Set().

float csColor::green
 

Green (0..1).

Definition at line 35 of file cscolor.h.

Referenced by csColor(), csColor4::operator!=(), operator!=(), csColor4::operator+=(), operator+=(), csColor4::operator-=(), operator-=(), csColor4::operator=(), operator=(), csColor4::operator==(), operator==(), csColor4::Set(), and Set().

float csColor::red
 

Red (0..1).

Definition at line 33 of file cscolor.h.

Referenced by csColor(), csColor4::operator!=(), operator!=(), csColor4::operator+=(), operator+=(), csColor4::operator-=(), operator-=(), csColor4::operator=(), operator=(), csColor4::operator==(), operator==(), csColor4::Set(), and Set().


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1