[cairo] [patch] enable projective transformations
Bill Spitzak
spitzak at gmail.com
Tue Aug 17 11:33:07 PDT 2010
On 08/17/2010 02:05 AM, Maarten Bosmans wrote:
> In the third square first a (0, -0.5) translation is applied, followed
> by the perspective matrix as above and finally it is translated back
> by (0, 0.5). This has the effect that the vanishing point for
> horizontal lines now lies at (1, 0.5).
This does appear to be correct, though I am pretty certain there are
problems. My suspicion is that this will fail if a horizontal
translation was tried instead of vertical or if you attempted to use the
intermediate transform where 0,0 does not remain at 0,0.
I suspect a full 4x4 matrix will be needed so a Cairo user can draw
something in perspective inside a function that is called with arbitrary
Cairo transforms, and the results be the exact same 2D image translated
to each different setup. (also I erred above in that the perspective
transform must have the z row be all zero, it has to "flatten" the image
otherwise you cannot make a perspective of a perspective correctly).
I fully agree that pixman only needs a 3x3 matrix however to translate a
2D input to a 2D output. It may be possible to normalize so the
lower-right is 1, what if that location is zero? Perhaps zero does not
arise in any non-degenerate transforms, however.
More information about the cairo
mailing list