diff options
author | fluxgen <fluxgen> | 2002-09-15 09:42:00 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-09-15 09:42:00 (GMT) |
commit | fef994fa14dcbe41c6e94f140e7ab8e6300f4619 (patch) | |
tree | a63211843304383aea2a7bf28775c8d304fe1099 | |
parent | 2fe21974f404134c8128e032838bbd761590256e (diff) | |
download | fluxbox_pavel-fef994fa14dcbe41c6e94f140e7ab8e6300f4619.zip fluxbox_pavel-fef994fa14dcbe41c6e94f140e7ab8e6300f4619.tar.bz2 |
removed parseTexture
-rw-r--r-- | src/Image.cc | 101 | ||||
-rw-r--r-- | src/Image.hh | 3 |
2 files changed, 17 insertions, 87 deletions
diff --git a/src/Image.cc b/src/Image.cc index 3d73374..3574679 100644 --- a/src/Image.cc +++ b/src/Image.cc | |||
@@ -22,7 +22,7 @@ | |||
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.cc,v 1.15 2002/09/14 15:05:00 fluxgen Exp $ | 25 | // $Id: Image.cc,v 1.16 2002/09/15 09:42:00 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -115,7 +115,7 @@ BImage::BImage(BImageControl *c, unsigned int w, unsigned int h) { | |||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | BImage::~BImage(void) { | 118 | BImage::~BImage() { |
119 | if (red) delete [] red; | 119 | if (red) delete [] red; |
120 | if (green) delete [] green; | 120 | if (green) delete [] green; |
121 | if (blue) delete [] blue; | 121 | if (blue) delete [] blue; |
@@ -293,7 +293,7 @@ Pixmap BImage::renderGradient(const FbTk::Texture *texture) { | |||
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | XImage *BImage::renderXImage(void) { | 296 | XImage *BImage::renderXImage() { |
297 | I18n *i18n = I18n::instance(); | 297 | I18n *i18n = I18n::instance(); |
298 | XImage *image = | 298 | XImage *image = |
299 | XCreateImage(control->baseDisplay()->getXDisplay(), | 299 | XCreateImage(control->baseDisplay()->getXDisplay(), |
@@ -696,7 +696,7 @@ XImage *BImage::renderXImage(void) { | |||
696 | } | 696 | } |
697 | 697 | ||
698 | 698 | ||
699 | Pixmap BImage::renderPixmap(void) { | 699 | Pixmap BImage::renderPixmap() { |
700 | I18n *i18n = I18n::instance(); | 700 | I18n *i18n = I18n::instance(); |
701 | Pixmap pixmap = | 701 | Pixmap pixmap = |
702 | XCreatePixmap(control->baseDisplay()->getXDisplay(), | 702 | XCreatePixmap(control->baseDisplay()->getXDisplay(), |
@@ -737,7 +737,7 @@ Pixmap BImage::renderPixmap(void) { | |||
737 | } | 737 | } |
738 | 738 | ||
739 | 739 | ||
740 | void BImage::bevel1(void) { | 740 | void BImage::bevel1() { |
741 | if (width > 2 && height > 2) { | 741 | if (width > 2 && height > 2) { |
742 | unsigned char *pr = red, *pg = green, *pb = blue; | 742 | unsigned char *pr = red, *pg = green, *pb = blue; |
743 | 743 | ||
@@ -875,7 +875,7 @@ void BImage::bevel1(void) { | |||
875 | } | 875 | } |
876 | 876 | ||
877 | 877 | ||
878 | void BImage::bevel2(void) { | 878 | void BImage::bevel2() { |
879 | if (width > 4 && height > 4) { | 879 | if (width > 4 && height > 4) { |
880 | unsigned char r, g, b, rr ,gg ,bb, *pr = red + width + 1, | 880 | unsigned char r, g, b, rr ,gg ,bb, *pr = red + width + 1, |
881 | *pg = green + width + 1, *pb = blue + width + 1; | 881 | *pg = green + width + 1, *pb = blue + width + 1; |
@@ -954,7 +954,7 @@ void BImage::bevel2(void) { | |||
954 | } | 954 | } |
955 | 955 | ||
956 | 956 | ||
957 | void BImage::invert(void) { | 957 | void BImage::invert() { |
958 | register unsigned int i, j, wh = (width * height) - 1; | 958 | register unsigned int i, j, wh = (width * height) - 1; |
959 | unsigned char tmp; | 959 | unsigned char tmp; |
960 | 960 | ||
@@ -1082,7 +1082,7 @@ void BImage::dgradient() { | |||
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | 1084 | ||
1085 | void BImage::hgradient(void) { | 1085 | void BImage::hgradient() { |
1086 | float drx, dgx, dbx, | 1086 | float drx, dgx, dbx, |
1087 | xr = (float) from->red(), | 1087 | xr = (float) from->red(), |
1088 | xg = (float) from->green(), | 1088 | xg = (float) from->green(), |
@@ -1181,7 +1181,7 @@ void BImage::hgradient(void) { | |||
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | 1183 | ||
1184 | void BImage::vgradient(void) { | 1184 | void BImage::vgradient() { |
1185 | float dry, dgy, dby, | 1185 | float dry, dgy, dby, |
1186 | yr = (float) from->red(), | 1186 | yr = (float) from->red(), |
1187 | yg = (float) from->green(), | 1187 | yg = (float) from->green(), |
@@ -1261,7 +1261,7 @@ void BImage::vgradient(void) { | |||
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | 1263 | ||
1264 | void BImage::pgradient(void) { | 1264 | void BImage::pgradient() { |
1265 | // pyramid gradient - based on original dgradient, written by | 1265 | // pyramid gradient - based on original dgradient, written by |
1266 | // Mosfet (mosfet@kde.org) | 1266 | // Mosfet (mosfet@kde.org) |
1267 | // adapted from kde sources for Blackbox by Brad Hughes | 1267 | // adapted from kde sources for Blackbox by Brad Hughes |
@@ -1378,7 +1378,7 @@ void BImage::pgradient(void) { | |||
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | 1380 | ||
1381 | void BImage::rgradient(void) { | 1381 | void BImage::rgradient() { |
1382 | // rectangle gradient - based on original dgradient, written by | 1382 | // rectangle gradient - based on original dgradient, written by |
1383 | // Mosfet (mosfet@kde.org) | 1383 | // Mosfet (mosfet@kde.org) |
1384 | // adapted from kde sources for Blackbox by Brad Hughes | 1384 | // adapted from kde sources for Blackbox by Brad Hughes |
@@ -1494,7 +1494,7 @@ void BImage::rgradient(void) { | |||
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | 1496 | ||
1497 | void BImage::egradient(void) { | 1497 | void BImage::egradient() { |
1498 | // elliptic gradient - based on original dgradient, written by | 1498 | // elliptic gradient - based on original dgradient, written by |
1499 | // Mosfet (mosfet@kde.org) | 1499 | // Mosfet (mosfet@kde.org) |
1500 | // adapted from kde sources for Blackbox by Brad Hughes | 1500 | // adapted from kde sources for Blackbox by Brad Hughes |
@@ -1621,7 +1621,7 @@ void BImage::egradient(void) { | |||
1621 | } | 1621 | } |
1622 | 1622 | ||
1623 | 1623 | ||
1624 | void BImage::pcgradient(void) { | 1624 | void BImage::pcgradient() { |
1625 | // pipe cross gradient - based on original dgradient, written by | 1625 | // pipe cross gradient - based on original dgradient, written by |
1626 | // Mosfet (mosfet@kde.org) | 1626 | // Mosfet (mosfet@kde.org) |
1627 | // adapted from kde sources for Blackbox by Brad Hughes | 1627 | // adapted from kde sources for Blackbox by Brad Hughes |
@@ -1739,7 +1739,7 @@ void BImage::pcgradient(void) { | |||
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | 1741 | ||
1742 | void BImage::cdgradient(void) { | 1742 | void BImage::cdgradient() { |
1743 | // cross diagonal gradient - based on original dgradient, written by | 1743 | // cross diagonal gradient - based on original dgradient, written by |
1744 | // Mosfet (mosfet@kde.org) | 1744 | // Mosfet (mosfet@kde.org) |
1745 | // adapted from kde sources for Blackbox by Brad Hughes | 1745 | // adapted from kde sources for Blackbox by Brad Hughes |
@@ -2169,7 +2169,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither, | |||
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | 2171 | ||
2172 | BImageControl::~BImageControl(void) { | 2172 | BImageControl::~BImageControl() { |
2173 | if (sqrt_table) { | 2173 | if (sqrt_table) { |
2174 | delete [] sqrt_table; | 2174 | delete [] sqrt_table; |
2175 | } | 2175 | } |
@@ -2240,6 +2240,7 @@ Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, | |||
2240 | 2240 | ||
2241 | Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, | 2241 | Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, |
2242 | const FbTk::Texture *texture) { | 2242 | const FbTk::Texture *texture) { |
2243 | |||
2243 | if (texture->type() & FbTk::Texture::PARENTRELATIVE) | 2244 | if (texture->type() & FbTk::Texture::PARENTRELATIVE) |
2244 | return ParentRelative; | 2245 | return ParentRelative; |
2245 | 2246 | ||
@@ -2409,76 +2410,6 @@ unsigned long BImageControl::getSqrt(unsigned int x) { | |||
2409 | return (*(sqrt_table + x)); | 2410 | return (*(sqrt_table + x)); |
2410 | } | 2411 | } |
2411 | 2412 | ||
2412 | |||
2413 | void BImageControl::parseTexture(FbTk::Texture *texture, const char *texture_string) { | ||
2414 | if ((! texture) || (! texture_string)) | ||
2415 | return; | ||
2416 | |||
2417 | int t_len = strlen(texture_string) + 1; | ||
2418 | char *ts = new char[t_len]; | ||
2419 | if (! ts) return; | ||
2420 | |||
2421 | // convert to lower case | ||
2422 | for (int byte_pos = 0; byte_pos < t_len; byte_pos++) | ||
2423 | *(ts + byte_pos) = tolower(*(texture_string + byte_pos)); | ||
2424 | |||
2425 | using namespace FbTk; | ||
2426 | |||
2427 | if (strstr(ts, "parentrelative")) { | ||
2428 | texture->setType(Texture::PARENTRELATIVE); | ||
2429 | } else { | ||
2430 | texture->setType(Texture::NONE); | ||
2431 | |||
2432 | if (strstr(ts, "solid")) | ||
2433 | texture->addType(Texture::SOLID); | ||
2434 | else if (strstr(ts, "gradient")) { | ||
2435 | texture->addType(Texture::GRADIENT); | ||
2436 | if (strstr(ts, "crossdiagonal")) | ||
2437 | texture->addType(Texture::CROSSDIAGONAL); | ||
2438 | else if (strstr(ts, "rectangle")) | ||
2439 | texture->addType(Texture::RECTANGLE); | ||
2440 | else if (strstr(ts, "pyramid")) | ||
2441 | texture->addType(Texture::PYRAMID); | ||
2442 | else if (strstr(ts, "pipecross")) | ||
2443 | texture->addType(Texture::PIPECROSS); | ||
2444 | else if (strstr(ts, "elliptic")) | ||
2445 | texture->addType(Texture::ELLIPTIC); | ||
2446 | else if (strstr(ts, "diagonal")) | ||
2447 | texture->addType(Texture::DIAGONAL); | ||
2448 | else if (strstr(ts, "horizontal")) | ||
2449 | texture->addType(Texture::HORIZONTAL); | ||
2450 | else if (strstr(ts, "vertical")) | ||
2451 | texture->addType(Texture::VERTICAL); | ||
2452 | else | ||
2453 | texture->addType(Texture::DIAGONAL); | ||
2454 | } else | ||
2455 | texture->addType(Texture::SOLID); | ||
2456 | |||
2457 | if (strstr(ts, "raised")) | ||
2458 | texture->addType(Texture::RAISED); | ||
2459 | else if (strstr(ts, "sunken")) | ||
2460 | texture->addType(Texture::SUNKEN); | ||
2461 | else if (strstr(ts, "flat")) | ||
2462 | texture->addType(Texture::FLAT); | ||
2463 | else | ||
2464 | texture->addType(Texture::RAISED); | ||
2465 | |||
2466 | if (! (texture->type() & Texture::FLAT)) | ||
2467 | if (strstr(ts, "bevel2")) | ||
2468 | texture->addType(Texture::BEVEL2); | ||
2469 | else | ||
2470 | texture->addType(Texture::BEVEL1); | ||
2471 | |||
2472 | #ifdef INTERLACE | ||
2473 | if (strstr(ts, "interlaced")) | ||
2474 | texture->addType(Texture::INTERLACED); | ||
2475 | #endif // INTERLACE | ||
2476 | } | ||
2477 | |||
2478 | delete [] ts; | ||
2479 | } | ||
2480 | |||
2481 | |||
2482 | void BImageControl::timeout() { | 2413 | void BImageControl::timeout() { |
2483 | CacheList::iterator it = cache.begin(); | 2414 | CacheList::iterator it = cache.begin(); |
2484 | CacheList::iterator it_end = cache.end(); | 2415 | CacheList::iterator it_end = cache.end(); |
diff --git a/src/Image.hh b/src/Image.hh index 8ae8505..c352028 100644 --- a/src/Image.hh +++ b/src/Image.hh | |||
@@ -22,7 +22,7 @@ | |||
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.13 2002/09/14 15:03:32 fluxgen Exp $ | 25 | // $Id: Image.hh,v 1.14 2002/09/15 09:41:24 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef IMAGE_HH | 27 | #ifndef IMAGE_HH |
28 | #define IMAGE_HH | 28 | #define IMAGE_HH |
@@ -140,7 +140,6 @@ public: | |||
140 | unsigned int **, unsigned int **); | 140 | unsigned int **, unsigned int **); |
141 | void setDither(bool d) { dither = d; } | 141 | void setDither(bool d) { dither = d; } |
142 | void setColorsPerChannel(int cpc); | 142 | void setColorsPerChannel(int cpc); |
143 | void parseTexture(FbTk::Texture *ret_texture, const char *sval); | ||
144 | 143 | ||
145 | virtual void timeout(); | 144 | virtual void timeout(); |
146 | 145 | ||