[whatwg] custom ImageData objects

Anne van Kesteren annevk at opera.com
Sun May 13 02:49:23 PDT 2007


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.

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.

(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/>



More information about the whatwg mailing list