Drawing onto a GtkWidget using gtk2 2.24.23



Hello all,

I have noticed a few oddities regarding the cairo_t* that is passed by
gdk_cairo_create and I was wondering whether you could give me some
pointers.

I have given a sort of canvas with strokes drawn onto it. The canvas is
stored as a cairo_surface_t* in the application. On a normal expose
event I merely copy the surface back to the widget.
Now assume that the user wants to draw an additional stroke on the
canvas. During the drawing there will be multiple motion_notify_event
being triggered. To avoid modifying the internal cairo_surface_t* and
copying that to the screen I would like to simple draw on top of the
widget using the cairo_t* provided by gdk_cairo_create.
However, the drawing does not seem to work correctly when transparency
is involved: any semi-transparent stroke does not appear at all on the
screen and anti-aliased strokes are drawn differently than when they are
drawn onto the internal cairo_surface_t*. Does anyone have a good
explanation for this behaviour and is there some way to avoid it without
having to copy buffers around? Where does the cairo_t* provided by
gdk_cairo_create come from and how is it combined with the previously
drawn content?

ax487


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