[cairo] API request: obtain the trapezoids that are outsideofthe surface

Turner, David DTurner at nds.com
Thu Aug 26 00:56:10 PDT 2004

> > This is a design feature, not a bug (at least for the moment). The
> > trapezoids that Cairo sends to _all_ its backends are the result of
> > tesselation, which is essentially a device-specific operation.
> In what way is that a device-specific operation?  
Tesselation needs to find segment intersections to guarantee precise
pixelation in the backends that need it (e.g. RENDER).

Some backends accept coordinates with finite precision, which means
you need to somehow truncate the point coordinates before sending
them the data.

Unfortunately, you cannot naïvely truncate the intersection points
because this introduces extraneous intersections that will ruin
your anti-aliased rendering algorithm.

One solution to the problem is to use an algorithm like the one
described here: http://cm.bell-labs.com/cm/cs/doc/93/2-27.ps.gz

This paper also describes the problem more graphically. Have a
look, it's an interesting one.

The end result is to slightly distort the trapezoids, creating more
edges when necessary. The distorsion is relative to the finite output
precision you're using, so using sub-pixel accuracy should result
in no visible changes to the rendered results.

(This is why it's comparable to font glyph hinting: you distort
the vectors, but try to do it with sub-pixel accuracy.)

However, if you happen to scale the distorted traps, you'll begin
to notice the subtle changes in somewhat unpleasant ways.

If you really want to support "correct" path scaling within RENDER,
you need to move the tesselation code within the XServer, and I don't
think this is something that Keith has planned to do for the

> > the function uses the ctm to _immediately_ transform the coordinate
> Yes.  Otherwise one could not decide what to send to the backend.
You could decide to apply it when the path_fill or path_stroke operations
are called. This is just a design choice, and I don't see any problem
with the current scheme. Just wanted to notice it.

Best Regards,

- David Turner
- The FreeType Project

More information about the cairo mailing list