[cairo] Fwd: Can't draw more

Kalle Vahlman kalle.vahlman at gmail.com
Sat Nov 24 06:10:07 PST 2007


Damn, got fooled by the recipient list :)

reply for the list too:

---------- Forwarded message ----------
From: Kalle Vahlman <kalle.vahlman at gmail.com>
Date: 24.11.2007 15:58
Subject: Re: [cairo] Can't draw more
To: Gary Jaffe <gfj555 at gmail.com>
Cc: cairo-request at cairographics.org


2007/11/24, Gary Jaffe <gfj555 at gmail.com>:
[chop]
> I'm trying to create something that allows the user to draw on a
> gtk.DrawingArea.  I see there is an example of doing this in the pygtk
> tutorial called scribblesimple.py at
> <http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html#simplescribblefig>,
> although that script doesn't use cairo.  It does use a working pixmap to
> draw on, and then the expose_event transfers the modified area of the
> pixmap to the gtk.DrawingArea with the draw_drawable() method.
>
> Is drawing on a working pixmap and then transferring the modified part
> of the pixmap to a cairo surface a reasonable way to go?

Unless you want to hold on to that drawed data for modifications (eg.
save the path that the user drew), yeah, that's perfectly reasonable
thing to do.

If you reduce the expose handler to just "blitting" the pixmap, you
might want to disable the double buffering that GTK+ does (with
.set_double_buffered()) since it's a bit pointless to do the blit
twice. Also .set_app_paintable() is worth looking at (ie. clearing of
the widget background by GTK+) if you store the whole widget contents
in a pixmap.

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


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


More information about the cairo mailing list