[cairo] Path Gradients

James Cloos cloos at jhcloos.com
Tue Jan 22 11:08:23 PST 2008

>>>>> "Carl" == Carl Worth <cworth at cworth.org> writes:

Carl> Type 6 is "coons patch meshes" and there's a more complex type 7
Carl> which is "tensor-product patch meshes". I've never known which
Carl> we'd want to put into cairo, (but the one mention that Adobe
Carl> Illustrator "gradient meshes" are Type 6 lends me to think
Carl> that's the way we want to go).

Since type 6 is just a special case of type 7 (where the four extra
control points are implicitly defined by the control points of the
four Bézier curves which define the border of the patch, it seems
that it would be best to do what PS itself does and support both,
where the API for the type 6 style figures out the implicit points
and calls the type 7 style API.

It doesn't look -- from the description in the PLRM -- that implementing
the type 7 Tensor-Product Patch Meshes will be that much more work than
implementing just the type 6 Coons Patch Meshes.

Oh, and the PDF reference (at least the 1.7 version) has the exact
equations to get those four implicit points:

p11 = 1/9 × [ -4×p00 + 6×(p01+p10) - 2×(p03+p30) + 3×(p31+p13) - p33 ]
p12 = 1/9 × [ -4×p03 + 6×(p02+p13) - 2×(p00+p33) + 3×(p32+p10) - p30 ]
p21 = 1/9 × [ -4×p30 + 6×(p31+p20) - 2×(p33+p00) + 3×(p01+p23) - p03 ]
p22 = 1/9 × [ -4×p33 + 6×(p32+p23) - 2×(p30+p03) + 3×(p02+p20) - p00 ]

James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

More information about the cairo mailing list