[whatwg] Canvas transform() and matrix element notation

David Flanagan david at davidflanagan.com
Mon Jul 19 13:13:27 PDT 2010


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.  This surprises me, and I want to check that 
it is not an inadvertent error:

1) Wikipedia says (http://en.wikipedia.org/wiki/Matrix_multiplication) 
that the convention is to list row numbers first

2) Java's java.awt.geom.AffineTransform class also lists the row index 
first, as in the following javadoc excerpt:

>         [ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
>         [ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
>         [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]

It would be nice if this spec was not inconsistent with other usage. 
Even changing the argument names to neutral a,b,c,d,dx,dy would be 
better than what is there currently.

	David




More information about the whatwg mailing list