[cairo] Some newbie question

Carl Worth cworth at cworth.org
Thu Dec 13 13:14:07 PST 2007


On Thu, 13 Dec 2007 22:01:02 +0100, "Tuom Larsen" wrote:
> Thanks for the reply!

You're welcome.

> If I understand correctly (maybe I even read it somewhere), there are
> basically to "kinds" of surfaces - the ones which do preserve drawing
> operations (PDF, SVG, ...) and the ones which do not (xlib, image, ...). Is
> it so?

Yes, definitely. Those are basically vector vs. raster surfaces in
cairo.

> Then, the another question is, if I draw to Image surface and duplicate it
> via the method from FAQ to PDF surface, what happens? In PDF, will there be
> an embeded pixel-image or all the vector-paths and lines and curves which
> were used to draw the Image surface?

An image surface is a raster representation of what you've drawn, (the
pixels), nothing more. So yes, drawing from an image surface to a PDF
surface will embed a pixel-image into the PDF file.

> My original thought was that I will create an Image (or meta) surface, do
> all the drawing, then serialize this surface via programming language (e.g.
> in python via pickle) and then reuse. In that way i wouldn't need to use
> Poppler or librsvg.

So there's not really anything like that in cairo.

What I would recommend is that in your program you have your own data
structures, and write code so that those data structures know how to
"draw themselves" given a cairo context. Then, you can pickle (or
otherwise serialize) your objects and draw them with cairo however
you'd like.

Does that make sense for your application?

> Well, the mailing list archive is pretty good and the site too, but since
> you asked :).. Maybe a wiki and some more diagrams would be useful but now I
> see that both are being worked on.

The entire cairographics.org web site is a wiki---and anyone is free
to edit it. So jump on in if you see anything that could be improved!

> So, actually, nothing really. ... Ok, one
> thing: I found a tiny bit confusing all this "samples", "recipes",
> "snippets", "examples" - I wasn't really sure where to look for what.

Yeah, that's definitely some organic growth going on, (the good and
bad of wiki-ness together). Anyone want to take a crack at imposing
some high-level organization to this stuff? Clearly the 4 words above
are all referring to basically the same thing, so it's not all that
helpful having 4 separate pages.

Thanks for pointing out this bug, Tuom.

-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/20071213/cd5d45f6/attachment.pgp 


More information about the cairo mailing list