aboutsummaryrefslogtreecommitdiff
path: root/src/Image.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-19 00:04:36 (GMT)
committerfluxgen <fluxgen>2002-03-19 00:04:36 (GMT)
commita29dd8e4763cd66c2f88381c45501274df485d2c (patch)
tree5c3909cc694270da6fb6b392938633a51f5ea023 /src/Image.hh
parente6e1db0ad6caee1bb5c7f2542e0854d881a9308a (diff)
downloadfluxbox_pavel-a29dd8e4763cd66c2f88381c45501274df485d2c.zip
fluxbox_pavel-a29dd8e4763cd66c2f88381c45501274df485d2c.tar.bz2
fixed indentation and timer var
Diffstat (limited to 'src/Image.hh')
-rw-r--r--src/Image.hh227
1 files changed, 112 insertions, 115 deletions
diff --git a/src/Image.hh b/src/Image.hh
index 94953f9..1ac921a 100644
--- a/src/Image.hh
+++ b/src/Image.hh
@@ -16,16 +16,16 @@
16// 16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Image.hh,v 1.5 2002/02/17 18:57:47 fluxgen Exp $ 25// $Id: Image.hh,v 1.6 2002/03/19 00:04:36 fluxgen Exp $
26 26
27#ifndef IMAGE_HH 27#ifndef IMAGE_HH
28#define IMAGE_HH 28#define IMAGE_HH
29 29
30#include <X11/Xlib.h> 30#include <X11/Xlib.h>
31#include <X11/Xutil.h> 31#include <X11/Xutil.h>
@@ -41,86 +41,86 @@ class BImageControl;
41 41
42class BColor { 42class BColor {
43private: 43private:
44 int allocated; 44 int allocated;
45 unsigned char red, green, blue; 45 unsigned char red, green, blue;
46 unsigned long pixel; 46 unsigned long pixel;
47 47
48public: 48public:
49 BColor(char r = 0, char g = 0, char b = 0) 49 BColor(char r = 0, char g = 0, char b = 0)
50 { red = r; green = g; blue = b; pixel = 0; allocated = 0; } 50 { red = r; green = g; blue = b; pixel = 0; allocated = 0; }
51 51
52 inline const int &isAllocated(void) const { return allocated; } 52 inline const int &isAllocated(void) const { return allocated; }
53 53
54 inline const unsigned char &getRed(void) const { return red; } 54 inline const unsigned char getRed(void) const { return red; }
55 inline const unsigned char &getGreen(void) const { return green; } 55 inline const unsigned char getGreen(void) const { return green; }
56 inline const unsigned char &getBlue(void) const { return blue; } 56 inline const unsigned char getBlue(void) const { return blue; }
57 57
58 inline const unsigned long &getPixel(void) const { return pixel; } 58 inline const unsigned long getPixel(void) const { return pixel; }
59 59
60 inline void setAllocated(int a) { allocated = a; } 60 inline void setAllocated(int a) { allocated = a; }
61 inline void setRGB(char r, char g, char b) { red = r; green = g; blue = b; } 61 inline void setRGB(char r, char g, char b) { red = r; green = g; blue = b; }
62 inline void setPixel(unsigned long p) { pixel = p; } 62 inline void setPixel(unsigned long p) { pixel = p; }
63}; 63};
64 64
65 65
66class BTexture { 66class BTexture {
67private: 67private:
68 BColor color, colorTo, hiColor, loColor; 68 BColor color, colorTo, hiColor, loColor;
69 unsigned long texture; 69 unsigned long texture;
70 70
71public: 71public:
72 BTexture(void) { texture = 0; } 72 BTexture(void) { texture = 0; }
73 73
74 inline BColor *getColor(void) { return &color; } 74 inline BColor *getColor(void) { return &color; }
75 inline BColor *getColorTo(void) { return &colorTo; } 75 inline BColor *getColorTo(void) { return &colorTo; }
76 inline BColor *getHiColor(void) { return &hiColor; } 76 inline BColor *getHiColor(void) { return &hiColor; }
77 inline BColor *getLoColor(void) { return &loColor; } 77 inline BColor *getLoColor(void) { return &loColor; }
78 78
79 inline const unsigned long &getTexture(void) const { return texture; } 79 inline const unsigned long getTexture(void) const { return texture; }
80 80
81 inline void setTexture(unsigned long t) { texture = t; } 81 inline void setTexture(unsigned long t) { texture = t; }
82 inline void addTexture(unsigned long t) { texture |= t; } 82 inline void addTexture(unsigned long t) { texture |= t; }
83}; 83};
84 84
85 85
86 86
87class BImage { 87class BImage {
88private: 88private:
89 BImageControl *control; 89 BImageControl *control;
90 90
91#ifdef INTERLACE 91#ifdef INTERLACE
92 Bool interlaced; 92 Bool interlaced;
93#endif // INTERLACE 93#endif // INTERLACE
94 94
95 XColor *colors; 95 XColor *colors;
96 96
97 BColor *from, *to; 97 BColor *from, *to;
98 int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, 98 int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits,
99 ncolors, cpc, cpccpc; 99 ncolors, cpc, cpccpc;
100 unsigned char *red, *green, *blue, *red_table, *green_table, *blue_table; 100 unsigned char *red, *green, *blue, *red_table, *green_table, *blue_table;
101 unsigned int width, height, *xtable, *ytable; 101 unsigned int width, height, *xtable, *ytable;
102 102
103 103
104protected: 104protected:
105 Pixmap renderPixmap(void); 105 Pixmap renderPixmap(void);
106 106
107 XImage *renderXImage(void); 107 XImage *renderXImage(void);
108 108
109 void invert(void); 109 void invert(void);
110 void bevel1(void); 110 void bevel1(void);
111 void bevel2(void); 111 void bevel2(void);
112 void dgradient(void); 112 void dgradient(void);
113 void egradient(void); 113 void egradient(void);
114 void hgradient(void); 114 void hgradient(void);
115 void pgradient(void); 115 void pgradient(void);
116 void rgradient(void); 116 void rgradient(void);
117 void vgradient(void); 117 void vgradient(void);
118 void cdgradient(void); 118 void cdgradient(void);
119 void pcgradient(void); 119 void pcgradient(void);
120 120
121 121
122public: 122public:
123 enum Bevel{FLAT=0x00002, SUNKEN=0x00004, RAISED=0x00008}; 123 enum Bevel{FLAT=0x00002, SUNKEN=0x00004, RAISED=0x00008};
124 enum Textures{SOLID=0x00010, GRADIENT=0x00020}; 124 enum Textures{SOLID=0x00010, GRADIENT=0x00020};
125 enum Gradients{ 125 enum Gradients{
126 HORIZONTAL=0x00040, 126 HORIZONTAL=0x00040,
@@ -141,93 +141,90 @@ public:
141 }; 141 };
142 142
143 BImage(BImageControl *, unsigned int, unsigned int); 143 BImage(BImageControl *, unsigned int, unsigned int);
144 ~BImage(void); 144 ~BImage(void);
145 145
146 Pixmap render(BTexture *); 146 Pixmap render(BTexture *);
147 Pixmap render_solid(BTexture *); 147 Pixmap render_solid(BTexture *);
148 Pixmap render_gradient(BTexture *); 148 Pixmap render_gradient(BTexture *);
149}; 149};
150 150
151 151
152class BImageControl : public TimeoutHandler { 152class BImageControl : public TimeoutHandler {
153private: 153public:
154 Bool dither; 154 BImageControl(BaseDisplay *, ScreenInfo *, Bool = False, int = 4,
155 BaseDisplay *basedisplay; 155 unsigned long = 300000l, unsigned long = 200l);
156 ScreenInfo *screeninfo; 156 virtual ~BImageControl();
157#ifdef TIMEDCACHE
158 BTimer *timer;
159#endif // TIMEDCACHE
160
161 Colormap colormap;
162
163 Window window;
164 XColor *colors;
165 int colors_per_channel, ncolors, screen_number, screen_depth,
166 bits_per_pixel, red_offset, green_offset, blue_offset,
167 red_bits, green_bits, blue_bits;
168 unsigned char red_color_table[256], green_color_table[256],
169 blue_color_table[256];
170 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
171 grad_buffer_height;
172 unsigned long *sqrt_table, cache_max;
173 157
174 typedef struct Cache { 158 inline BaseDisplay *getBaseDisplay(void) { return basedisplay; }
175 Pixmap pixmap;
176 159
177 unsigned int count, width, height; 160 inline const bool doDither(void) { return dither; }
178 unsigned long pixel1, pixel2, texture; 161 inline const Colormap &getColormap(void) const { return colormap; }
179 } Cache; 162 inline ScreenInfo *getScreenInfo(void) { return screeninfo; }
180 163
181 typedef std::list<Cache *> CacheList; 164 inline const Window &getDrawable(void) const { return window; }
182 165
183 CacheList cache; 166 inline Visual *getVisual(void) { return screeninfo->getVisual(); }
184 167
168 inline const int getBitsPerPixel(void) const { return bits_per_pixel; }
169 inline const int getDepth(void) const { return screen_depth; }
170 inline const int getColorsPerChannel(void) const
171 { return colors_per_channel; }
185 172
186protected: 173 unsigned long getColor(const char *);
187 Pixmap searchCache(unsigned int, unsigned int, unsigned long, BColor *, 174 unsigned long getColor(const char *, unsigned char *, unsigned char *,
188 BColor *); 175 unsigned char *);
176 unsigned long getSqrt(unsigned int);
189 177
178 Pixmap renderImage(unsigned int, unsigned int, BTexture *);
190 179
191public: 180 void installRootColormap(void);
192 BImageControl(BaseDisplay *, ScreenInfo *, Bool = False, int = 4, 181 void removeImage(Pixmap);
193 unsigned long = 300000l, unsigned long = 200l); 182 void getColorTables(unsigned char **, unsigned char **, unsigned char **,
194 virtual ~BImageControl(void); 183 int *, int *, int *, int *, int *, int *);
184 void getXColorTable(XColor **, int *);
185 void getGradientBuffers(unsigned int, unsigned int,
186 unsigned int **, unsigned int **);
187 void setDither(Bool d) { dither = d; }
188 void setColorsPerChannel(int);
189 void parseTexture(BTexture *, char *);
190 void parseColor(BColor *, char * = 0);
195 191
196 inline BaseDisplay *getBaseDisplay(void) { return basedisplay; } 192 virtual void timeout(void);
197 193
198 inline const Bool &doDither(void) { return dither; } 194private:
199 inline const Colormap &getColormap(void) const { return colormap; } 195 Bool dither;
200 inline ScreenInfo *getScreenInfo(void) { return screeninfo; } 196 BaseDisplay *basedisplay;
197 ScreenInfo *screeninfo;
198#ifdef TIMEDCACHE
199 BTimer timer;
200#endif // TIMEDCACHE
201 201
202 inline const Window &getDrawable(void) const { return window; } 202 Colormap colormap;
203 203
204 inline Visual *getVisual(void) { return screeninfo->getVisual(); } 204 Window window;
205 XColor *colors;
206 int colors_per_channel, ncolors, screen_number, screen_depth,
207 bits_per_pixel, red_offset, green_offset, blue_offset,
208 red_bits, green_bits, blue_bits;
209 unsigned char red_color_table[256], green_color_table[256],
210 blue_color_table[256];
211 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
212 grad_buffer_height;
213 unsigned long *sqrt_table, cache_max;
205 214
206 inline const int &getBitsPerPixel(void) const { return bits_per_pixel; } 215 typedef struct Cache {
207 inline const int &getDepth(void) const { return screen_depth; } 216 Pixmap pixmap;
208 inline const int &getColorsPerChannel(void) const
209 { return colors_per_channel; }
210 217
211 unsigned long getColor(const char *); 218 unsigned int count, width, height;
212 unsigned long getColor(const char *, unsigned char *, unsigned char *, 219 unsigned long pixel1, pixel2, texture;
213 unsigned char *); 220 } Cache;
214 unsigned long getSqrt(unsigned int);
215 221
216 Pixmap renderImage(unsigned int, unsigned int, BTexture *); 222 typedef std::list<Cache *> CacheList;
217 223
218 void installRootColormap(void); 224 CacheList cache;
219 void removeImage(Pixmap);
220 void getColorTables(unsigned char **, unsigned char **, unsigned char **,
221 int *, int *, int *, int *, int *, int *);
222 void getXColorTable(XColor **, int *);
223 void getGradientBuffers(unsigned int, unsigned int,
224 unsigned int **, unsigned int **);
225 void setDither(Bool d) { dither = d; }
226 void setColorsPerChannel(int);
227 void parseTexture(BTexture *, char *);
228 void parseColor(BColor *, char * = 0);
229 225
230 virtual void timeout(void); 226protected:
227 Pixmap searchCache(unsigned int, unsigned int, unsigned long, BColor *, BColor *);
231}; 228};
232 229
233 230