[cairo] The right approach to projective transformations

Maarten Bosmans mkbosmans at gmail.com
Fri Aug 20 03:03:22 PDT 2010


The patch I send earlier mainly resulted in discussion about how many
dimensions cairo should use and how big the transformation matrix
should be. To sidestep that I first would like to define the scope of
the proposed feature.

I want to enable projective transformations in Cairo using a linear
transformation of the 2D homogeneous coordinates. This is the same
method that is already implemented in Pixman, using a 3x3 matrix.
So I specifically do not want to add a z-axis. The feature is meant to
enable the mapping of a rectangle to an arbitrary (convex)
quadrilateral instead of only the parallelograms that are currently
possible.

In the patch I proposed this was accomplished by adding to more
elements to cairo_matrix_t. Krzysztof suggested that this was
unacceptable because of the ABI break.
So if we need a new matrix type, wouldn't it make the most sense to
just use the Pixman floating point matrix? That could then be the
matrix stored in the gstate of the context.

Any comments on how to implement such a feature?

Also adding projective transformations means that translational
invariance is lost. For things like cairo_rel_move_to and the likes
this can be worked around, but I'm not sure how much trouble this
gives in other places.

Maarten


More information about the cairo mailing list