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

Re: [whatwg] High-density canvases

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 9 Sep 2013 17:07:30 -0700
Message-ID: <CAAWBYDCY-aCuZUDF+Snh25QNcS7ZkWFQGxgeMKW1MsYf0e_c+w@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: Stephen White <senorblanco@chromium.org>, Dean Jackson <dino@apple.com>, Rik Cabanier <cabanier@gmail.com>, WHAT Working Group <whatwg@whatwg.org>
On Mon, Sep 9, 2013 at 5:00 PM, Ian Hickson <ian@hixie.ch> wrote:
> It would be nice to fix these all at once, and I think we can, by
> introducing a configuration option on getContext(), in the style of WebGL:
>
>    getContext('2d', { density: 'autosize' });
>
> This would trigger the following behaviour: When the context is created,
> and subsequently when the <canvas> changes size (e.g. due to being sized
> with CSS relative units and the element they're relative to changing), or
> when the display density changes size (e.g. due to page zoom), then:
>
>    - the width and height of the canvas bitmaps get updated to match the
>      new native size of the <canvas>, at native density.
>
>    - the coordinate space of the canvas (context.width/context.height)
>      gets updated to match the size of the <canvas> in CSS pixel units.
>
>    - a 'resize' event gets fired at the <canvas>.
>
> We would dump the *HD versions of the methods, and make the regular ones
> go back to returning the actual raw pixels, since that would now work fine
> and still provide HD-quality content everywhere it's available.
>
> What do people think?

Sounds reasonable to me.  Firing a resize directly at the <canvas> is
nice and convenient.

~TJ
Received on Tuesday, 10 September 2013 00:08:15 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC