Re: Proposal: ImageData constructor

Wouldn't you also need to know information about the array's contents?
For example, is it always RGBA?  What if I have ARGB data?  Or just RGB
w/o an alpha channel?  Or BGR?  Of course, that assumes just simple sRGB
data.  (I am going to ASSUME that profiled or indexed image data is
handled via the ImageData class after instantiation).

Leonard

On 3/13/13 5:12 AM, "Rik Cabanier" <cabanier@adobe.com> wrote:

>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 08:05:52 UTC