[cairo] Mesh gradients

Andrea Canciani ranma42 at gmail.com
Thu Dec 23 12:33:33 PST 2010

I have cleaned up the code and the documentation of mesh patterns.

The updated branch is
The code and the comments should be fine. The latest commits should be
squashed into the commits they are fixing and most commit messages should
be rewritten. I'll fix this in another branch soon-ish.

I uploaded the documentation here:
It needs to be reviewed, both for the content and the language used (I'm not a
native English speaker), but it should be consistent and complete.
I put cairo_pattern_mesh_* functions in the same page as
cairo_pattern_* functions,
but maybe they should belong to a different page.

I would like to add that testing PDF containing mesh patterns pointed out
problems in most implementations. I uploaded the interesting part of the output
of the cairo test suite here:

mesh-pattern-fold shows that poppler and Apple Preview do not handle
folds correctly
mesh-pattern-accuracy shows that Adobe Reader and Apple Preview split
the gradient
only based on the shape, but they don't guarantee that the splits are
sufficient to have
an accurate approximation of the bezier patch using Gouraud shaded triangles.

The new rasterizer implemented in cairo and the rasterizer available
in GhostScript
seem to handle these patterns better, but additional testing, both in
the form of meshes
which cairo is unable to rasterize correctly and in the form of
checking if other existing
implementations handle these PDF files correctly would be appreciated.

I have tested this branch on most backends (image, pdf, ps, recording,
svg, xlib,
xcb, quartz, gl, script) and it works as expected.

I would like this branch to be tested on all supported backends, but
I'm still unable to
test cairo-win32. Testing (even just that the code compiles with no
additional warnings)
other backends is very welcome as well.


More information about the cairo mailing list