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

Re: Absolutely silly question ...



>  After this I create a pixmap with that gc, but ... It doesn't get the
>  background
>  color ... Why ???
>  
>  How can I set the background color of a Pixmap ???

You can't.  You have to draw a rectangle to fill it.

>      gc = gdk_gc_new( DrawingArea->window );
>  
>      gdk_gc_set_background( gc, &Color );

If you want to fill a rectangle using this gc, you should use
gdk_gc_set_foreground() instead.  The background color of a GC is only
used when painting 1-bit bitmaps or solid text.

>      BackPixmap = gdk_pixmap_new(DrawingArea->window,
>                            DrawingArea->allocation.width,
>                            DrawingArea->allocation.height,
>                            -1);

Using -1 for the depth is bad(tm) :-)  You should use the depth of the
drawing area, because in general it could be different from the
default visual's depth.

>      gdk_draw_pixmap( BackPixmap,
>                       gc,
>                       DrawingArea->window,
>                       0,0,0,0,
>                       DrawingArea->allocation.width,
>                       DrawingArea->allocation.height );

Be sure to fill the pixmap with gdk_draw_rectangle() before you blast
it to the drawing area, otherwise it will contain garbage.

  Federico



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