Return to Index

Color

This class holds color information for drawing. A database of string-identified predefined colors is maintained for convenience. A partial list is given here:
   "red"
   "green"
   "blue"
   "gray"
   "light gray"
   "black"
   "white"
   "yellow"
   "violet"
The R-G-B color data is stored as three unsigned char member variables. These can be modified directly, as shown below:
   Color my_color;
   my_color.red = 0xE2;
   my_color.green = 0xA7;
   my_color.blue = 0x09;


Method Summary:
Color::Color();
Color::Color(const String& pName);
Color::Color(unsigned char r, unsigned char g, unsigned char b);
const Color& Color::operator=(const String& pName);
void Color::set(const String& pName);
Color::set(unsigned char r, unsigned char g, unsigned char b);



Color::Color
Color::Color();

Constructs a new Color object, defaulting to black.

Color::Color
Color::Color(const String& pName);

Constructs a new Color object with the specified string identifier.
Parameters:
const String& pNameThe color's database name.

Color::Color
Color::Color(unsigned char r, unsigned char g, unsigned char b);

Constructs a new Color object with the specified R-G-B values.
Parameters:
unsigned char rThe red value.
unsigned char gThe green value.
unsigned char bThe blue value.

const Color& Color::operator=
const Color& Color::operator=(const String& pName);

Changes the color to the one specified by the name.
Parameters:
const String& pNameThe database color name.

void Color::set
void Color::set(const String& pName);

Sets the color.
Parameters:
const String& pNameThe color's database name.

Color::set
Color::set(unsigned char r, unsigned char g, unsigned char b);

Sets the color.
Parameters:
unsigned char rThe red value.
unsigned char gThe green value.
unsigned char bThe blue value.


Generated automatically by docgen 0.0.1
© 2003 Aron Dobos