[sugar] New version of piemenu.py, and some cairo questions

Marco Pesenti Gritti mpg
Tue Feb 27 04:40:59 EST 2007


On Mon, 2007-02-26 at 18:35 -0800, Don Hopkins wrote:
> 
> So here is a naive resource management question:
> What is the best way to configure and pass icons and graphical resources 
> into cairo based widgets, measure and draw them on the screen efficiently?
> (It would be nice if the same icon is used in a lot of places, it only 
> got loaded once, and stuff like that...)

What we are currently doing for our icons is to render them (they are
svg) on a buffer context, created like this:

target = ctx.get_target()
buf = target.create_similar(cairo.CONTENT_COLOR_ALPHA, w, h)

And then copy them on the widget context with:

ctx.set_source_surface(buf, x, y)
ctx.paint()

Marco



More information about the Sugar-devel mailing list