Re: 100 Different Colors
- From: Jan-Marek Glogowski <glogow fbihome de>
- To: Kevin DeKorte <kdekorte yahoo com>, Lola Smith <lola_smith55 yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: 100 Different Colors
- Date: Fri, 24 Jun 2005 11:05:30 +0200 (CEST)
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]