Re: About drawing primitives

Chris Nystrom <ccn olenska hn org> writes: 
> void
> color_foreground_set(int red, int green, int blue)
> {
> = red * 255;
> = green * 255;
> = blue * 255;
>   gdk_color_alloc(colormap, &color_fg);
>   gdk_gc_set_foreground(gc, &color_fg);

In GTK 2, it's best to omit the gdk_color_alloc, and use
gdk_gc_set_rgb_fg_color() instead of gdk_gc_set_foreground().  Then
the color will come from the preexisting RGB color cube and you won't
have to worry about deallocating it.

Another handy function is gdk_color_parse(), since it will parse a
string such as "red"


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