[cairo] [API] Accept NULL for cairo_(pdf|ps|svg)_surface_create
britten at caris.com
Thu Oct 16 07:14:00 PDT 2008
Chris Wilson wrote:
> On IRC, Behdad bemoaned the lack of support in the current API for
> cairo_pdf_surface_create(NULL, 0, 0). The use case here is querying the
> target backend for its font options and for measuring the extents of
> operations, prior to creating the real surface.
Would this be a fully-usable surface for rendering with, or would it's
functionality be limited to just what you mentioned?
I think I can imagine where it would be nice to have a 'temporary'
(PDF) surface, without having to worry about generating a valid/safe
temporary file name (in a cross-platform way).
[ Why? There are cases where the output being generated is far too
large to practically allocate as a single raster image (eg: Maps),
and vector is pretty much the only way to go... ]
For example, I *think* Cairo would let me do something like:
- Generate a physically huge vector drawing (ie: PDF)
- Make a temporary offscreen image at a practical size
- Walk over my huge surface and copy each 'tile' from the PDF surface
to my temporary image (Thereby rasterizing that piece of the PDF)
- Save each tile to an individual raster file.
Basically, I'm thinking an approach like this would let me generate
a large, high-resolution drawing as a series of smaller images,
without running out of memory, and without re-rendering my data over
and over for each tile.
[ Of course, I may be completely wrong about what Cairo can do,
and/or someone might have a better approach... :P ]
Anyways, my simple question seems to have turned into a long-winded
post - The change Chris was proposing just got me thinking...
More information about the cairo