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

On Tue, 1 Jul 2008, Mathieu HENRI wrote:
> 
> 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.

On Thu, 3 Jul 2008, Mathieu HENRI wrote:
> 
> Note that if the fear of breaking existing content is too big, we could 
> limit ourselves to just add variants of drawImage() taking an ImageData 
> as image argument. This addition is backward compatible and should be 
> rather trivial for implementors.

If you want to scale a part of a canvas, why can't you just use 
drawImage() with that part of the canvas directly?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 30 April 2009 14:45:38 UTC