[whatwg] on ImageData, putImageData() and drawImage()

Mathieu HENRI p01 at opera.com
Tue Jul 1 05:21:44 PDT 2008


Hi,

As of today the variants of the putImageData() method copy a region of 
an ImageData (in device pixels) straight to a Canvas (in intrinsic 
pixels) and do not allow to scale the region further than the obvious 
device to intrinsic "scaling".

This means that if a developer needs to copy and scale a region of an 
ImageData, he needs to do so in 2 passes, and use a temporary Canvas.

Also, although the the putImageData() and drawImage() methods do more or 
less the same thing, their arguments differ greatly.



This is why, in order to allow scaling of ImageData and to simplify the 
blit operations, I propose to:


* remove the putImageData() method and all its variants in favor of 
allowing the image argument of the drawImage() methods to be an instance 
of either an HTMLImageElement, an HTMLCanvasElement or an ImageData.

* rename the remaining getImageData(sx, sy, sw, sh) method to become a 
new variant of the createImageData() method:

	createImageData(sx, sy, sw, sh)



These modifications would make the blit and blit-related operations of 
the Canvas API more simple and uniform.


Kind regards,

-- 
Mathieu 'p01' HENRI
JavaScript developer, Opera Software ASA



More information about the whatwg mailing list