FLTK2 uses the long RGBA form for colors, e.g. '0xff000000' for red.

'parse_color("0xff000000") returns the red color.

My X11R7-system accepts '0xf800' for red ('0x1f':blue), but FLTK2 not.
My X11R7-system refuses '0xff000000' for red, but FLTK2 not.

The following patch does what I expect. But it may be not general
enough.

winfried


--- Color.cxx.orig      2009-08-26 06:08:51.000000000 +0200
+++ Color.cxx   2009-08-26 13:40:08.000000000 +0200
@@ -102,6 +102,22 @@
   }

   if (length > 2 && name[0]=='0' && (name[1]=='x' || name[1]=='X')) {
+#if USE_X11
+       if(length <= 6)
+   {
+    XColor xcolor;
+    unsigned long pixel;
+
+       sscanf(name+2, "%lx", &pixel);
+    memset(&xcolor, 0, sizeof(XColor));
+    if(pixel != 0)
+   {
+    xcolor.pixel = pixel;
+    XQueryColor(xdisplay, xcolormap, &xcolor);
+   }
+       return ccolor(xcolor.red>>8,xcolor.green>>8,xcolor.blue>>8);
+   }
+#endif
     sscanf(name+2, "%x%n", &r, &n);
     if (n == length-2) return Color(r);
   }

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to