Laxkit  0.0.7.1
screencolor.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2011 by Tom Lechner
22 //
23 #ifndef _LAX_SCREENCOLOR_H
24 #define _LAX_SCREENCOLOR_H
25 
26 
27 
28 
29 namespace Laxkit {
30 
31 //------------------------------- ScreenColor -------------------------------
33 {
34  public:
35  int red, green, blue, alpha;
36  char pixel_is_synced;
37  long pixel;
38  ScreenColor() { red=green=blue=alpha=0; pixel_is_synced=0; pixel=0; }
39  ScreenColor(unsigned int color);
40  ScreenColor(int r, int g, int b, int a)
41  : red(r), green(g), blue(b), alpha(a), pixel_is_synced(0), pixel(0) {}
42  ScreenColor(double r, double g, double b, double a)
43  : red(r*65535), green(g*65535), blue(b*65535), alpha(a*65535), pixel_is_synced(0), pixel(0) {}
44 
45  void gray(int g, int a=0xffff);
46  void rgb(int r,int g,int b, int a=0xffff);
47  void cmyk(int c, int m, int y, int k, int a=0xffff);
48 
49  void grayf(double g, double a=1.0);
50  void rgbf(double r,double g,double b, double a=1.0);
51  void cmykf(double c, double m, double y, double k, double a=1.0);
52 
53  unsigned long Pixel();
54  int equals(ScreenColor &color);
55  int equals(double r,double g,double b, double a);
56 };
57 
58 } //namespace Laxkit
59 
60 
61 #endif
62 

Mon Feb 17 2014 11:52:57, Laxkit