W3C home > Mailing lists > Public > public-html@w3.org > March 2013

RE: Proposal: ImageData constructor

From: Rik Cabanier <cabanier@adobe.com>
Date: Wed, 13 Mar 2013 09:15:10 -0700
To: Leonard Rosenthol <lrosenth@adobe.com>, HTMLWG WG <public-html@w3.org>
Message-ID: <83F37C1A4497B54589EAEDC750D03A941F07DD9D73@nambx09.corp.adobe.com>
Hi Leonard,

imageData is a class that already exists [1]. This proposal just adds a constructor so you can create one yourself instead of having to use  calls like 'createImageData' or 'getImageData' [2].
The spec defines the pixel layout. 

Canvas just support RGB; it has no concept of color management. There is also no support for index images.
I've made a proposal to add masking on the canvas mailing list and will post the request to publish it when I have more time.

1: http://www.w3.org/TR/2dcontext/#imagedata
2: http://www.w3.org/TR/2dcontext/#pixel-manipulation


> -----Original Message-----
> From: Leonard Rosenthol
> Sent: Wednesday, March 13, 2013 1:05 AM
> To: Rik Cabanier; HTMLWG WG
> Subject: 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 16:16:42 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 13 March 2013 16:16:42 GMT