- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 10 Sep 2013 04:34:28 +0000 (UTC)
- To: Rik Cabanier <cabanier@gmail.com>, Stephen White <senorblanco@chromium.org>, dino@apple.com
- Cc: WHAT Working Group <whatwg@whatwg.org>
On Tue, 10 Sep 2013, Ian Hickson 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? Rik pointed out on IRC that it's common to have out-of-DOM canvases, e.g. for storing textures, which would need to track the density of the one in the DOM. I'd have to think about it in more detail, but in principle it seems some sort of slaving mechanism should be able to handle that too. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 10 September 2013 04:34:53 UTC