]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Color.h
Really dull and boring header shit
[lyx.git] / src / frontends / xforms / Color.h
1 // -*- C++ -*-
2 /**
3  * \file Color.h
4  * Copyright 1995 Matthias Ettrich
5  * Read the file COPYING
6  *
7  * \author Angus Leeming 
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 /* structs RGBColor and HSVColor to enable simple conversion between
13  * color spaces.
14  */
15
16 #ifndef COLOR_H
17 #define COLOR_H
18
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 #include "LString.h"
24
25 struct RGBColor;
26
27 struct HSVColor {
28         double h;
29         double s;
30         double v;
31         HSVColor() : h(0.0), s(0.0), v(0.0) {}
32         HSVColor(double hue, double sat, double val)
33                 : h(hue), s(sat), v(val) {}
34         HSVColor(RGBColor const &);
35 };
36
37 struct RGBColor {
38         int r;
39         int g;
40         int b;
41         RGBColor() : r(0), g(0), b(0) {}
42         RGBColor(int red, int green, int blue)
43                 : r(red), g(green), b(blue) {}
44         RGBColor(HSVColor const &);
45 };
46
47 struct NamedColor : public RGBColor {
48         string name;
49         NamedColor() : RGBColor() {}
50         NamedColor(string const & n, RGBColor const & c)
51                 : RGBColor(c), name(n) {}
52         RGBColor const & color() const { return *this; }
53         string const & getname() const { return name; }
54 };
55
56 inline
57 bool operator==(RGBColor const & c1, RGBColor const & c2)
58 {
59         return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
60 }
61
62
63 inline
64 bool operator!=(RGBColor const & c1, RGBColor const & c2)
65 {
66         return !(c1 == c2);
67 }
68
69 #endif