]> git.vomp.tv Git - vompclient.git/blob - colour.h
Display channel name, duration, resume point and size on recording info screen
[vompclient.git] / colour.h
1 /*
2     Copyright 2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef COLOUR_H
22 #define COLOUR_H
23
24 class Colour
25 {
26   public:
27     Colour()
28       { red = 0; green = 0; blue = 0; alpha = 255; }
29
30     Colour(int Tred, int Tgreen, int Tblue)
31       { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; }
32
33     Colour(int Tred, int Tgreen, int Tblue, int Talpha)
34       { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
35
36     Colour(unsigned int color)
37         {
38                 red = (color & 0x00ff0000)>>16;
39                 green = (color & 0x0000ff00)>>8;
40                 blue = (color & 0x000000ff);
41                 alpha = (color & 0xff000000)>>24;
42         }
43
44     void set(int Tred, int Tgreen, int Tblue)
45       { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; }
46
47     void set(int Tred, int Tgreen, int Tblue, int Talpha)
48       { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
49
50     inline unsigned long rgba() const
51     {
52       return (alpha << 24) | (red << 16) | (green << 8) | blue;
53     }
54
55     int red;
56     int green;
57     int blue;
58     int alpha;
59
60
61
62
63 };
64
65 // TODO move to seperate File
66 class DrawStyle: public Colour
67 {
68 public:
69         DrawStyle()
70     { red = 0; green = 0; blue = 0; alpha = 255; ft=Color;ct=Global; }
71
72         DrawStyle(int Tred, int Tgreen, int Tblue)
73     { red = Tred; green = Tgreen; blue = Tblue; alpha = 255 ;ft=Color;ct=Global;  }
74
75         DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha)
76      { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft=Color;ct=Global;}
77         DrawStyle(unsigned int color)
78         {
79                 red = (color & 0x00ff0000)>>16;
80                 green = (color & 0x0000ff00)>>8;
81                 blue = (color & 0x000000ff);
82                 alpha = (color & 0xff000000)>>24;
83                 ft=Color;ct=Global;
84         }
85
86         DrawStyle(const Colour &c)
87         {
88                 red = c.red;
89                 green = c.green;
90                 blue = c.blue;
91                 alpha = c.alpha;
92                 ft=Color;ct=Global;
93         }
94
95         enum FillType {
96                         Color,
97                         GradientLinear,
98                         GradientRadial,
99         };
100         enum CoordType {
101                 Global,
102                 Local
103         };
104
105         enum FillType ft;
106         enum CoordType ct; //not implemented yet
107         float x1,y1,x2,y2,r; // Parameter for gradient either relative to object or to global coordinate system
108         int num_colors; //max is 4, min is 0
109         Colour grad_col[4];
110         float grad_pos[3]; //Last position is alway 1.0 and first 0.0
111
112     static DrawStyle BLACK;
113     static DrawStyle RED;
114     static DrawStyle GREEN;
115     static DrawStyle YELLOW;
116     static DrawStyle BLUE;
117     static DrawStyle GREY;
118     static DrawStyle DARKGREY;
119     static DrawStyle VIDEOBLUE;
120     static DrawStyle VIEWBACKGROUND;
121     static DrawStyle VIEWTRANSPARENTBACKGROUND;
122     static DrawStyle LIVETVSYMBOLS;
123     static DrawStyle PROGRESSBAR;
124     static DrawStyle OSDBACKGROUND;
125     static DrawStyle TABVIEWBACKGROUND;
126     static DrawStyle TITLEBARBACKGROUND;
127     static DrawStyle SELECTBACKGROUND;
128     static DrawStyle SELECTHIGHLIGHT;
129     static DrawStyle SELECTDARKHIGHLIGHT;
130     static DrawStyle LIGHTTEXT;
131     static DrawStyle DARKTEXT;
132     static DrawStyle DANGER;
133     static DrawStyle BUTTONBACKGROUND;
134     static DrawStyle PROGRAMMEA;
135     static DrawStyle PROGRAMMEB;
136     static DrawStyle NOPROGRAMME;
137     static DrawStyle WALLPAPER; // this one is special, if transparent it means picture
138
139 };
140
141 #define COMPARE_TEST(x) if (rhs.x!=lhs.x) { \
142                                                         return rhs.x < lhs.x; \
143                                                 }
144
145 inline bool operator<(const DrawStyle& rhs, const DrawStyle& lhs)
146 {
147         COMPARE_TEST(rgba())
148         COMPARE_TEST(ft)
149
150         if (rhs.ft==DrawStyle::Color) return false;
151
152         COMPARE_TEST(num_colors)
153         COMPARE_TEST(x1)
154         COMPARE_TEST(x2)
155         COMPARE_TEST(y1)
156         COMPARE_TEST(y2)
157         if (rhs.ft==DrawStyle::GradientRadial) COMPARE_TEST(r)
158
159
160         for (int i=0;i<lhs.num_colors; i++) {
161                 COMPARE_TEST(grad_col[i].rgba())
162                 if (i>0) COMPARE_TEST(grad_pos[i-1])
163         }
164         COMPARE_TEST(ct)
165
166         return false;
167 }
168
169
170 #undef COMPARE_TEST
171
172 #define COMPARE_TEST(x) if (rhs.x!=lhs.x) return true;
173
174
175 inline bool operator!=(const DrawStyle& rhs, const DrawStyle& lhs)
176 {
177         COMPARE_TEST(rgba())
178         COMPARE_TEST(ft)
179
180         if (rhs.ft==DrawStyle::Color) return false;
181
182         COMPARE_TEST(num_colors)
183         COMPARE_TEST(x1)
184         COMPARE_TEST(x2)
185         COMPARE_TEST(y1)
186         COMPARE_TEST(y2)
187         if (rhs.ft==DrawStyle::GradientRadial) COMPARE_TEST(r)
188
189
190         for (int i=0;i<lhs.num_colors; i++) {
191                 COMPARE_TEST(grad_col[i].rgba())
192                 if (i>0) COMPARE_TEST(grad_pos[i-1])
193         }
194         COMPARE_TEST(ct)
195
196         return false;
197 }
198
199 #undef COMPARE_TEST
200
201
202 class SkinFactory {
203 public:
204         static int getNumberofSkins();
205         static const char* *getSkinNames();
206         static bool InitSkin(int n);
207 };
208
209 #endif