… | |
… | |
222 | |
222 | |
223 | ///////////////////////////////////////////////////////////////////////////// |
223 | ///////////////////////////////////////////////////////////////////////////// |
224 | |
224 | |
225 | typedef unsigned long Pixel; |
225 | typedef unsigned long Pixel; |
226 | |
226 | |
227 | struct rxvt_rgba { |
227 | struct rgba { |
228 | unsigned short r, g, b, a; |
228 | unsigned short r, g, b, a; |
229 | |
229 | |
230 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
230 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
231 | |
231 | |
232 | rxvt_rgba () |
232 | rgba () |
233 | { } |
233 | { } |
234 | |
234 | |
235 | rxvt_rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
235 | rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
236 | : r(r), g(g), b(b), a(a) |
236 | : r(r), g(g), b(b), a(a) |
237 | { } |
237 | { } |
238 | }; |
238 | }; |
239 | |
239 | |
240 | struct rxvt_color { |
240 | struct rxvt_color { |
241 | #if XFT |
241 | #if XFT |
242 | XftColor c; |
242 | XftColor c; |
|
|
243 | #else |
|
|
244 | XColor c; |
|
|
245 | #endif |
|
|
246 | |
243 | operator Pixel () const { return c.pixel; } |
247 | operator Pixel () const { return c.pixel; } |
244 | #else |
|
|
245 | Pixel p; |
|
|
246 | operator Pixel () const { return p; } |
|
|
247 | #endif |
|
|
248 | |
248 | |
249 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
249 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
250 | bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } |
250 | bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } |
251 | |
251 | |
252 | bool alloc (rxvt_screen *screen, const rxvt_rgba &color); |
252 | bool alloc (rxvt_screen *screen, const rgba &color); |
253 | void free (rxvt_screen *screen); |
253 | void free (rxvt_screen *screen); |
254 | |
254 | |
255 | void get (rxvt_screen *screen, rxvt_rgba &color); |
255 | void get (rgba &color); |
256 | |
256 | |
257 | bool set (rxvt_screen *screen, const char *name); |
257 | bool set (rxvt_screen *screen, const char *name); |
258 | bool set (rxvt_screen *screen, const rxvt_rgba &color); |
258 | bool set (rxvt_screen *screen, const rgba &color); |
259 | |
259 | |
260 | rxvt_color fade (rxvt_screen *screen, int percent, const rxvt_rgba &to = rxvt_rgba (0, 0, 0)); |
260 | void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); |
261 | }; |
261 | }; |
262 | |
262 | |
263 | #endif |
263 | #endif |
264 | |
264 | |