[cairo] surface SVG to current context
Carl Worth
cworth at cworth.org
Fri Dec 14 09:56:42 PST 2007
On Fri, 14 Dec 2007 12:33:47 +0200, Donn wrote:
> > cairo can't read from SVG files only write to them. You can render a
> > SVG into any type of surface using librsvg.
> I was under the impression that it could -- from the last few days of reading
> posts and docs.
No, cairo has no ability to parse SVG or PDF or anything else.
> The word "source" tends to lend the suggestion that it's input.
A "source" pattern *is* input. What you can do is render *to* and SVG
surface, and then use that SVG surface as the source for subsequent
drawing operations. So you're not getting any output in your case
because the surface is empty.
> I am pretty sure that Carl wrote a demo recently that opened a PDF changed it
> and outputted a PDF. I am sure that SVG should behave the same way
> as PDF.
That example used poppler to open the PDF file, not cairo. And for SVG
one can use librsvg to open the file.
> I checked and the pyCairo PDFSurface() also erases the file - I am as sure as
> I can be that this is not the right behaviour.
I don't think we ever thought much about the case of people passing
existing files to cairo_pdf_surface_create and
cairo_svg_surface_create. These functions are for creating new
surfaces, not opening something that exists.
The behavior of the function is like fopen(filename, "w"), (that is,
truncating the file if it already exists). We probably could have made
them instead return a FILE_EXISTS error if the file already exists,
but it's probably too late to change that now for sake of
compatibility.
-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/e352683a/attachment.pgp
More information about the cairo
mailing list