From e0dce8166ca9406a50e908569bb294ce57a76b7f Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 29 Dec 2001 10:27:41 +0000 Subject: Updated texture constants --- src/Image.cc | 96 +++++++++++++++++++++++++++++------------------------------ src/Image.hh | 66 +++++++++++++++++----------------------- src/Window.cc | 22 +++++++------- 3 files changed, 87 insertions(+), 97 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) { Pixmap BImage::render(BTexture *texture) { - if (texture->getTexture() & BImage_ParentRelative) + if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative; - else if (texture->getTexture() & BImage_Solid) + else if (texture->getTexture() & BImage::SOLID) return render_solid(texture); - else if (texture->getTexture() & BImage_Gradient) + else if (texture->getTexture() & BImage::GRADIENT) return render_gradient(texture); return None; @@ -156,7 +156,7 @@ Pixmap BImage::render_solid(BTexture *texture) { width, height); #ifdef INTERLACE - if (texture->getTexture() & BImage_Interlaced) { + if (texture->getTexture() & BImage::INTERLACED) { gcv.foreground = texture->getColorTo()->getPixel(); GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, GCForeground, &gcv); @@ -171,8 +171,8 @@ Pixmap BImage::render_solid(BTexture *texture) { #endif // INTERLACE - if (texture->getTexture() & BImage_Bevel1) { - if (texture->getTexture() & BImage_Raised) { + if (texture->getTexture() & BImage::BEVEL1) { + if (texture->getTexture() & BImage::RAISED) { XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 0, height - 1, width - 1, height - 1); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, @@ -182,7 +182,7 @@ Pixmap BImage::render_solid(BTexture *texture) { 0, 0, width - 1, 0); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 0, height - 1, 0, 0); - } else if (texture->getTexture() & BImage_Sunken) { + } else if (texture->getTexture() & BImage::SUNKEN) { XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 0, height - 1, width - 1, height - 1); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, @@ -193,8 +193,8 @@ Pixmap BImage::render_solid(BTexture *texture) { XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 0, height - 1, 0, 0); } - } else if (texture->getTexture() & BImage_Bevel2) { - if (texture->getTexture() & BImage_Raised) { + } else if (texture->getTexture() & BImage::BEVEL2) { + if (texture->getTexture() & BImage::RAISED) { XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, 1, height - 3, width - 3, height - 3); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, lgc, @@ -204,7 +204,7 @@ Pixmap BImage::render_solid(BTexture *texture) { 1, 1, width - 3, 1); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 1, height - 3, 1, 1); - } else if (texture->getTexture() & BImage_Sunken) { + } else if (texture->getTexture() & BImage::SUNKEN) { XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, 1, height - 3, width - 3, height - 3); XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, hgc, @@ -229,34 +229,34 @@ Pixmap BImage::render_gradient(BTexture *texture) { int inverted = 0; #ifdef INTERLACE - interlaced = texture->getTexture() & BImage_Interlaced; + interlaced = texture->getTexture() & BImage::INTERLACED; #endif // INTERLACE - if (texture->getTexture() & BImage_Sunken) { + if (texture->getTexture() & BImage::SUNKEN) { from = texture->getColorTo(); to = texture->getColor(); - if (! (texture->getTexture() & BImage_Invert)) inverted = 1; + if (! (texture->getTexture() & BImage::INVERT)) inverted = 1; } else { from = texture->getColor(); to = texture->getColorTo(); - if (texture->getTexture() & BImage_Invert) inverted = 1; + if (texture->getTexture() & BImage::INVERT) inverted = 1; } control->getGradientBuffers(width, height, &xtable, &ytable); - if (texture->getTexture() & BImage_Diagonal) dgradient(); - else if (texture->getTexture() & BImage_Elliptic) egradient(); - else if (texture->getTexture() & BImage_Horizontal) hgradient(); - else if (texture->getTexture() & BImage_Pyramid) pgradient(); - else if (texture->getTexture() & BImage_Rectangle) rgradient(); - else if (texture->getTexture() & BImage_Vertical) vgradient(); - else if (texture->getTexture() & BImage_CrossDiagonal) cdgradient(); - else if (texture->getTexture() & BImage_PipeCross) pcgradient(); + if (texture->getTexture() & BImage::DIAGONAL) dgradient(); + else if (texture->getTexture() & BImage::ELLIPTIC) egradient(); + else if (texture->getTexture() & BImage::HORIZONTAL) hgradient(); + else if (texture->getTexture() & BImage::PYRAMID) pgradient(); + else if (texture->getTexture() & BImage::RECTANGLE) rgradient(); + else if (texture->getTexture() & BImage::VERTICAL) vgradient(); + else if (texture->getTexture() & BImage::CROSSDIAGONAL) cdgradient(); + else if (texture->getTexture() & BImage::PIPECROSS) pcgradient(); - if (texture->getTexture() & BImage_Bevel1) bevel1(); - else if (texture->getTexture() & BImage_Bevel2) bevel2(); + if (texture->getTexture() & BImage::BEVEL1) bevel1(); + else if (texture->getTexture() & BImage::BEVEL2) bevel2(); if (inverted) invert(); @@ -2255,7 +2255,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, (it.current()->height == height) && (it.current()->texture == texture) && (it.current()->pixel1 == c1->getPixel())) - if (texture & BImage_Gradient) { + if (texture & BImage::GRADIENT) { if (it.current()->pixel2 == c2->getPixel()) { it.current()->count++; return it.current()->pixmap; @@ -2273,7 +2273,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, BTexture *texture) { - if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; + if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative; Pixmap pixmap = searchCache(width, height, texture->getTexture(), texture->getColor(), texture->getColorTo()); @@ -2292,7 +2292,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, tmp->texture = texture->getTexture(); tmp->pixel1 = texture->getColor()->getPixel(); - if (texture->getTexture() & BImage_Gradient) + if (texture->getTexture() & BImage::GRADIENT) tmp->pixel2 = texture->getColorTo()->getPixel(); else tmp->pixel2 = 0l; @@ -2502,53 +2502,53 @@ void BImageControl::parseTexture(BTexture *texture, char *t) { *(ts + i) = tolower(*(t + i)); if (strstr(ts, "parentrelative")) { - texture->setTexture(BImage_ParentRelative); + texture->setTexture(BImage::PARENTRELATIVE); } else { texture->setTexture(0); if (strstr(ts, "solid")) - texture->addTexture(BImage_Solid); + texture->addTexture(BImage::SOLID); else if (strstr(ts, "gradient")) { - texture->addTexture(BImage_Gradient); + texture->addTexture(BImage::GRADIENT); if (strstr(ts, "crossdiagonal")) - texture->addTexture(BImage_CrossDiagonal); + texture->addTexture(BImage::CROSSDIAGONAL); else if (strstr(ts, "rectangle")) - texture->addTexture(BImage_Rectangle); + texture->addTexture(BImage::RECTANGLE); else if (strstr(ts, "pyramid")) - texture->addTexture(BImage_Pyramid); + texture->addTexture(BImage::PYRAMID); else if (strstr(ts, "pipecross")) - texture->addTexture(BImage_PipeCross); + texture->addTexture(BImage::PIPECROSS); else if (strstr(ts, "elliptic")) - texture->addTexture(BImage_Elliptic); + texture->addTexture(BImage::ELLIPTIC); else if (strstr(ts, "diagonal")) - texture->addTexture(BImage_Diagonal); + texture->addTexture(BImage::DIAGONAL); else if (strstr(ts, "horizontal")) - texture->addTexture(BImage_Horizontal); + texture->addTexture(BImage::HORIZONTAL); else if (strstr(ts, "vertical")) - texture->addTexture(BImage_Vertical); + texture->addTexture(BImage::VERTICAL); else - texture->addTexture(BImage_Diagonal); + texture->addTexture(BImage::DIAGONAL); } else - texture->addTexture(BImage_Solid); + texture->addTexture(BImage::SOLID); if (strstr(ts, "raised")) - texture->addTexture(BImage_Raised); + texture->addTexture(BImage::RAISED); else if (strstr(ts, "sunken")) - texture->addTexture(BImage_Sunken); + texture->addTexture(BImage::SUNKEN); else if (strstr(ts, "flat")) - texture->addTexture(BImage_Flat); + texture->addTexture(BImage::FLAT); else - texture->addTexture(BImage_Raised); + texture->addTexture(BImage::RAISED); - if (! (texture->getTexture() & BImage_Flat)) + if (! (texture->getTexture() & BImage::FLAT)) if (strstr(ts, "bevel2")) - texture->addTexture(BImage_Bevel2); + texture->addTexture(BImage::BEVEL2); else - texture->addTexture(BImage_Bevel1); + texture->addTexture(BImage::BEVEL1); #ifdef INTERLACE if (strstr(ts, "interlaced")) - texture->addTexture(BImage_Interlaced); + texture->addTexture(BImage::INTERLACED); #endif // INTERLACE } diff --git a/src/Image.hh b/src/Image.hh index 3811e69..a86a60a 100644 --- a/src/Image.hh +++ b/src/Image.hh @@ -27,6 +27,13 @@ #include "Timer.hh" +#ifndef _BASEDISPLAY_HH_ +#include "BaseDisplay.hh" +#endif +#ifndef _LINKEDLIST_HH_ +#include "LinkedList.hh" +#endif + class BImage; class BImageControl; @@ -75,43 +82,6 @@ public: }; -// bevel options -#define BImage_Flat (1l<<1) -#define BImage_Sunken (1l<<2) -#define BImage_Raised (1l<<3) - -// textures -#define BImage_Solid (1l<<4) -#define BImage_Gradient (1l<<5) - -// gradients -#define BImage_Horizontal (1l<<6) -#define BImage_Vertical (1l<<7) -#define BImage_Diagonal (1l<<8) -#define BImage_CrossDiagonal (1l<<9) -#define BImage_Rectangle (1l<<10) -#define BImage_Pyramid (1l<<11) -#define BImage_PipeCross (1l<<12) -#define BImage_Elliptic (1l<<13) - -// bevel types -#define BImage_Bevel1 (1l<<14) -#define BImage_Bevel2 (1l<<15) - -// inverted image -#define BImage_Invert (1l<<16) - -// parent relative image -#define BImage_ParentRelative (1l<<17) - -#ifdef INTERLACE -// fake interlaced image -# define BImage_Interlaced (1l<<18) -#endif // INTERLACE - -#include "BaseDisplay.hh" -#include "LinkedList.hh" - class BImage { private: @@ -149,7 +119,27 @@ protected: public: - BImage(BImageControl *, unsigned int, unsigned int); + enum Bevel{FLAT=0x00002, SUNKEN=0x00004, RAISED=0x00008}; + enum Textures{SOLID=0x00010, GRADIENT=0x00020}; + enum Gradients{ + HORIZONTAL=0x00040, + VERTICAL=0x00080, + DIAGONAL=0x00100, + CROSSDIAGONAL=0x00200, + RECTANGLE=0x00400, + PYRAMID=0x00800, + PIPECROSS=0x01000, + ELLIPTIC=0x02000 + }; + + enum { + BEVEL1=0x04000, BEVEL2=0x08000, // bevel types + INVERT=0x010000, //inverted image + PARENTRELATIVE=0x20000, + INTERLACED=0x40000 + }; + + BImage(BImageControl *, unsigned int, unsigned int); ~BImage(void); Pixmap render(BTexture *); diff --git a/src/Window.cc b/src/Window.cc index a99c9a6..6cccec7 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -707,7 +707,7 @@ void FluxboxWindow::decorate(void) { Pixmap tmp = frame.fbutton; BTexture *texture = &(screen->getWindowStyle()->b_focus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.fbutton = None; frame.fbutton_pixel = texture->getColor()->getPixel(); } else @@ -717,7 +717,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.ubutton; texture = &(screen->getWindowStyle()->b_unfocus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.ubutton = None; frame.ubutton_pixel = texture->getColor()->getPixel(); } else @@ -727,7 +727,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.pbutton; texture = &(screen->getWindowStyle()->b_pressed); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.pbutton = None; frame.pbutton_pixel = texture->getColor()->getPixel(); } else @@ -738,7 +738,7 @@ void FluxboxWindow::decorate(void) { if (decorations.titlebar) { tmp = frame.ftitle; texture = &(screen->getWindowStyle()->t_focus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.ftitle = None; frame.ftitle_pixel = texture->getColor()->getPixel(); } else @@ -750,7 +750,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.utitle; texture = &(screen->getWindowStyle()->t_unfocus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.utitle = None; frame.utitle_pixel = texture->getColor()->getPixel(); } else @@ -773,7 +773,7 @@ void FluxboxWindow::decorate(void) { if (decorations.handle) { tmp = frame.fhandle; texture = &(screen->getWindowStyle()->h_focus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.fhandle = None; frame.fhandle_pixel = texture->getColor()->getPixel(); } else @@ -783,7 +783,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.uhandle; texture = &(screen->getWindowStyle()->h_unfocus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.uhandle = None; frame.uhandle_pixel = texture->getColor()->getPixel(); } else @@ -794,7 +794,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.fgrip; texture = &(screen->getWindowStyle()->g_focus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.fgrip = None; frame.fgrip_pixel = texture->getColor()->getPixel(); } else @@ -805,7 +805,7 @@ void FluxboxWindow::decorate(void) { tmp = frame.ugrip; texture = &(screen->getWindowStyle()->g_unfocus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.ugrip = None; frame.ugrip_pixel = texture->getColor()->getPixel(); } else @@ -829,7 +829,7 @@ void FluxboxWindow::decorate(void) { void FluxboxWindow::decorateLabel(void) { Pixmap tmp = frame.flabel; BTexture *texture = &(screen->getWindowStyle()->l_focus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.flabel = None; frame.flabel_pixel = texture->getColor()->getPixel(); } else @@ -839,7 +839,7 @@ void FluxboxWindow::decorateLabel(void) { tmp = frame.ulabel; texture = &(screen->getWindowStyle()->l_unfocus); - if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { + if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { frame.ulabel = None; frame.ulabel_pixel = texture->getColor()->getPixel(); } else -- cgit v0.11.2