[whatwg] ImageData constructor questions

Dirk Schulze dschulze at adobe.com
Sat Mar 22 23:31:49 PDT 2014


I was reading the spec part about ImageData [1].

I noticed that createImageData() is explicit that it represent a transparent black rectangle. The constructor for ImageData is not that explicit.

The last step of the 2nd constructor that takes an Uint8ClampedArray says:
"	• Return a new ImageData object whose width is sw, whose height is height, and whose data is source.”

Is data a reference to the original source or a copy of source? For the former, there might be two ImageData objects referencing the same ByteArray. How would that be useful?


[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dfnReturnLink-7 ( Pixel manipulation)

More information about the whatwg mailing list