Re: [css3-transforms] Multiplication order

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 UTC