Re: Newbie Q: Colours



"George Ogata" <g_ogata ihug com au> writes: 
>   // make gc and set fgcolor
>   gc = gdk_gc_new(darea1->window);
>   gdk_gc_set_foreground(gc, blue);
> 
>   // make it happen
>   gdk_draw_rectangle (darea1->window,
>         gc,
>         TRUE,
>         0, 0,
>         darea1->allocation.width,
>         darea1->allocation.height);

Read the "scribble" example in the tutorial. Drawing areas don't
remember their state, you have to handle expose events.
 
> Also, is there any point in explicitly setting the `pixel' field of a
> GdkColor?  FAQ 7.2 does it, but I thought it was the allocating function's
> job.

7.2 is not really right IIRC. You want to use the color allocation. 

Or as I suggested to someone a couple days ago on either this list or
gtk-app-devel-list, use GdkRGB to allocate colors instead of
using colormaps directly. Check the recent archives for that.

Havoc




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