[cairo] PDF Backend for cairo

Ross McFarland rwmcfa1 at neces.com
Wed Dec 1 04:49:09 PST 2004

On Wed, 2004-12-01 at 00:51, Kristian Høgsberg wrote:
> Ross McFarland wrote:
> > On Tue, 2004-11-30 at 22:10, Kristian Høgsberg wrote:
> > 
> >>Ross McFarland wrote:
> ...
> I took a look at your example PDF and found a couple of issues:  you're 
> filling and stroking each trapezoid (the 'b' operator) which is wrong, 
> all stroking is done by higher level cairo functionality, the PDF 
> backend should only fill the trapezoids.  Second, a more subtle issue: 
> you're filling each trapezoid separately, which cause them to be 
> composited onto the backdrop separately.  I did the same thing 
> originally, but now I draw one big path with each trapezoid as a closed 
> subpath, and at the end I fill it all.  I guess, in the mathematical PDF 
> model this doesn't make a difference, but when rendering with e.g. 
> Render, it allows the rasterization process to ADD all the trapezoids 
> into the mask before compositing, thus avoiding cracks.
> If you zoom in on the artifacts:
>    http://people.redhat.com/krh/cairo-pdf/basket-artifact.png
> you can see the dark lines caused by the stroking. If you look even 
> closer, you can see that there's a 1 pixel slightly lighter line in the 
> middle of the dark line caused by the separate compositing.

as i said that was only one of 10 different things i tried. i don't
remember which viewer, but there was a viewer (situations) in which if i
didn't fill and stroke the regions didn't overlap. as in gaps between
the traps when just filling.

> I have the same example here:
>    http://people.redhat.com/krh/cairo-pdf/basket.pdf
> which renders quite nicely in acroread (with and without geometry anti 
> aliasing enabled) and gpdf.  So I actually think it's possible to let 
> cairo do the tessellation and still get nice results.  Even so, I still 
> think it will be interesting to evaluate PDF level tessellation.

i don't know that i tried filling after drawing all of the traps. i
guess i didn't make the assumption that all of the traps i'll be getting
are overlapping (one solid object.) what will happen with complex
self-crossing objects like the five point star and such. i think the
traps you get there won't necessarily make one solid region to fill, but
several smaller ones. i guess i'm not sure (but haven't tried) that fill
rules will be preserved correctly. beyond that i'd worry the
non-overlapping problems that caused me to try both fill and stroke. it
does sound like promising route in general.

> I did notice that your PDF loads in ggv, though, which the PDFs I 
> produce don't.  I'm guessing I have an offset wrong or something, but I 
> haven't yet been able to find it.

yeah, that's probably it. different viewers seem to be really picky
about different things.


More information about the cairo mailing list