Proposal: ImageData constructor

All,

Ken Russell proposed the following addition to the 2D canvas:

[Constructor(Uint8ClampedArray data, double sw, double sh)]
  interface ImageData {
    readonly attribute unsigned long width;
    readonly attribute unsigned long height;
    readonly attribute Uint8ClampedArray data;
  };

The new constructor allows you to construct a new ImageData object from an Uint8ClampedArray. The imageData object simply assigns:
- width = sw
- height = sh
- data = data

Before this API, you had to construct the imagedata  with a width and height and then copy the pixels between the arrays manually.

If there are no objections to this, I will add this to the canvas 2d spec.

Rik

Received on Wednesday, 13 March 2013 04:13:12 UTC