[whatwg] ImageData constructor questions
cabanier at gmail.com
Sun Mar 23 12:20:52 PDT 2014
On Sat, Mar 22, 2014 at 11:31 PM, Dirk Schulze <dschulze at adobe.com> wrote:
> I was reading the spec part about ImageData .
> I noticed that createImageData() is explicit that it represent a
> transparent black rectangle. The constructor for ImageData is not that
Yes, that seems like an oversight.
> 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?
It is the original source. The spec does not say anything about creating a
new array and copying the bits over.
> For the former, there might be two ImageData objects referencing the same
> ByteArray. How would that be useful?
You *could* use the API that way but I don't see why there has to be a way
to prevent that from happening. Is there an implementation issue if 2
different imageData object point to the same dataarray/
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dfnReturnLink-7(184.108.40.206.16 Pixel manipulation)
Correct link is:
More information about the whatwg