W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2007

[whatwg] new ImageData(w, h) proposal

From: Mathieu HENRI <p01@opera.com>
Date: Mon, 05 Mar 2007 14:30:05 +0100
Message-ID: <45EC1B5D.9080509@opera.com>
Hi,

The ImageData [1] object used in Canvas should be instantiable like
HTMLImageElement are using the Image constructor [2,3]. I suggest to:



* Mention the ImageData constructor in [1]:

     Note: An instance of ImageData can be obtained using the ImageData
constructor.


* Specify the ImageData constructor should go in 3.14.7.1.10. Pixel
manipulation [4]:

     ImageData(in unsigned long w, in unsigned long h)

     Constructs an ImageData object. The new object's width and height
attributes must be set to respectively w and h. The new object's data is
set to transparent black, that is w*h*4 integers set to 0.

     If either w or h are non-positive an INDEX_SIZE_ERR exception must 
be raised.



This way developers will be able to create ImageData without using an
intermediary Canvas. The security model depicted at the end of [5]
applies and will prevent privacy and security issues.



Any objections or remarks ?

Regards,



[1] http://www.whatwg.org/specs/web-apps/current-work/#imagedata
[2] http://www.whatwg.org/specs/web-apps/current-work/#htmlimageelement
[3] http://www.whatwg.org/specs/web-apps/current-work/#image0
[4] http://www.whatwg.org/specs/web-apps/current-work/#pixel
[5] http://www.whatwg.org/specs/web-apps/current-work/#the-canvas

-- 
Mathieu 'p01' HENRI
JavaScript developer, Opera Software ASA
Received on Monday, 5 March 2007 05:30:05 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:53 UTC