[cairo] New query functions: cairo_current_path, cairo_current_path_flat

Keith Packard keithp at keithp.com
Wed Feb 18 10:35:44 PST 2004


Around 10 o'clock on Feb 18, Bill Spitzak wrote:

> It seems to me that only the "flattened" version is really needed:

It is possible that most application uses will want the flattened version, 
however, flattening the path discards information; as Carl said, 
reconstructing the path from the flattened version may result in 
rasterization which exceeds the specified error bounds, while 
reconstructing the path from the canonical version will not.

> 1. It's the only one that returns information that the calling program does 
> not already have. Looking through my postscript examples it seems that is the 
> only one used by interesting programs, such as ones drawing text along a path.

This API also provides a way to get at the path constructed from glyphs 
and ellipses.

> 2. I'm worried that we will need to support the SVG conic functions. If we 
> decide that these are approximated by curve-to, it means the callback is an 
> approximation anyway. Or you will have to make even more callback functions 
> with different sets of callbacks.

To some extent, cairo is not just an API specification, but also a 
specification for how those APIs should map to a primitive graphics 
system.  The PostScript specification makes it abundantly clear that the 
only 'primitive' objects in Postscript are lines and cubic splines; I
suggest the same is true for cairo.  Yes, this 'limits' the 
implementation, but I believe we have sound mathematical reasons for this 
limitation in terms of guaranteeing rasterization precision.

> 3. I would think a possible Cairo implementation is to immediatly flatten the 
> curve or to otherwise cook the data so that recovering the original curveto 
> is impractical. It would be nice if Cairo allowed as much leeway in 
> implementation as possible.

No; flattening the path generates wildly inaccurate results.  PostScript 
actually specifies that objects are drawn this way and we've seen the 
effect.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040218/86eac96a/attachment.pgp


More information about the cairo mailing list