[whatwg] Proposal: ImageData constructor or factory method with preexisting data

Glenn Maynard glenn at zewt.org
Tue Mar 12 17:04:45 PDT 2013


On Tue, Mar 12, 2013 at 6:54 PM, Rik Cabanier <cabanier at gmail.com> wrote:

> It feels like something is missing. How does putImageDataHD know that the
> bitmap should be scaled? Width and height refer to the pixel dimensions and
> not the 'px' unit
>

It's putImageData that scales, not putImageDataHD.

putImageData *always* scales by the pixel ratio.  If you're on a system
with a ratio of 2, calling putImageData with a 500x1000 buffer will always
draw a 1000x2000 image, scaling the image up.  putImageDataHD on a 500x1000
buffer will always draw a 500x1000 image, regardless of the pixel ratio.

In other words, the blitter knows whether to scale or not based on whether
it was putImageData or putImageDataHD that you called, not on something
inside the ImageData you passed in.

-- 
Glenn Maynard



More information about the whatwg mailing list