[cairo] Projective transforms

Andrea Canciani ranma42 at gmail.com
Wed Aug 11 13:45:31 PDT 2010

On Wed, Aug 11, 2010 at 10:16 PM, Maarten Bosmans <mkbosmans at gmail.com> wrote:
> 2010/8/11 Benjamin Otte <otte at redhat.com>:
>> On Wed, 2010-08-11 at 09:47 +0200, Maarten Bosmans wrote:
>>> Does this mean that projective transformations are possible in Cairo?
>>> What would be required to use it?
>> It means projective transforms are possible in Pixman. Using them in
>> Cairo has been a desire for a while, but no one has yet attempted to
>> implement it.
> I could not find the implementation pixman. The file pixman-matrix.c
> only deals with 3x3 matrices used for affine transformations. Am I
> missing something?
3x3 matrices describe a projective transform in a 2d space (through a
linear transform in the related homogeneous space).
> The SVG 1.1 spec only defines affine transformations. A proposed
> extension to include projective transformations is a working draft:
> http://www.w3.org/TR/2009/WD-SVG-Transforms-20090320/
> That page nicely lays out the use of homogeneous coordinates in 2D and
> 3D and how the conversion works. It could be used as a guide for
> implementing in pixman and of course also for the cairo svg surface.
That document describes 3D (homogeneous) transformations.
Pixman works on 2D images (and already implements homogeneous 2D
What would be the benefit of using 3D transformations?
> If the general outline of implementing such a thing in cairo (and
> pixman?) becomes clear, I can certainly try to whip up some patches.
> My main motivation would be to enable the rendering of animated text
> in a projective plain, like the classic Star Wars prologue.
That is possible using 2D projective transformations:
x' = x
y' = y
w' = 1 + y
would become
x'' = x/(1+y)
y'' = y/(1+y)
Of course you will actually have to choose appropriate constants.

More information about the cairo mailing list