Next: , Previous: Color Constructors and Setting Functions, Up: Color Reference


16.3 Operators

— Assignment operator: void operator= (const Color& c)

Sets name to the empty string, use_name to false, and red_part, green_part, and blue_part to c.red_part, c.green_part, and c.blue_part, respectively.

const operator: bool operator== (const Color& c)

Equality operator. Returns true, if the red_parts, green_parts, and blue_parts of *this and c are equal, otherwise false. The names and use_names are not compared.

const operator: bool operator!= (const Color& c)

Inequality operator. Returns false, if the red_parts, green_parts, and blue_parts of *this and c are equal, otherwise true. The names and use_names are not compared.

— Non-member function: ostream& operator<< (ostream& o, const Color& c)

Output operator. Writes the MetaPost code for the Color to out_stream when a Picture is output. This occurs when the Color has been used as an argument to drawing or filling functions.

If use_name is true, name is written to out_stream. Otherwise, “(red_part, green_part, blue_part)” is written to out_stream.