W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2008

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

From: Mathieu HENRI <p01@opera.com>
Date: Tue, 01 Jul 2008 14:21:44 +0200
Message-ID: <486A2158.2000105@opera.com>
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
Received on Tuesday, 1 July 2008 05:21:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:03 UTC