W3C home > Mailing lists > Public > www-style@w3.org > November 2012

Re: [css3-transforms] Multiplication order

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Sun, 11 Nov 2012 09:56:35 +0100
Message-ID: <509F6843.6010605@kozea.fr>
To: Rik Cabanier <cabanier@gmail.com>
CC: www-style list <www-style@w3.org>
Le 11/11/2012 05:13, Rik Cabanier a écrit :
>     Is this a left-multiply or a right multiply? In other words, which
>     of these is correct?
>
>          accumulator = accumulator * to_matrix(function)
>     or
>          accumulator = to_matrix(function) * accumulator
>
>
> It's always left to right so:
>
>     accumulator = accumulator * to_matrix(function)

Thanks for answering. For some reason I settled on the opposite in my code.

https://github.com/Kozea/WeasyPrint/blob/v0.15/weasyprint/document.py#L71

I will have to check again.


>     I remember trying stuff blindly and comparing with other engines in
>     order to get this right in WeasyPrint…
>
>     Similar questions arise with nested "transformed" stacking contexts
>     or anywhere an implementation would multiply matrices. It might just
>     be me who is confused, but the spec could still be more explicit
>     than it is currently.
>
>
> Is your confusion with preserver-3d or with regular 2d transforms?
> In the case of 2d, the outer transform happens first (= to the left)

Regular 2D. (WeasyPrint paints to cairo, which is 2D only.) Why, is the 
math not the same?

And again it seems I’m doing the opposite:

https://github.com/Kozea/WeasyPrint/blob/v0.15/weasyprint/document.py#L134

But maybe there is some inverting going on that makes it all consistent, 
I’m not sure.


In earlier version of the draft (when 2D and 3D where separate modules) 
had borrowed some equations from SVG:

http://www.w3.org/TR/SVG/coords.html#NestedTransformations

Why were they removed? Is it just that nobody generalized them to 3D?

Thanks,
-- 
Simon Sapin
Received on Sunday, 11 November 2012 08:57:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT