GtkHSV



Hi,

First, a bit of background:  recently I have been learning GTK+2 and
decided to do this by scratching an itch - there is no decent colour
converting application (say I have a colour as #RRGGBB, what is it as
rgb:rrrr/gggg/bbbb?).  I started writing such an application and ended
up reporting a "bug" in GTK 1.3.12 where gtkhsv.h was being installed in
gtk-devel when it shouldn't.  I started using that component anyway,
until yesterday when I upgraded and my code stopped compiling.  :(

I am now determined to get GtkHSV back into GTK+ at some point (2.2?) -
but the consensus (Owen, Havoc, Damon) is that the API sucks.  So, lets
fix it.

The current API is quick and simple:

GtkWidget* gtk_hsv_new          (void);
void       gtk_hsv_set_color    (GtkHSV    *hsv,
				 double     h,
				 double     s,
				 double     v);
void       gtk_hsv_get_color    (GtkHSV    *hsv,
				 gdouble   *h,
				 gdouble   *s,
				 gdouble   *v);
void       gtk_hsv_set_metrics  (GtkHSV    *hsv,
				 gint       size,
				 gint       ring_width);
void       gtk_hsv_get_metrics  (GtkHSV    *hsv,
				 gint      *size,
				 gint      *ring_width);
gboolean   gtk_hsv_is_adjusting (GtkHSV    *hsv);
void       gtk_hsv_to_rgb       (gdouble    h,
				 gdouble    s,
				 gdouble    v,
				 gdouble   *r,
				 gdouble   *g,
				 gdouble   *b);
void       gtk_rgb_to_hsv       (gdouble    r,
				 gdouble    g,
				 gdouble    b,
				 gdouble   *h,
				 gdouble   *s,
				 gdouble   *v);

Plus a "changed" signal.

I can make a few complaints:

1) no documentation :)
2) Surely GdkColor should be used?
3) gtk_hsv_to_rgb and gtk_rgb_to_hsv should really be in GdkColor.

Some other ideas are mapping three GtkAdjustments to each colour
channel, but that could be considered overkill.

If a set of API changes can be decided upon, I'll do my best to
implement it.

Regards, and keep up the good work,
Ross
-- 
Ross Burton                                 mail: ross burtonini com
                                       jabber: rossburton jabber org
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF

Attachment: signature.asc
Description: This is a digitally signed message part



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