Hi.
xemacs + gtk is a really good thing.
i was trying to make a generic GTK-based color-selector for use with
psgml-html, but i got hung-up at trying to figure out how to convert the
return-values of gtk-color-selection-get-color to RGB hex -- #ffffff or
so -- and was hoping that someone on this list would have some suggestions
about it.
the test case:
in the gtk color-selection-dialog window, these are the values shown for
hue, saturation, value, red, green, and blue:
H: 221.04
S: 1.00
V: 1.00
R: 0.00
G: 0.32 ( xmag shows #x50 for this color component, 80 in decimal )
B: 1.00 ( xmag shows #xFF for this , 255 in decimal )
and this is the return value from a gtk-color-selection-get-color on the
colorsel in that window:
(1.257249826960619e-269 -1.992481946943558 3.713488760714563e-314
1.135730676382305e-268)
how can any of those first three elts be converted into an integer no
greater than 255, one which would match the given color component?
-1.992481946943558 =[??]=> 80 ??
here's the code i was using to get that return-value.,
note that these functions don't do anything to destroy the color-selection
window. i haven't got that far into the gtk of it, yet.
(defun egtk-close-window (&rest ignore)
(gtk-main-quit)
t)
(defun egtk-read-color (default-color &optional window-title)
(let ((color-dialog (gtk-color-selection-dialog-new
(or window-title "color"))))
(gtk-signal-connect color-dialog "delete_event" #'egtk-close-window)
(gtk-signal-connect color-dialog "destroy" #'egtk-close-window)
(gtk-signal-connect
(gtk-color-selection-dialog-ok-button color-dialog)
"clicked" #'egtk-close-window)
(gtk-signal-connect
(gtk-color-selection-dialog-cancel-button color-dialog)
"clicked" #'egtk-close-window)
(gtk-widget-show color-dialog)
(gtk-main)
(gtk-color-selection-get-color
(gtk-color-selection-dialog-colorsel color-dialog))))