Re: 100 Different Colors



FYI - I just came up with the this example to illustrate a way to change
the colors in a loop - it doesn't represent the solution!

Algo is still:
r = max, g = 0, b = 0
r = max , g = max, b = 0
r = 0, g = max, b = 0
r = 0, g = max, b = max
r = 0, g = 0, b = max
r = max, g = 0, b = max
back to step 1

Quickest solution: Get yourself the latest source of gtk+, there is the
file gtk/gtkhsv.c, which has the function hsv_to_rgb.

Ranges from 0.0 - 1.0.
hue = step * (i/max_step);
saturation = 1.0;
value = 1.0;
hsv_to_rgb(&hue, &saturation, &value);

Now they contain the rgb - values

r = hue * G_MAXUINT16;
g = saturation * G_MAXUINT16;
b = value * G_MAXUINT16;

or use gtk_hsv_to_rgb...

...

JMG



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