[cairo] New PDF backend snapshot

Kristian Høgsberg krh at bitplanet.net
Wed Dec 15 09:52:38 PST 2004


Hi,

I've pondering the cairo_document_t idea a bit and restructured the PDF 
backend so that it's split into a cairo_pdf_document_t object and a 
cairo_pdf_surface_t object.  I believe this makes the code easier to 
follow, but I'm no longer sure we need to expose a cairo_document_t in 
the user API.  However, I did choose to expose cairo_pdf_document_t in 
the public API, for two reasons: 1) the other backends expose a function 
to create a surface, e.g. cairo_xlib_surface_create, and for symmetry I 
want to provide this too.  A PDF surface needs a reference to the 
document it belongs, so the cairo_pdf_document_t needs to be in the 
public API.  2) It will be a nice way to set metadata and other PDF 
specific information for the document.

There are two significant changes outside cairo_pdf_surface.c in this 
patch: I've added the set_clip_trapezoids surface method which is 
supposed to let cairo pass the absolute clipping path to the backends. 
If a backend returns NOT_SUPPORTED, clipping proceeds as normal.  This 
doesn't actually work yet, since cairo just passes the new clipping 
path, not the intersection of the existing and the new path.  I 
discussed this in irc with Carl, and he says that the new tesselator 
should be able to compute this intersection.  It might be a bit early to 
add this interface before the new tesselator is integrated, but I as far 
as I can tell, it's the interface we want.

The other change is the addition of cairo_array_t implemented in 
cario_array.c.  This is an standard autogrowing array, doubling the 
allocation size when it runs out of space.  I was using chained lists 
before in the PDF backend, but I converted those to arrays.  I added the 
array as a general data type, since cairo uses the same type of array in 
other places and it might make sense to rewrite those places to use this 
array type.

cheers,
Kristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-pdf-3.patch
Type: text/x-patch
Size: 55447 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041215/67927b63/cairo-pdf-3.bin


More information about the cairo mailing list