[cairo] PDF Backend for cairo
Kristian Høgsberg
krh at bitplanet.net
Tue Nov 30 23:16:41 PST 2004
Carl Worth wrote:
> On Mon, 29 Nov 2004 14:59:09 -0500, =?ISO-8859-1?Q?Kristian_H=F8gsberg?= wrote:
>
>>I've been working on a PDF backend for cairo over the weekend, and at
>>this point I think it's appropriate post a snapshot of the current code.
>
> Fantastic! It's great to see more progress continuing on this front.
Well, here's a little more progress:
- I found the problem with the "leak" in the polygons, I misunderstood
the trapezoid format.
- As described in my other mail, I changed the generated PDF to draw
all trapezoids as subpaths of one big path and the fill that for each
call to composite_trapezoids() which solves the problem with cracks in
the polygons.
- I added support for constant alpha values
- I added support for clipping paths
I've uploaded a new patch with these changes:
http://people.redhat.com/krh/cairo-pdf/cairo-pdf-2.patch
and there's an updated snippets.pdf available:
http://people.redhat.com/krh/cairo-pdf/snippets.pdf
The clipping support requires a change to the backend API: I added a
set_clip_trapezoids() call to cairo_surface_backend_t which works much
like set_clip_region(), except it takes a list of trapezoids for the
clipping area. If a backend doesn't support this it must return
CAIRO_INT_STATUS_UNSUPPORTED as usual. This change isn't fully done
yet, there's a few issues to work out still.
By the way, in _cairo_gstate_clip() line 1761, the rectangle case ends with:
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
_cairo_traps_fini (&traps);
}
return status;
Shouldn't this be
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
_cairo_traps_fini (&traps);
return status;
}
instead?
Oh, and another thing: it looks like the show_glyphs function pointer in
the cairo_surface_backend_t struct can be NULL, in which case it is
treated as returning CAIRO_INT_STATUS_NOT_SUPPORTED. Is there a reason
show_glyphs doesn't follow the convention that all function pointers
must be non-NULL?
cheers,
Kristian
More information about the cairo
mailing list