On Jun 4, 2010, at 10:05 AM, Rob Evans wrote:

> Hi,
>  
>                 I wonder if this is the correct place to post this but I 
> cannot find any resources online as canvas is so new.
Canvas isn't new -- it's at least 4 or 5 years old, and has been in the html5 
spec for at least 2 or 3 of those years -- I believe the MDC has some of the 
best API documentation (at least in terms of providing examples of how the APIs 
are used.)

>  
>                 After grabbing some image data from a canvas with the 
> getImageData call, I cannot find a way to put the image data onto a canvas 
> scaled down.
>  
>                 If I use the canvas scale function and then put the image 
> data, no scaling occurs. Is there any way to scale with putImageData?

No. The ImageData API documentation is very clear on this, and has not changed 
substantively in a few years now.  get/putImageData are not effected by the 
current CTM.


>                 If not I think it would be a useful addition to the 
> specification. I can imagine many situations where copying a section of the 
> canvas and applying scaling before pasting it back to the canvas would be 
> useful!

You shouldn't be using ImageData to do this -- 
CanvasRenderingContext2D.drawImage supports canvas elements, and has well 
defined semantics for drawing the contents of a canvas element into its own 
context -- in addition to supporting non-identity CTMs this is also likely 
quite a bit faster in the identity case than an imagedata based approach.  Is 
there some specific reason you want to use the ImageData API?

--Oliver
>  
> Thanks,
>  
> Rob Evans
> CTO
> mtn-i LTD

Reply via email to