Re: Why do I have a grey square instead of a red square?



Jan Luehr <jluehr gmx net> writes:>
> >   gdk_color_parse("red",&color_red); //Parse Red
> >
> >   x = gdk_color_alloc (system_colormap,&color_red);//Allocate it
> >    printf ("Value %d\n",x); //Returns 1
> >

In GTK 2 it's much easier to use gdk_gc_set_rgb_fg_color() instead of
using gdk_color_alloc(). (set_rgb_ doesn't require the color to be
allocated)

> >   gdk_draw_pixmap(widget->window, //Draw the second one.
> >                   gc_red,
> >                   pixmap_red,
> >                   20,20,
> >                   20,20,
> >                   20, 20);

Your problem is that the GC foreground color has no effect on drawing
a pixmap; it only affects drawing lines, etc.

Havoc



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