From 0ef79074e1465284020cf96b0aad8316fe0ebe25 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 14 Sep 2002 13:52:08 +0000 Subject: moved color parsing allocation to FbTk Color --- src/Image.cc | 48 +----------------------------------------------- 1 file changed, 1 insertion(+), 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Image.cc,v 1.13 2002/08/11 20:44:48 fluxgen Exp $ +// $Id: Image.cc,v 1.14 2002/09/14 13:52:08 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -2309,29 +2309,6 @@ void BImageControl::removeImage(Pixmap pixmap) { } -unsigned long BImageControl::color(const char *colorname, - unsigned char *r, unsigned char *g, - unsigned char *b) -{ - XColor color; - color.pixel = 0; - - if (! XParseColor(basedisplay->getXDisplay(), colormap(), colorname, &color)) - fprintf(stderr, "BImageControl::color: color parse error: \"%s\"\n", - colorname); - else if (! XAllocColor(basedisplay->getXDisplay(), colormap(), &color)) - fprintf(stderr, "BImageControl::color: color alloc error: \"%s\"\n", - colorname); - - if (color.red == 65535) *r = 0xff; - else *r = (unsigned char) (color.red / 0xff); - if (color.green == 65535) *g = 0xff; - else *g = (unsigned char) (color.green / 0xff); - if (color.blue == 65535) *b = 0xff; - else *b = (unsigned char) (color.blue / 0xff); - - return color.pixel; -} unsigned long BImageControl::color(const char *colorname) { @@ -2522,29 +2499,6 @@ void BImageControl::parseTexture(FbTk::Texture *texture, const char *texture_str } -void BImageControl::parseColor(FbTk::Color *col, const char *color_string) { - if (!col) return; - - if (col->isAllocated()) { - unsigned long pixel = col->pixel(); - - XFreeColors(basedisplay->getXDisplay(), colormap(), &pixel, 1, 0); - - col->setPixel(0l); - col->setRGB(0, 0, 0); - col->setAllocated(false); - } - - if (color_string != 0) { - unsigned char r, g, b; - - col->setPixel(color(color_string, &r, &g, &b)); - col->setRGB(r, g, b); - col->setAllocated(true); - } -} - - void BImageControl::timeout() { CacheList::iterator it = cache.begin(); CacheList::iterator it_end = cache.end(); -- cgit v0.11.2