100 Different Colors



Hello,

I need to create 100 little squares and each of them
has to be a different color. They can't just be a
random color: they have to follow the colors of the
standard color spectrum/palette. For example, the
first one is dark blue, then lighter blue, ... ,
green, ... , red. 

I am new to GTK, so I'm not sure how to do this. Here
is what I have so far:

------------------------------

GdkGC *gc;
GdkColor c;

c.pixel = 0;
c.red   = 65535;
c.blue  = 65535;
c.green = 0;

gdk_color_alloc (gdk_colormap_get_system (), &c);
gc = gdk_gc_new (widget->window);
gdk_gc_set_foreground (gc, &c);

for (i=0; i<100; i++) {
   gdk_draw_rectangle (widget->window, gc, TRUE, i*15,
0, 11, 11);
}

--------------------------------

This creates 100 squares with the same color. How do I
get different color every time? Do I have to hard-code
ALL of the 100 colors (and do gdk_color_alloc 100
times)? If so, how do I know which number (0-65535) to
use for RGB? Add 1 every time? 

Is there a better solution to this?

Thanks a lot!!
Lola


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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