[cairo] rsvg and cairo alpha puzzle
Carl Worth
cworth at cworth.org
Fri Nov 30 09:35:17 PST 2007
On Fri, 30 Nov 2007 14:47:52 +0200, Donn wrote:
> I realize that rsvg is not your problem, but I thought there may be some
> advice or clever hackery to be had.
Yes, this looks like a librsvg problem.
> I include the script at end. The basic problem is the cairo_render ( ctx)
> command in pyRsvg in combination with paint_with_alpha.
It's not paint_with_alpha that's the problem... just the fact that
you're doing rendering within a group.
> When one tries to translate the SVG *while* it's within the push_group scope
> it ignores it. When you removes the alpha code, it will translate.
And it's not simply ignoring the translation. It does respect most
aspects of the transformation matrix. But it seems to adjust the
translation component in such a way so that the upper-left corner of
the bounds of the SVG content ends up at the device's upper-left
corner, (even if some of it should have been rendered off-screen,
say).
I've attached a minimal, self-contained C program demonstrating the
buggy behavior.
I've looked into the problem a very little bit and I suspect the bug
is in the manipulation of the target surface's device offset in
rsvg_handle_render_cairo_sub. At this point, librsvg renders with an
identity matrix, (apparently after having copied the original cairo
transformation into its own data structures), and computes an offset
based on the bounds of the surface. There clearly seems to be
something bogus happening there.
Oh, and also there's this comment in rsvg_cairo_new_drawing_ctx:
/* adjust transform so that the corner of the bounding box above is
* at (0,0) - we compensate for this in rsvg_handle_render_cairo_sub()
* below */
state->affine[4] -= render->offset_x;
state->affine[5] -= render->offset_y;
Librsvg hackers, care to comment on this?
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rsvg-bug.c
Type: application/octet-stream
Size: 2257 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071130/f48ff663/attachment.obj
-------------- next part --------------
-------------- 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/20071130/f48ff663/attachment.pgp
More information about the cairo
mailing list