On Mon, Jun 18, 2012 at 8:55 PM, Boris Zbarsky <firstname.lastname@example.org>
On 6/18/12 11:42 PM, Gregg Tavares (çç) wrote:
My understanding is getImageData is supposed to give you CSS pixels
ÂImageData objects must be initialized so that their width attribute
Âis set to w, the number of physical device pixels per row in the
Âimage data, their height attribute is set to h, the number of rows
Âin the image data
and then much later:
ÂNote: This implies that the 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.
I believe the claim was that Apple's implementation does in fact have this behavior.
Or in other words, per canvas spec if I have a <canvas width="100" height="100"> and I call getImageData(1, 3, 5, 7) on it and the backing store is using 2 device pixels per CSS pixel, then I will get an ImageData object whose .data Uint8ClampedArray of length 5*7*4 = 140 which represents the 10x14 piece of backing store whose top-left corner is at coordinates (2, 6) in the backing store pixel space (which are (1,3) in the CSS-pixel-based canvas coordinate space). ÂThe objects .width and .height will be 10 and 14 respectively.
Wow, what a crappy api. That's likely to break every page using getImageData and putImageData