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

Ian Hickson ian at hixie.ch
Fri Jun 5 01:09:30 PDT 2009

On Thu, 30 Apr 2009, Charles Pritchard wrote:
> 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.
> Ian replies (Apr 30th 2008)
> > If you want to scale a part of a canvas, why can't you just use
> > drawImage() with that part of the canvas directly?
> If all you are looking to do is an affine transformation, then of course 
> you would only use drawImage.
> If you are looking to do an affine transformation, after you've modified 
> the contents of an ImageData object (say, by running an edge filter), 
> then you are forced to use a temporary canvas.
> The primary reason for running the affine transformation After running 
> the ImageData filter is for speed -- you can use a down-sampled image, 
> run it through a filter, then re-size it (losing quality, of course) 
> and/or rotate it.
> There are other uses I'm sure.. but that's one that comes to mind.
> drawImage(ImageData) would save us the extra step of using 
> putImageData(tmp) followed by drawImage(tmp).

This makes sense. I've noted it as a possible feature for a future 
version, since I'm trying to go into feature freeze for HTML5 now.

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

More information about the whatwg mailing list