W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

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

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 12 Mar 2013 19:04:45 -0500
Message-ID: <CABirCh8D7kCz0y0=wdHtyQUARKsSy-VCE24rUyztt_KkTwLE=w@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: whatwg@lists.whatwg.org, Boris Zbarsky <bzbarsky@mit.edu>
On Tue, Mar 12, 2013 at 6:54 PM, Rik Cabanier <cabanier@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
Received on Wednesday, 13 March 2013 00:05:34 GMT

This archive was generated by hypermail 2.3.1 : Wednesday, 13 March 2013 00:05:34 GMT