[cairo] Python SVG Surface redux
Carl Worth
cworth at cworth.org
Fri Dec 14 11:59:57 PST 2007
On Fri, 14 Dec 2007 14:41:48 +0200, Donn wrote:
> s1 = cairo.SVGSurface("newsvg.svg",400,400)
...
> ## this produces an image within the SVG output....
> s2 = cairo.SVGSurface("outputs_an_image_within_the_svg.svg",400,400)
> cr2 = cairo.Context(s2)
> cr2.set_source_surface(s1)
> cr2.paint()
> s2.finish()
...
> 1. so why does the surface s2 produce an SVG file with an embedded image?
Thanks for noticing this problem. It's simply a bug in cairo that
should be fixed. I traced through the code and found the following in
_cairo_paginated_surface_snapshot:
static cairo_surface_t *
_cairo_paginated_surface_snapshot (void *abstract_other)
{
cairo_status_t status;
cairo_paginated_surface_t *other = abstract_other;
/* XXX: Just making a snapshot of other->meta is what we really
* want. But this currently triggers a bug somewhere (the "mask"
* test from the test suite segfaults).
*
* For now, we'll create a new image surface and replay onto
* that. It would be tempting to replay into other->image and then
* return a snapshot of that, but that will cause the self-copy
* test to fail, (since our replay will be affected by a clip that
* should not have any effect on the use of the resulting snapshot
* as a source).
*/
#if 0
return _cairo_surface_snapshot (other->meta);
#else
... create image surface and replay other->meta to it ...
#endif
}
So that's the problem. There's a bug somewhere in cairo, and when I
noticed it, (probably just before a release or something), I papered
over it by doing the early rasterization you are seeing rather than
fixing the bug properly.
Anybody want to take a look into fixing whatever bug is lurking if the
above is changed to #if 1? That's definitely a fix that would be good
to get in before cairo 1.6. Actually it's even possible that the bug
has since been fixed. I'll see what the test suite says.
And Donn, in the meantime, if you'd just like to make that change and
rebuild your own cairo, then you should that your example works just
fine without any rasterization.
Thanks for the report.
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071214/dcef5a69/attachment.pgp
More information about the cairo
mailing list