Laxkit  0.0.7.1
colorbase.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) 2012-2013 by Tom Lechner
22 //
23 #ifndef _LAX_COLORBASE_H
24 #define _LAX_COLORBASE_H
25 
26 
27 #include <lax/colors.h>
28 
29 namespace Laxkit {
30 
31 
32 
33 //------------------------------- ColorBase ------------------------------
34 class ColorBase
35 {
36  protected:
37 
38  public:
39  int colortype;
40  int max;
41  int oldcolor[5], color1[5],color2[5];
42  int *colors;
43 
44  ColorBase(int ctype, int nmax, int c0,int c1,int c2,int c3=-1,int c4=-1);
45  virtual ~ColorBase();
46 
47  virtual int ColorChanged();
48  virtual void Updated();
49  virtual void Clamp();
50  virtual void RestoreColor();
51 
52  virtual void SetMax(int newmax);
53  virtual void SetRGB(int r,int g,int b,int a=-1);
54  virtual void SetGray(int g,int a=-1);
55  virtual void SetCMYK(int c,int m,int y,int k, int a=-1);
56  virtual void SetHSV(int h,int s,int v, int a=-1);
57 
58  virtual void SetRGB(double r,double g,double b,double a=-1);
59  virtual void SetGray(double g,double a=-1);
60  virtual void SetCMYK(double c,double m,double y,double k, double a=-1);
61  virtual void SetHSV(double h,double s,double v, double a=-1);
62  virtual void CMYK(double *cmyk);
63  virtual void RGB(double *rgb);
64  virtual void HSV(double *hsv);
65  virtual char *HexValue(char *buffer);
66  virtual int SetHexValue(const char *hex);
67 
68  virtual int Red();
69  virtual int Red(int r);
70  virtual double Redf(double r);
71  virtual double Redf();
72  virtual int Green();
73  virtual int Green(int g);
74  virtual double Greenf(double g);
75  virtual double Greenf();
76  virtual int Blue();
77  virtual int Blue(int b);
78  virtual double Bluef(double b);
79  virtual double Bluef();
80  virtual int Gray();
81  virtual int Gray(int g);
82  virtual double Grayf(double g);
83  virtual double Grayf();
84  virtual int Cyan();
85  virtual int Cyan(int c);
86  virtual double Cyanf(double c);
87  virtual double Cyanf();
88  virtual int Magenta();
89  virtual int Magenta(int m);
90  virtual double Magentaf(double m);
91  virtual double Magentaf();
92  virtual int Yellow();
93  virtual int Yellow(int y);
94  virtual double Yellowf(double y);
95  virtual double Yellowf();
96  virtual int Black();
97  virtual int Black(int k);
98  virtual double Blackf(double k);
99  virtual double Blackf();
100  virtual int Alpha();
101  virtual int Alpha(int a);
102  virtual double Alphaf(double a);
103  virtual double Alphaf();
104  virtual int Hue();
105  virtual int Hue(int h);
106  virtual double Huef(double h);
107  virtual double Huef();
108  virtual int Saturation();
109  virtual int Saturation(int s);
110  virtual double Saturationf(double s);
111  virtual double Saturationf();
112  virtual int Value();
113  virtual int Value(int v);
114  virtual double Valuef(double v);
115  virtual double Valuef();
116 };
117 
118 
119 
120 } // namespace Laxkit
121 
122 #endif
123 

Mon Feb 17 2014 11:52:56, Laxkit