Hurray, I've got pie menus reading icons from png files (cairo.ImageSurface.create_from_png) and centering the icons above the item labels!

I'd love to know the trick to reading SVG files, please -- that would really work well with pie menus, especially once I get some cool scaling and rotating feedback implemented. Is there a way to load an SVG file into a surface cache with a transparent background? How do you measure an SVG file's size, or do you have to know what size to render it?

Can you please recommend a good source of documentation about pycairo and pango from a python programmer's point of view? I've found the gtk doc that has some of this stuff, but it seems to be missing a lot of the lower level cairo stuff, just pangocairo documentation without links into the cairo module documentation.

For example, this tells about paingocairocontext but has no documentation link for cairo.Context...

http://www.pygtk.org/docs/pygtk/class-pangocairocairocontext.html

Thanks a lot for the help!

   -Don


Marco Pesenti Gritti wrote:
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

_______________________________________________
Sugar mailing list
[email protected]
http://mailman.laptop.org/mailman/listinfo/sugar

Reply via email to