LibTrace

Programming - The rgb class

The "rgb" class contains 3 main variables, "red", "green" and "blue" which are all "double"'s which simply specify the levels of red, green and blue in the color. The values range from 0 to 1. There is also a 4th variable "valid", which is used for the same purposes as in the "Vector" class.
rgb::rgb(double r, double g, double b)
rgb::rgb(bool v)

void rgb::clip(void)
void rgb::full_dump(void)
And of course the basic arithmatic operators ("+", "-", "*" and "/") have been overloaded.



rgb::rgb(double r, double g, double b)
This constructor simply sets the initial values of "red", "green" and "blue" to "r", "g" and "b" respectively.
rgb::rgb(bool v)
This constructor sets "valid" to "v".
void rgb::clip(void)
This function clips the color's values to the range of 0 to 1.
void rgb::full_dump(void)
This function outputs details of the rgb to "cout".