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

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

From: Mathieu HENRI <p01@opera.com>
Date: Thu, 03 Jul 2008 14:53:34 +0200
Message-ID: <486CCBCE.3040303@opera.com>
Mathieu HENRI wrote:
> 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)


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.


> 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 Thursday, 3 July 2008 05:53:34 UTC

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