aboutsummaryrefslogtreecommitdiff
path: root/src/Image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Image.cc')
-rw-r--r--src/Image.cc96
1 files changed, 48 insertions, 48 deletions
diff --git a/src/Image.cc b/src/Image.cc
index feebba8..46ee34f 100644
--- a/src/Image.cc
+++ b/src/Image.cc
@@ -109,11 +109,11 @@ BImage::~BImage(void) {
109 109
110 110
111Pixmap BImage::render(BTexture *texture) { 111Pixmap BImage::render(BTexture *texture) {
112 if (texture->getTexture() & BImage_ParentRelative) 112 if (texture->getTexture() & BImage::PARENTRELATIVE)
113 return ParentRelative; 113 return ParentRelative;
114 else if (texture->getTexture() & BImage_Solid) 114 else if (texture->getTexture() & BImage::SOLID)
115 return render_solid(texture); 115 return render_solid(texture);
116 else if (texture->getTexture() & BImage_Gradient) 116 else if (texture->getTexture() & BImage::GRADIENT)
117 return render_gradient(texture); 117 return render_gradient(texture);
118 118
119 return None; 119 return None;
@@ -156,7 +156,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
156 width, height); 156 width, height);
157 157
158#ifdef INTERLACE 158#ifdef INTERLACE
159 if (texture->getTexture() & BImage_Interlaced) { 159 if (texture->getTexture() & BImage::INTERLACED) {
160 gcv.foreground = texture->getColorTo()->getPixel(); 160 gcv.foreground = texture->getColorTo()->getPixel();
161 GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, 161 GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap,
162 GCForeground, &gcv); 162 GCForeground, &gcv);
@@ -171,8 +171,8 @@ Pixmap BImage::render_solid(BTexture *texture) {
171#endif // INTERLACE 171#endif // INTERLACE
172 172
173 173
174 if (texture->getTexture() & BImage_Bevel1) { 174 if (texture->getTexture() & BImage::BEVEL1) {
175 if (texture->getTexture() & BImage_Raised) { 175 if (texture->getTexture() & BImage::RAISED) {
176 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 176 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
177 0, height - 1, width - 1, height - 1); 177 0, height - 1, width - 1, height - 1);
178 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 178 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
@@ -182,7 +182,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
182 0, 0, width - 1, 0); 182 0, 0, width - 1, 0);
183 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 183 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
184 0, height - 1, 0, 0); 184 0, height - 1, 0, 0);
185 } else if (texture->getTexture() & BImage_Sunken) { 185 } else if (texture->getTexture() & BImage::SUNKEN) {
186 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 186 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
187 0, height - 1, width - 1, height - 1); 187 0, height - 1, width - 1, height - 1);
188 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 188 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
@@ -193,8 +193,8 @@ Pixmap BImage::render_solid(BTexture *texture) {
193 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 193 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
194 0, height - 1, 0, 0); 194 0, height - 1, 0, 0);
195 } 195 }
196 } else if (texture->getTexture() & BImage_Bevel2) { 196 } else if (texture->getTexture() & BImage::BEVEL2) {
197 if (texture->getTexture() & BImage_Raised) { 197 if (texture->getTexture() & BImage::RAISED) {
198 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 198 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
199 1, height - 3, width - 3, height - 3); 199 1, height - 3, width - 3, height - 3);
200 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 200 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc,
@@ -204,7 +204,7 @@ Pixmap BImage::render_solid(BTexture *texture) {
204 1, 1, width - 3, 1); 204 1, 1, width - 3, 1);
205 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 205 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
206 1, height - 3, 1, 1); 206 1, height - 3, 1, 1);
207 } else if (texture->getTexture() & BImage_Sunken) { 207 } else if (texture->getTexture() & BImage::SUNKEN) {
208 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 208 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
209 1, height - 3, width - 3, height - 3); 209 1, height - 3, width - 3, height - 3);
210 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 210 XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc,
@@ -229,34 +229,34 @@ Pixmap BImage::render_gradient(BTexture *texture) {
229 int inverted = 0; 229 int inverted = 0;
230 230
231#ifdef INTERLACE 231#ifdef INTERLACE
232 interlaced = texture->getTexture() & BImage_Interlaced; 232 interlaced = texture->getTexture() & BImage::INTERLACED;
233#endif // INTERLACE 233#endif // INTERLACE
234 234
235 if (texture->getTexture() & BImage_Sunken) { 235 if (texture->getTexture() & BImage::SUNKEN) {
236 from = texture->getColorTo(); 236 from = texture->getColorTo();
237 to = texture->getColor(); 237 to = texture->getColor();
238 238
239 if (! (texture->getTexture() & BImage_Invert)) inverted = 1; 239 if (! (texture->getTexture() & BImage::INVERT)) inverted = 1;
240 } else { 240 } else {
241 from = texture->getColor(); 241 from = texture->getColor();
242 to = texture->getColorTo(); 242 to = texture->getColorTo();
243 243
244 if (texture->getTexture() & BImage_Invert) inverted = 1; 244 if (texture->getTexture() & BImage::INVERT) inverted = 1;
245 } 245 }
246 246
247 control->getGradientBuffers(width, height, &xtable, &ytable); 247 control->getGradientBuffers(width, height, &xtable, &ytable);
248 248
249 if (texture->getTexture() & BImage_Diagonal) dgradient(); 249 if (texture->getTexture() & BImage::DIAGONAL) dgradient();
250 else if (texture->getTexture() & BImage_Elliptic) egradient(); 250 else if (texture->getTexture() & BImage::ELLIPTIC) egradient();
251 else if (texture->getTexture() & BImage_Horizontal) hgradient(); 251 else if (texture->getTexture() & BImage::HORIZONTAL) hgradient();
252 else if (texture->getTexture() & BImage_Pyramid) pgradient(); 252 else if (texture->getTexture() & BImage::PYRAMID) pgradient();
253 else if (texture->getTexture() & BImage_Rectangle) rgradient(); 253 else if (texture->getTexture() & BImage::RECTANGLE) rgradient();
254 else if (texture->getTexture() & BImage_Vertical) vgradient(); 254 else if (texture->getTexture() & BImage::VERTICAL) vgradient();
255 else if (texture->getTexture() & BImage_CrossDiagonal) cdgradient(); 255 else if (texture->getTexture() & BImage::CROSSDIAGONAL) cdgradient();
256 else if (texture->getTexture() & BImage_PipeCross) pcgradient(); 256 else if (texture->getTexture() & BImage::PIPECROSS) pcgradient();
257 257
258 if (texture->getTexture() & BImage_Bevel1) bevel1(); 258 if (texture->getTexture() & BImage::BEVEL1) bevel1();
259 else if (texture->getTexture() & BImage_Bevel2) bevel2(); 259 else if (texture->getTexture() & BImage::BEVEL2) bevel2();
260 260
261 if (inverted) invert(); 261 if (inverted) invert();
262 262
@@ -2255,7 +2255,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height,
2255 (it.current()->height == height) && 2255 (it.current()->height == height) &&
2256 (it.current()->texture == texture) && 2256 (it.current()->texture == texture) &&
2257 (it.current()->pixel1 == c1->getPixel())) 2257 (it.current()->pixel1 == c1->getPixel()))
2258 if (texture & BImage_Gradient) { 2258 if (texture & BImage::GRADIENT) {
2259 if (it.current()->pixel2 == c2->getPixel()) { 2259 if (it.current()->pixel2 == c2->getPixel()) {
2260 it.current()->count++; 2260 it.current()->count++;
2261 return it.current()->pixmap; 2261 return it.current()->pixmap;
@@ -2273,7 +2273,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height,
2273 2273
2274Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, 2274Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
2275 BTexture *texture) { 2275 BTexture *texture) {
2276 if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; 2276 if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative;
2277 2277
2278 Pixmap pixmap = searchCache(width, height, texture->getTexture(), 2278 Pixmap pixmap = searchCache(width, height, texture->getTexture(),
2279 texture->getColor(), texture->getColorTo()); 2279 texture->getColor(), texture->getColorTo());
@@ -2292,7 +2292,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
2292 tmp->texture = texture->getTexture(); 2292 tmp->texture = texture->getTexture();
2293 tmp->pixel1 = texture->getColor()->getPixel(); 2293 tmp->pixel1 = texture->getColor()->getPixel();
2294 2294
2295 if (texture->getTexture() & BImage_Gradient) 2295 if (texture->getTexture() & BImage::GRADIENT)
2296 tmp->pixel2 = texture->getColorTo()->getPixel(); 2296 tmp->pixel2 = texture->getColorTo()->getPixel();
2297 else 2297 else
2298 tmp->pixel2 = 0l; 2298 tmp->pixel2 = 0l;
@@ -2502,53 +2502,53 @@ void BImageControl::parseTexture(BTexture *texture, char *t) {
2502 *(ts + i) = tolower(*(t + i)); 2502 *(ts + i) = tolower(*(t + i));
2503 2503
2504 if (strstr(ts, "parentrelative")) { 2504 if (strstr(ts, "parentrelative")) {
2505 texture->setTexture(BImage_ParentRelative); 2505 texture->setTexture(BImage::PARENTRELATIVE);
2506 } else { 2506 } else {
2507 texture->setTexture(0); 2507 texture->setTexture(0);
2508 2508
2509 if (strstr(ts, "solid")) 2509 if (strstr(ts, "solid"))
2510 texture->addTexture(BImage_Solid); 2510 texture->addTexture(BImage::SOLID);
2511 else if (strstr(ts, "gradient")) { 2511 else if (strstr(ts, "gradient")) {
2512 texture->addTexture(BImage_Gradient); 2512 texture->addTexture(BImage::GRADIENT);
2513 if (strstr(ts, "crossdiagonal")) 2513 if (strstr(ts, "crossdiagonal"))
2514 texture->addTexture(BImage_CrossDiagonal); 2514 texture->addTexture(BImage::CROSSDIAGONAL);
2515 else if (strstr(ts, "rectangle")) 2515 else if (strstr(ts, "rectangle"))
2516 texture->addTexture(BImage_Rectangle); 2516 texture->addTexture(BImage::RECTANGLE);
2517 else if (strstr(ts, "pyramid")) 2517 else if (strstr(ts, "pyramid"))
2518 texture->addTexture(BImage_Pyramid); 2518 texture->addTexture(BImage::PYRAMID);
2519 else if (strstr(ts, "pipecross")) 2519 else if (strstr(ts, "pipecross"))
2520 texture->addTexture(BImage_PipeCross); 2520 texture->addTexture(BImage::PIPECROSS);
2521 else if (strstr(ts, "elliptic")) 2521 else if (strstr(ts, "elliptic"))
2522 texture->addTexture(BImage_Elliptic); 2522 texture->addTexture(BImage::ELLIPTIC);
2523 else if (strstr(ts, "diagonal")) 2523 else if (strstr(ts, "diagonal"))
2524 texture->addTexture(BImage_Diagonal); 2524 texture->addTexture(BImage::DIAGONAL);
2525 else if (strstr(ts, "horizontal")) 2525 else if (strstr(ts, "horizontal"))
2526 texture->addTexture(BImage_Horizontal); 2526 texture->addTexture(BImage::HORIZONTAL);
2527 else if (strstr(ts, "vertical")) 2527 else if (strstr(ts, "vertical"))
2528 texture->addTexture(BImage_Vertical); 2528 texture->addTexture(BImage::VERTICAL);
2529 else 2529 else
2530 texture->addTexture(BImage_Diagonal); 2530 texture->addTexture(BImage::DIAGONAL);
2531 } else 2531 } else
2532 texture->addTexture(BImage_Solid); 2532 texture->addTexture(BImage::SOLID);
2533 2533
2534 if (strstr(ts, "raised")) 2534 if (strstr(ts, "raised"))
2535 texture->addTexture(BImage_Raised); 2535 texture->addTexture(BImage::RAISED);
2536 else if (strstr(ts, "sunken")) 2536 else if (strstr(ts, "sunken"))
2537 texture->addTexture(BImage_Sunken); 2537 texture->addTexture(BImage::SUNKEN);
2538 else if (strstr(ts, "flat")) 2538 else if (strstr(ts, "flat"))
2539 texture->addTexture(BImage_Flat); 2539 texture->addTexture(BImage::FLAT);
2540 else 2540 else
2541 texture->addTexture(BImage_Raised); 2541 texture->addTexture(BImage::RAISED);
2542 2542
2543 if (! (texture->getTexture() & BImage_Flat)) 2543 if (! (texture->getTexture() & BImage::FLAT))
2544 if (strstr(ts, "bevel2")) 2544 if (strstr(ts, "bevel2"))
2545 texture->addTexture(BImage_Bevel2); 2545 texture->addTexture(BImage::BEVEL2);
2546 else 2546 else
2547 texture->addTexture(BImage_Bevel1); 2547 texture->addTexture(BImage::BEVEL1);
2548 2548
2549#ifdef INTERLACE 2549#ifdef INTERLACE
2550 if (strstr(ts, "interlaced")) 2550 if (strstr(ts, "interlaced"))
2551 texture->addTexture(BImage_Interlaced); 2551 texture->addTexture(BImage::INTERLACED);
2552#endif // INTERLACE 2552#endif // INTERLACE
2553 } 2553 }
2554 2554