Re: cairo & pixmap



Hi,

On Sat, 2007-05-19 at 13:41 +0200, control H wrote:
Hi,

I'm planning to make my app use cairo instead of GDK based functions.
I'm using a drawing area, which draws into a pixmap when the
"configure" event is emitted, and copies the relevant part of the
pixmap back on the screen on the "expose" event.

When I'm doing the same with cairo, a black screen is the result. The
ref. manual says in the FAQ that I should either turn off double
buffering, or draw in the expose signal. This is also what the example
testcairo (coming along with Gtk) does.

I'm confused. Does this mean that drawing using cairo is slower since
it has to redraw the whole thing again on each expose signal? Or is
there some smart thing in Gtk that somehow knows that when the expose
event is a result of a configure event, it doesn't really do the
drawing but copies the invalidated part back?

The signal handler for the expose event is passed some parameters
specifying which part of the screen has become invalidated. If you use
these in a Cairo drawing mask, then redraw your canvas, it should be
quite fast, as Cairo will ignore all operations to areas outside the
mask.

Philip

Thanks...
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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