#ifndef COLOR_H
#define COLOR_H
-#include<utility> // for pair
-
#ifdef __GNUG_
#pragma interface
#endif
#include "LString.h"
-class HSV;
-class RGB;
+struct RGBColor;
-struct HSV {
+struct HSVColor {
double h;
double s;
double v;
- HSV() : h(0.0), s(0.0), v(0.0) {}
- HSV(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
- HSV( RGB const & );
+ HSVColor() : h(0.0), s(0.0), v(0.0) {}
+ HSVColor(double hue, double sat, double val)
+ : h(hue), s(sat), v(val) {}
+ HSVColor(RGBColor const &);
};
-struct RGB {
+struct RGBColor {
int r;
int g;
int b;
- RGB() : r(0), g(0), b(0) {}
- RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
- RGB( HSV const & );
+ RGBColor() : r(0), g(0), b(0) {}
+ RGBColor(int red, int green, int blue)
+ : r(red), g(green), b(blue) {}
+ RGBColor(HSVColor const &);
};
-typedef std::pair<string, RGB> X11Color;
-
-/// struct holding xform-specific colors
-struct XFormColor {
+struct NamedColor : public RGBColor {
string name;
- int colorID;
- RGB col;
- XFormColor() : colorID(0) {}
- string const getname() { return name; }
+ NamedColor() : RGBColor() {}
+ NamedColor(string const & n, RGBColor const & c )
+ : RGBColor(c), name(n) {}
+ RGBColor const & color() const { return *this; }
+ string const & getname() const { return name; }
};
inline
-bool operator==(RGB const & c1, RGB const & c2)
+bool operator==(RGBColor const & c1, RGBColor const & c2)
{
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
}
inline
-bool operator!=(RGB const & c1, RGB const & c2)
+bool operator!=(RGBColor const & c1, RGBColor const & c2)
{
return !(c1 == c2);
}