diff options
author | fluxgen <fluxgen> | 2002-09-14 13:52:08 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-09-14 13:52:08 (GMT) |
commit | 0ef79074e1465284020cf96b0aad8316fe0ebe25 (patch) | |
tree | de56c078a6004dae018bb2ccf8e1845e70c437b0 /src | |
parent | deaaaf1c72265af5e90969c7171093faf9d29cbb (diff) | |
download | fluxbox-0ef79074e1465284020cf96b0aad8316fe0ebe25.zip fluxbox-0ef79074e1465284020cf96b0aad8316fe0ebe25.tar.bz2 |
moved color parsing allocation to FbTk Color
Diffstat (limited to 'src')
-rw-r--r-- | src/Image.cc | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/src/Image.cc b/src/Image.cc index fbc20b1..0387304 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.13 2002/08/11 20:44:48 fluxgen Exp $ | 25 | // $Id: Image.cc,v 1.14 2002/09/14 13:52:08 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -2309,29 +2309,6 @@ void BImageControl::removeImage(Pixmap pixmap) { | |||
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | 2311 | ||
2312 | unsigned long BImageControl::color(const char *colorname, | ||
2313 | unsigned char *r, unsigned char *g, | ||
2314 | unsigned char *b) | ||
2315 | { | ||
2316 | XColor color; | ||
2317 | color.pixel = 0; | ||
2318 | |||
2319 | if (! XParseColor(basedisplay->getXDisplay(), colormap(), colorname, &color)) | ||
2320 | fprintf(stderr, "BImageControl::color: color parse error: \"%s\"\n", | ||
2321 | colorname); | ||
2322 | else if (! XAllocColor(basedisplay->getXDisplay(), colormap(), &color)) | ||
2323 | fprintf(stderr, "BImageControl::color: color alloc error: \"%s\"\n", | ||
2324 | colorname); | ||
2325 | |||
2326 | if (color.red == 65535) *r = 0xff; | ||
2327 | else *r = (unsigned char) (color.red / 0xff); | ||
2328 | if (color.green == 65535) *g = 0xff; | ||
2329 | else *g = (unsigned char) (color.green / 0xff); | ||
2330 | if (color.blue == 65535) *b = 0xff; | ||
2331 | else *b = (unsigned char) (color.blue / 0xff); | ||
2332 | |||
2333 | return color.pixel; | ||
2334 | } | ||
2335 | 2312 | ||
2336 | 2313 | ||
2337 | unsigned long BImageControl::color(const char *colorname) { | 2314 | unsigned long BImageControl::color(const char *colorname) { |
@@ -2522,29 +2499,6 @@ void BImageControl::parseTexture(FbTk::Texture *texture, const char *texture_str | |||
2522 | } | 2499 | } |
2523 | 2500 | ||
2524 | 2501 | ||
2525 | void BImageControl::parseColor(FbTk::Color *col, const char *color_string) { | ||
2526 | if (!col) return; | ||
2527 | |||
2528 | if (col->isAllocated()) { | ||
2529 | unsigned long pixel = col->pixel(); | ||
2530 | |||
2531 | XFreeColors(basedisplay->getXDisplay(), colormap(), &pixel, 1, 0); | ||
2532 | |||
2533 | col->setPixel(0l); | ||
2534 | col->setRGB(0, 0, 0); | ||
2535 | col->setAllocated(false); | ||
2536 | } | ||
2537 | |||
2538 | if (color_string != 0) { | ||
2539 | unsigned char r, g, b; | ||
2540 | |||
2541 | col->setPixel(color(color_string, &r, &g, &b)); | ||
2542 | col->setRGB(r, g, b); | ||
2543 | col->setAllocated(true); | ||
2544 | } | ||
2545 | } | ||
2546 | |||
2547 | |||
2548 | void BImageControl::timeout() { | 2502 | void BImageControl::timeout() { |
2549 | CacheList::iterator it = cache.begin(); | 2503 | CacheList::iterator it = cache.begin(); |
2550 | CacheList::iterator it_end = cache.end(); | 2504 | CacheList::iterator it_end = cache.end(); |