[Bug 12586] Suggest using Typed Array for ImageData pixels. Add a new 'buffer' attribute that references ArrayBuffer of the pixel data. Convert 'data' (CanvasPixelArray) to Uint8Array view of 'buffer'.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12586

--- Comment #4 from Boris Zbarsky <bzbarsky@mit.edu> 2011-07-29 02:29:14 UTC ---
> bz: Is the TypedArrayness of CanvasPixelArray in Gecko visible to JS in any
> way?

Yep.  The CanvasPixelArray is just a typed array, and you can do all the normal
typed array stuff to it from JS: get the underlying ArrayBuffer, create other
views on the data, construct subarrays, etc.  In fact, there is no
CanvasPixelArray interface in Gecko at all at the moment; if you ask the .data
of an imageData whether it's instanceof Uint8ClampedArrays you should get back
true.

Furthermore, you can create Uint8ClampedArrays using the normal typed array
constructors and then work with them.  And since the .data of imagedata is not
readonly in Gecko at the moment you can assign one of those (or some other
typed array, or a regular array) to it.

I'm not sure all of this necessarily makes sense from a spec point of view;
just describing what Gecko does right now.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 29 July 2011 02:29:16 UTC