[cairo] cairo_surface_create_similar / create_similar for SVGSurface
stevech1097 at yahoo.com.au
Tue Jul 1 18:47:43 PDT 2008
On Tue, 2008-07-01 at 04:20 -0700, cairo-request at cairographics.org
> I'm using multiple surfaces to render some diagrams to an SVG, but the
> surface doesn't seem to support the create_similar method for the
> or CONTENT_COLOR_ALPHA options. Is there an option that I'm missing?
You don't show which error message you get, or which cairo and pycairo
version you use, so your problem description is a bit vague.
It was discussed before
A solution was proposed for inclusion in cairo 1.6, but AFAIK it has not
been implemented yet. I suggest opening a cairo bug report to remind the
developers it still needs fixing.
> # this works fine
> s = cairo.ImageSurface(cairo.FORMAT_ARGB32, 400, 400)
> # this fails when I tried to call the create_similar
> s = cairo.SVGSurface(strFileName, 400, 400)
> ctx = cairo.Context(s)
> target = ctx.get_target()
> layer0 = target.create_similar(cairo.CONTENT_COLOR_ALPHA, 400, 400)
> layer1 = target.create_similar(cairo.CONTENT_COLOR_ALPHA, 400, 400)
> # render layers
> # ...
> # Add the layers back to the original surface
> ctx.set_source_surface(layer0, 0, 0)
> ctx.set_source_surface(layer1, 0, 0)
More information about the cairo