W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2011

[whatwg] Canvas toDataURL and device dpi resolution

From: Edward O'Connor <eoconnor@apple.com>
Date: Thu, 01 Dec 2011 11:44:52 -0800
Message-ID: <m2mxbcqdor.fsf@eoconnor.apple.com>
John Knottenbelt wrote:

> How should the data url returned by toDataURL be sized in the case of
> a high device dpi resolution system? E.g. where the canvas's backing
> store horizontal and vertical dimensions are some multiple of the
> specified width and height in CSS pixels.

In the case of getImageData(), the spec says:

"[T]he data returned by getImageData() is at the resolution of the
canvas backing store. This is likely to not be one device pixel to each
CSS pixel if the display used is a high resolution display."

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#pixel-manipulation

I would expect toDataURL() to use the same underlying machinery as
getImageData() behind the scenes. This should definitely be clarified in
the spec.

> Is this correct behaviour, or is the test correct and I simply have a
> bug in WebKit?

I believe WebKit behaves correctly in this case.


Ted
Received on Thursday, 1 December 2011 11:44:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:38 UTC