[cairo] [patch] enable projective transformations

Andrea Canciani ranma42 at gmail.com
Tue Aug 17 03:33:05 PDT 2010


On Tue, Aug 17, 2010 at 12:29 PM, Arjen Nienhuis <a.g.nienhuis at gmail.com> wrote:
> On Tue, Aug 17, 2010 at 11:05 AM, Maarten Bosmans <mkbosmans at gmail.com> wrote:
>> 2010/8/17 Bill Spitzak <spitzak at gmail.com>:
>>> Maarten Bosmans wrote:
>>>>
>>>> This is a first attempt to add projective transformations to Cairo. It
>>>> is far from complete, but mostly meant to get the discussion going
>>>> about how such a feature should be implemented.
>>>
>>> I believe if you want to concatenate transforms you need to keep 12 numbers
>>> (a 4x3 matrix) around. Otherwise not enough information is remembered so
>>> that two "rotate about the y axis by 10 degrees" can produce the same result
>>> as one "rotate about the y axis by 20 degrees". The 8 number cannot
>>> distinguish such a rotation from a horizontal scale by 1-sin(10 degrees).
>>
>> I'm not really sure what you are trying to say here. How could two
>> rotations possibly be the same as a scaling?
>>
>
> In current cairo there's one rotate: around the z-axis.
>
> Rotating an image around the y axis without perspective whould to be
> the same as scaling in the x-direction.
>
>>> Treating these as 3 rows (or columns) of a 4x4 matrix will allow you to
>>> multiply them. The last row/column will be [0,0,0,1] always, similar to the
>>> current Cairo matrix.
>>
>> My first suggestion to look at the SVG spec was not good. For Cairo we
>> should stick to 2D. I don't think posititioning flat surfaces in a 3D
>> space and then projecting back in a 2D plane gains us anything.
>>
>
> You will need that for all the primitives that are flat and only
> defined on a 2d plane. Things like circles, text etc.
>
> I can't really think of a model that's easier to apply to cairo and I
> don't know of a use case that would not be supported by that model.
2D projective transforms are simpler and would support everything you described.


More information about the cairo mailing list