Re: color parsing confusion

On Sat, 2003-09-20 at 02:49, Jan-Marek Glogowski wrote:
> Hi
> I'm porting my app from Gtk+ 1.2 to Gtk+ 2.
> With Gtk+ 1 I used "rgb:r/g/b" strings to store the colors, but Gtk+ 2
> can't parse them in contrast to the GDK documentation. This is my trace:
> GDK HTML-API: gdk_color_alloc - "any of the forms accepted by XParseColor"
> Code: gdk_color_parse -> pango_color_parse
> Pango HTML-API: pango_color_parse - "from the X11 rgb.txt" or "hex value"
> (#rgb ...)
> Code: "from Tk" -> parses "hex" (#rgb) and does a lookup in an
> internal "rgb.txt" list
> man XParseColor:
> Parses the "following syntax: rgb:<red>/<green>/<blue>"
> #rgb: "For backward compatibility" "but its continued use is not
> encouraged."
> Code: Just had a quick look (Xcms) ...
> The X man page was my original info to decide the format.
> Q: What is the preferred fix?
> 1. Correct the GDK HTML API
> 2. Add rgb / rgbi parsing to pango_color_parse
> 3. On X11 based platforms use XParseColor

Fixing the GtkHtml (No such thing as GdkHTML) docs. The fact that GTK+
used to accept rgb:blah/blah/blah form was just an oversight.

#rgb in GTK+-2.x has the correct conversion behavior.
#rgb => rrrr,gggg,bbbb not r000,g0000,b000.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]