]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Color.h
Color patch from Angus, KDE patch from Johnm menu patch from Rob, and the usual unint...
[lyx.git] / src / frontends / xforms / Color.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1995 Matthias Ettrich
8  *          Copyright 1995-2000 The LyX Team.
9  *
10  *======================================================*/
11
12 #ifndef COLOR_H
13 #define COLOR_H
14
15 #include<utility> // for pair
16
17 #ifdef __GNUG_
18 #pragma interface
19 #endif
20
21 #include "LString.h"
22
23 class HSV;
24 class RGB;
25
26 struct HSV {
27         double h;
28         double s;
29         double v;
30         HSV() : h(0.0), s(0.0), v(0.0) {}
31         HSV(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
32         HSV( RGB const & );
33 };
34
35 struct RGB {
36         int r;
37         int g;
38         int b;
39         RGB() : r(0), g(0), b(0) {}
40         RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
41         RGB( HSV const & );
42 };
43
44 typedef std::pair<string, RGB> X11Color;
45
46 /// struct holding xform-specific colors
47 struct XFormColor {
48         string name;
49         int colorID;
50         RGB col;
51         XFormColor() : colorID(0) {}
52         string const getname() { return name; }
53 };
54
55 inline
56 bool operator==(RGB const & c1, RGB const & c2)
57 {
58         return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
59 }
60
61
62 inline
63 bool operator!=(RGB const & c1, RGB const & c2)
64 {
65         return !(c1 == c2);
66 }
67
68 #endif