[whatwg] Canvas transform() and matrix element notation

David Flanagan david at davidflanagan.com
Mon Jul 19 14:33:01 PDT 2010

Boris Zbarsky wrote:
> On 7/19/10 4:13 PM, David Flanagan wrote:
>> The spec describes the transform() method as follows:
>>> The transform(m11, m12, m21, m22, dx, dy) method must multiply the
>>> current transformation matrix with the matrix described by:
>>> m11 m21 dx
>>> m12 m22 dy
>>> 0 0 1
>> The first number in these argument names is the column number and the
>> second is the row number.
> I agree that this is somewhat weird at first glance, but it seems to be 
> not uncommon for graphics libraries.  For example, for cairo the call
>   cairo_matrix_init(m, a, b, c, d, e, f);
> creates a matrix which represents the affine transformation [1]:
>  x_new = a*x + c*y + e;
>  y_new = b*x + d*y + f;

Thanks for checking this; it is nice to know that there is precedent for 
the argument order. Changing the argument names to remove the numbers 
from them would make the spec less confusing.  Or at least changing the 
argument names so that they use (standard?) row,column indexing instead 
of column,row indexing.


More information about the whatwg mailing list