[whatwg] Proposal: ImageData constructor or factory method with preexisting data

Boris Zbarsky bzbarsky at MIT.EDU
Mon Mar 11 19:03:17 PDT 2013


On 3/11/13 7:28 PM, Kenneth Russell wrote:
> Proposed IDL:
>
> [NoInterfaceObject]
> interface ImageDataFactories {
>    ImageData createImageData(Uint8ClampedArray data, double sw, double sh);
> };
> Window implements ImageDataFactories;
> WorkerGlobalScope implements ImageDataFactories;

How about just:

   [Constructor(Uint8ClampedArray data, double sw, double sh)]
   interface ImageData {
     /* Whatever is currently there */
   };

and then you create one with:

   new ImageData(someData, someWidth, someHeight);

Other than needing to specify whether the array is copied or held on to 
by reference, and specifying that this interface should be exposed in 
workers, this seems fine to me.

-Boris



More information about the whatwg mailing list