[whatwg] new ImageData(w, h) proposal
Mathieu HENRI
p01 at opera.com
Mon Mar 5 05:30:05 PST 2007
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
More information about the whatwg
mailing list