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

Re: Proposal: ImageData constructor

From: Leonard Rosenthol <lrosenth@adobe.com>
Date: Wed, 13 Mar 2013 10:17:02 -0700
To: Rik Cabanier <cabanier@adobe.com>, HTMLWG WG <public-html@w3.org>
Message-ID: <CD666ECA.ECBB%lrosenth@adobe.com>
I understand all that Rik - but it doesn't address my comment.

You are constructing an image from an array of pixel data.  You can't do
that unless you either hardcode/fix the format of the array (eg. RGB) _OR_
you have a parameter that defines the format (RGB vs. BGR vs. ARGB etc.)

Leonard




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

>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 17:17:29 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 13 March 2013 17:17:29 GMT