GButton.color_button, Gdk.color and GDraw.pixmap
Eddy2 <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
Hello ! I'm currently writing a little toy program (labyrinth generator). In order to let the user choose the wall and cell colors, I've added two GButton.color_button widgets to the main window. The drawings are done in a backing widget (GDraw.pixmap), and the foreground color is set up with pixmap#set_foreground. Curiously, the following code does not seem to do the job : pixmap#set_foreground (`COLOR color_button#color) I need to use this auxiliary function : let convert color = let r = Gdk.Color.red color and g = Gdk.Color.green color and b = Gdk.Color.blue color in `NAME (Printf.sprintf "#%02x%02x%02x" (r lsr 8) (g lsr 8) (b lsr 8)) pixmap#set_foreground (convert color_button#color) Thus, it seems that red, green and blue values use 16 bits in color_button, and only 8 bits in pixmap. Can you explain me this (somewhat weird) difference ? -- View this message in context: http://www.nabble.com/GButton.color_button%2C-Gdk.color-and-GDraw.pixmap-tp21173775p21173775.html Sent from the Lablgtk - France mailing list archive at Nabble.com.