Node:Color Constructors and Setting Functions, Next:, Previous:Color Data Members, Up:Color Reference



Constructors and Setting Functions

void Color (void) Default constructor
Creates a Color and initializes its red_part, green_part, and blue_part to 0. use_name and on_free_store are set to false.

void Color (const Color& c, [const string n = "", [const bool u = true]]) Copy constructor
Creates a Color and makes it a copy of c. If n is not the empty string and u is true, use_name is set to true. Otherwise, its set to false.

void Color (const string n, const unsigned short r, const unsigned short g, const unsigned short b, [const bool u = true]) Constructor
Creates a Color with name n. Its red_part, green_part, and blue_part are set to r/255.0, g/255.0, and b/255.0, respectively. use_name is set to u.

void set (const string n, const unsigned short r, const unsigned short g, const unsigned short b, [const bool u = false]) Setting function
Corresponds to the constructor above, except that u is false by default.

void Color (const real r, const real g, const real b) Constructor
Creates an unnamed Color using the real values r, g, and b for its red_part, green_part, and blue_part, respectively.

void set (const real r, const real g, const real b) Setting function
Corresponds to the constructor above.

Color* create_new<Color> (const Color* c) Template specializations
Color* create_new<Color> (const Color& c)
Pseudo-constructors for dynamic allocation of Colors. They create a Color on the free store and allocate memory for it using new(Color). They return a pointer to the new Color.

If c is a non-zero pointer or a reference, the new Color will be a copy of c. If the new object is not meant to be a copy of an existing one, 0 must be passed to create_new<Color>() as its argument. See Dynamic Allocation of Shapes, for more information.

This function is used in the drawing and filling functions for Path and Solid. Point::drawdot() should be changed to use it too, but I haven't gotten around to doing this yet.