[whatwg] Canvas "coordinate space units"

David Flanagan david at davidflanagan.com
Wed Jul 14 12:03:36 PDT 2010

I'm confused by the term "coordinate space units" as applied to the 
canvas spec.  It does not seem to be defined.

It is used in the definition of the translate() method, for example, and 
seems to imply that coordinate space units are affected by scale() 

It is used in the definition of the lineWidth attribute as well. 
Chrome, Firefox and Opera all scaled lineWidth and Phillip Taylor's test 
suite expects this behavior as well.

But then in the definition of shadowOffsetX and Y, the spec reads:

> Their values are in coordinate space units. They are not affected by the current transformation matrix.

The description of isPointInPath() uses similar language:

>  when treated as coordinates in the canvas coordinate space unaffected by the current transformation,

So which is it?  Are "coordinate space units" affected by scaling or 
not?  Are lineWidths supposed to be scaled? (Implementations do so 
consistently) Are shadow offset supposed to be scaled? (Chrome does, 
Firefox and Opera do not)

I think a clearer definition of coordinate spaces would be helpful. 
Maybe "device space" for the underlying pixmap, "canvas space" for the 
coordinates defined by the width and height attributes of the canvas, 
and "user space" for the space defined by the current transformation matrix?


More information about the whatwg mailing list