aboutsummaryrefslogtreecommitdiff
path: root/src/Image.cc
diff options
context:
space:
mode:
authorunknown <unknown>2002-01-11 11:59:54 (GMT)
committerunknown <unknown>2002-01-11 11:59:54 (GMT)
commit61661d638e34b3ce6c986d5a53b8c08c1051d422 (patch)
treef0b87676e95070afee163f76902efd0c4d5b5fe6 /src/Image.cc
parentf98c3c9045397bd9497621deb55b310366f8a5de (diff)
parenta3d2a1cf0a5ab724e19a91915fe97842f52260d5 (diff)
downloadfluxbox-61661d638e34b3ce6c986d5a53b8c08c1051d422.zip
fluxbox-61661d638e34b3ce6c986d5a53b8c08c1051d422.tar.bz2
This commit was manufactured by cvs2svn to create tagRelease-0_1_6
'Release-0_1_6'.
Diffstat (limited to 'src/Image.cc')
-rw-r--r--src/Image.cc102
1 files changed, 54 insertions, 48 deletions
diff --git a/src/Image.cc b/src/Image.cc
index feebba8..611d307 100644
--- a/src/Image.cc
+++ b/src/Image.cc
@@ -1,3 +1,6 @@
1// Image.cc for Flxubox Window Manager
2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxbox@linuxmail.org)
3//
1// Image.cc for Blackbox - an X11 Window manager 4// Image.cc for Blackbox - an X11 Window manager
2// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
3// 6//
@@ -21,6 +24,9 @@
21 24
22// stupid macros needed to access some functions in version 2 of the GNU C 25// stupid macros needed to access some functions in version 2 of the GNU C
23// library 26// library
27
28// $Id: Image.cc,v 1.3 2002/01/09 14:11:20 fluxgen Exp $
29
24#ifndef _GNU_SOURCE 30#ifndef _GNU_SOURCE
25#define _GNU_SOURCE 31#define _GNU_SOURCE
26#endif // _GNU_SOURCE 32#endif // _GNU_SOURCE
@@ -109,11 +115,11 @@ BImage::~BImage(void) {
109 115
110 116
111Pixmap BImage::render(BTexture *texture) { 117Pixmap BImage::render(BTexture *texture) {
112 if (texture->getTexture() & BImage_ParentRelative) 118 if (texture->getTexture() & BImage::PARENTRELATIVE)
113 return ParentRelative; 119 return ParentRelative;
114 else if (texture->getTexture() & BImage_Solid) 120 else if (texture->getTexture() & BImage::SOLID)
115 return render_solid(texture); 121 return render_solid(texture);
116 else if (texture->getTexture() & BImage_Gradient) 122 else if (texture->getTexture() & BImage::GRADIENT)
117 return render_gradient(texture); 123 return render_gradient(texture);
118 124
119 return None; 125 return None;
@@ -156,7 +162,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
156 width, height); 162 width, height);
157 163
158#ifdef INTERLACE 164#ifdef INTERLACE
159 if (texture->getTexture() & BImage_Interlaced) { 165 if (texture->getTexture() & BImage::INTERLACED) {
160 gcv.foreground = texture->getColorTo()->getPixel(); 166 gcv.foreground = texture->getColorTo()->getPixel();
161 GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, 167 GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
162 GCForeground, &gcv); 168 GCForeground, &gcv);
@@ -171,8 +177,8 @@ Pixmap BImage::render_solid(BTexture *texture) {
171#endif // INTERLACE 177#endif // INTERLACE
172 178
173 179
174 if (texture->getTexture() & BImage_Bevel1) { 180 if (texture->getTexture() & BImage::BEVEL1) {
175 if (texture->getTexture() & BImage_Raised) { 181 if (texture->getTexture() & BImage::RAISED) {
176 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 182 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
177 0, height - 1, width - 1, height - 1); 183 0, height - 1, width - 1, height - 1);
178 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 184 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
@@ -182,7 +188,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
182 0, 0, width - 1, 0); 188 0, 0, width - 1, 0);
183 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 189 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
184 0, height - 1, 0, 0); 190 0, height - 1, 0, 0);
185 } else if (texture->getTexture() & BImage_Sunken) { 191 } else if (texture->getTexture() & BImage::SUNKEN) {
186 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 192 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
187 0, height - 1, width - 1, height - 1); 193 0, height - 1, width - 1, height - 1);
188 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 194 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
@@ -193,8 +199,8 @@ Pixmap BImage::render_solid(BTexture *texture) {
193 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 199 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
194 0, height - 1, 0, 0); 200 0, height - 1, 0, 0);
195 } 201 }
196 } else if (texture->getTexture() & BImage_Bevel2) { 202 } else if (texture->getTexture() & BImage::BEVEL2) {
197 if (texture->getTexture() & BImage_Raised) { 203 if (texture->getTexture() & BImage::RAISED) {
198 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 204 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
199 1, height - 3, width - 3, height - 3); 205 1, height - 3, width - 3, height - 3);
200 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 206 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
@@ -204,7 +210,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
204 1, 1, width - 3, 1); 210 1, 1, width - 3, 1);
205 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 211 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
206 1, height - 3, 1, 1); 212 1, height - 3, 1, 1);
207 } else if (texture->getTexture() & BImage_Sunken) { 213 } else if (texture->getTexture() & BImage::SUNKEN) {
208 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 214 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
209 1, height - 3, width - 3, height - 3); 215 1, height - 3, width - 3, height - 3);
210 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 216 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
@@ -229,34 +235,34 @@ Pixmap BImage::render_gradient(BTexture *texture) {
229 int inverted = 0; 235 int inverted = 0;
230 236
231#ifdef INTERLACE 237#ifdef INTERLACE
232 interlaced = texture->getTexture() & BImage_Interlaced; 238 interlaced = texture->getTexture() & BImage::INTERLACED;
233#endif // INTERLACE 239#endif // INTERLACE
234 240
235 if (texture->getTexture() & BImage_Sunken) { 241 if (texture->getTexture() & BImage::SUNKEN) {
236 from = texture->getColorTo(); 242 from = texture->getColorTo();
237 to = texture->getColor(); 243 to = texture->getColor();
238 244
239 if (! (texture->getTexture() & BImage_Invert)) inverted = 1; 245 if (! (texture->getTexture() & BImage::INVERT)) inverted = 1;
240 } else { 246 } else {
241 from = texture->getColor(); 247 from = texture->getColor();
242 to = texture->getColorTo(); 248 to = texture->getColorTo();
243 249
244 if (texture->getTexture() & BImage_Invert) inverted = 1; 250 if (texture->getTexture() & BImage::INVERT) inverted = 1;
245 } 251 }
246 252
247 control->getGradientBuffers(width, height, &xtable, &ytable); 253 control->getGradientBuffers(width, height, &xtable, &ytable);
248 254
249 if (texture->getTexture() & BImage_Diagonal) dgradient(); 255 if (texture->getTexture() & BImage::DIAGONAL) dgradient();
250 else if (texture->getTexture() & BImage_Elliptic) egradient(); 256 else if (texture->getTexture() & BImage::ELLIPTIC) egradient();
251 else if (texture->getTexture() & BImage_Horizontal) hgradient(); 257 else if (texture->getTexture() & BImage::HORIZONTAL) hgradient();
252 else if (texture->getTexture() & BImage_Pyramid) pgradient(); 258 else if (texture->getTexture() & BImage::PYRAMID) pgradient();
253 else if (texture->getTexture() & BImage_Rectangle) rgradient(); 259 else if (texture->getTexture() & BImage::RECTANGLE) rgradient();
254 else if (texture->getTexture() & BImage_Vertical) vgradient(); 260 else if (texture->getTexture() & BImage::VERTICAL) vgradient();
255 else if (texture->getTexture() & BImage_CrossDiagonal) cdgradient(); 261 else if (texture->getTexture() & BImage::CROSSDIAGONAL) cdgradient();
256 else if (texture->getTexture() & BImage_PipeCross) pcgradient(); 262 else if (texture->getTexture() & BImage::PIPECROSS) pcgradient();
257 263
258 if (texture->getTexture() & BImage_Bevel1) bevel1(); 264 if (texture->getTexture() & BImage::BEVEL1) bevel1();
259 else if (texture->getTexture() & BImage_Bevel2) bevel2(); 265 else if (texture->getTexture() & BImage::BEVEL2) bevel2();
260 266
261 if (inverted) invert(); 267 if (inverted) invert();
262 268
@@ -2255,7 +2261,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height,
2255 (it.current()->height == height) && 2261 (it.current()->height == height) &&
2256 (it.current()->texture == texture) && 2262 (it.current()->texture == texture) &&
2257 (it.current()->pixel1 == c1->getPixel())) 2263 (it.current()->pixel1 == c1->getPixel()))
2258 if (texture & BImage_Gradient) { 2264 if (texture & BImage::GRADIENT) {
2259 if (it.current()->pixel2 == c2->getPixel()) { 2265 if (it.current()->pixel2 == c2->getPixel()) {
2260 it.current()->count++; 2266 it.current()->count++;
2261 return it.current()->pixmap; 2267 return it.current()->pixmap;
@@ -2273,7 +2279,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height,
2273 2279
2274Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, 2280Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
2275 BTexture *texture) { 2281 BTexture *texture) {
2276 if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; 2282 if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative;
2277 2283
2278 Pixmap pixmap = searchCache(width, height, texture->getTexture(), 2284 Pixmap pixmap = searchCache(width, height, texture->getTexture(),
2279 texture->getColor(), texture->getColorTo()); 2285 texture->getColor(), texture->getColorTo());
@@ -2292,7 +2298,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
2292 tmp->texture = texture->getTexture(); 2298 tmp->texture = texture->getTexture();
2293 tmp->pixel1 = texture->getColor()->getPixel(); 2299 tmp->pixel1 = texture->getColor()->getPixel();
2294 2300
2295 if (texture->getTexture() & BImage_Gradient) 2301 if (texture->getTexture() & BImage::GRADIENT)
2296 tmp->pixel2 = texture->getColorTo()->getPixel(); 2302 tmp->pixel2 = texture->getColorTo()->getPixel();
2297 else 2303 else
2298 tmp->pixel2 = 0l; 2304 tmp->pixel2 = 0l;
@@ -2502,53 +2508,53 @@ void BImageControl::parseTexture(BTexture *texture, char *t) {
2502 *(ts + i) = tolower(*(t + i)); 2508 *(ts + i) = tolower(*(t + i));
2503 2509
2504 if (strstr(ts, "parentrelative")) { 2510 if (strstr(ts, "parentrelative")) {
2505 texture->setTexture(BImage_ParentRelative); 2511 texture->setTexture(BImage::PARENTRELATIVE);
2506 } else { 2512 } else {
2507 texture->setTexture(0); 2513 texture->setTexture(0);
2508 2514
2509 if (strstr(ts, "solid")) 2515 if (strstr(ts, "solid"))
2510 texture->addTexture(BImage_Solid); 2516 texture->addTexture(BImage::SOLID);
2511 else if (strstr(ts, "gradient")) { 2517 else if (strstr(ts, "gradient")) {
2512 texture->addTexture(BImage_Gradient); 2518 texture->addTexture(BImage::GRADIENT);
2513 if (strstr(ts, "crossdiagonal")) 2519 if (strstr(ts, "crossdiagonal"))
2514 texture->addTexture(BImage_CrossDiagonal); 2520 texture->addTexture(BImage::CROSSDIAGONAL);
2515 else if (strstr(ts, "rectangle")) 2521 else if (strstr(ts, "rectangle"))
2516 texture->addTexture(BImage_Rectangle); 2522 texture->addTexture(BImage::RECTANGLE);
2517 else if (strstr(ts, "pyramid")) 2523 else if (strstr(ts, "pyramid"))
2518 texture->addTexture(BImage_Pyramid); 2524 texture->addTexture(BImage::PYRAMID);
2519 else if (strstr(ts, "pipecross")) 2525 else if (strstr(ts, "pipecross"))
2520 texture->addTexture(BImage_PipeCross); 2526 texture->addTexture(BImage::PIPECROSS);
2521 else if (strstr(ts, "elliptic")) 2527 else if (strstr(ts, "elliptic"))
2522 texture->addTexture(BImage_Elliptic); 2528 texture->addTexture(BImage::ELLIPTIC);
2523 else if (strstr(ts, "diagonal")) 2529 else if (strstr(ts, "diagonal"))
2524 texture->addTexture(BImage_Diagonal); 2530 texture->addTexture(BImage::DIAGONAL);
2525 else if (strstr(ts, "horizontal")) 2531 else if (strstr(ts, "horizontal"))
2526 texture->addTexture(BImage_Horizontal); 2532 texture->addTexture(BImage::HORIZONTAL);
2527 else if (strstr(ts, "vertical")) 2533 else if (strstr(ts, "vertical"))
2528 texture->addTexture(BImage_Vertical); 2534 texture->addTexture(BImage::VERTICAL);
2529 else 2535 else
2530 texture->addTexture(BImage_Diagonal); 2536 texture->addTexture(BImage::DIAGONAL);
2531 } else 2537 } else
2532 texture->addTexture(BImage_Solid); 2538 texture->addTexture(BImage::SOLID);
2533 2539
2534 if (strstr(ts, "raised")) 2540 if (strstr(ts, "raised"))
2535 texture->addTexture(BImage_Raised); 2541 texture->addTexture(BImage::RAISED);
2536 else if (strstr(ts, "sunken")) 2542 else if (strstr(ts, "sunken"))
2537 texture->addTexture(BImage_Sunken); 2543 texture->addTexture(BImage::SUNKEN);
2538 else if (strstr(ts, "flat")) 2544 else if (strstr(ts, "flat"))
2539 texture->addTexture(BImage_Flat); 2545 texture->addTexture(BImage::FLAT);
2540 else 2546 else
2541 texture->addTexture(BImage_Raised); 2547 texture->addTexture(BImage::RAISED);
2542 2548
2543 if (! (texture->getTexture() & BImage_Flat)) 2549 if (! (texture->getTexture() & BImage::FLAT))
2544 if (strstr(ts, "bevel2")) 2550 if (strstr(ts, "bevel2"))
2545 texture->addTexture(BImage_Bevel2); 2551 texture->addTexture(BImage::BEVEL2);
2546 else 2552 else
2547 texture->addTexture(BImage_Bevel1); 2553 texture->addTexture(BImage::BEVEL1);
2548 2554
2549#ifdef INTERLACE 2555#ifdef INTERLACE
2550 if (strstr(ts, "interlaced")) 2556 if (strstr(ts, "interlaced"))
2551 texture->addTexture(BImage_Interlaced); 2557 texture->addTexture(BImage::INTERLACED);
2552#endif // INTERLACE 2558#endif // INTERLACE
2553 } 2559 }
2554 2560