Re: gdk_gc_set_foreground(): not working over DirectFB



2006/11/13, Prasanna Kumar K <prasanna tataelxsi co in>:
Hi All,


I have added few lines in scribble-simple.c (gtk+-2.10.1/examples/scribble-simple)
for the foreground color. Kindly find the attached patch file for this.

I'm not able to set the foreground color for gtk_drawable application(scribble-simple)
over DirectFB (but over X it is working fine).In the function expose_event whatever
color I am setting for brush, DirectFB is taking  Black color only irrespective of any
new foreground color set using gdk_gc_set_foreground().

First, one should never modigy the style members directly, the
gtk_widget_modify_*() functions are for overriding temporary
per-widget style properties (for a lasting effect, do it in gtkrc).

Secondly, the expose_event of the scribble example only copies the
pixmap used to store the stroked pixels to the visible window. So it
does not manipulate the pixel data, only copies the drawn data to the
screen. The actual drawing takes place in draw_brush() with
gdk_draw_rectangle(), which uses widget->style->black_gc directly (so
the style change would not have effect anyway).

To change the color, I'd suggest creating a GdkGC from the pixmap and
setting the foreground to that GC, not one from the widget's style.

--
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi



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