[whatwg] custom ImageData objects

On Sun, 13 May 2007 11:49:23 +0200, Anne van Kesteren <annevk at opera.com>  
wrote:
> In a reply to a message from Mathieu Hixie indicated that you can create  
> your own ImageData objects easily in ECMAScript:
>
>    var data = { height:1, width:1, data:[0,0,0,0] }
>    context.putImageData(data, 0, 0)
>
> I would like the specification to clarify how exactly these custom  
> ImageData objects are to be created and what an implementation hsa to do  
> with them. Several questions about these custom objects:
>
>   * What if it has missing members.
>   * What if it has additional members.
>   * What if the values of the members are incorrect.
>     - height contains a function
>     - data is a two-digit array
>     - etc.
>   * What if the combination of values of the members is
>     incorrect.
>     - height and width say 2, but data only contains a
>       four-digit array.

Oops. I was looking at the May 10 version of the specification. My  
apologies. It would probably still be good to point out that you can  
create ImageData objects yourself by making a simple ECMAScript object.


> If this is indeed to be allowed (and it seems to work fine in Firefox)  
> this is an additional argument for not having a distinction between the  
> <canvas> "back end" grid and the actual <canvas> grid as people will  
> just assume they map one to one once it works that way in an  
> implementation they test in.

This point still stands.


> (Given that you can create them yourself I'm not sure why ImageData has  
> readonly attributes, but maybe that would save some additional  
> checking...)


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Sunday, 13 May 2007 04:21:16 UTC