[whatwg] Canvas size and double buffering.

Nikita Popov privat at ni-po.com
Thu Feb 4 01:51:10 PST 2010

Am 04.02.2010 01:00, schrieb Tim Hutt:
> On 3 February 2010 23:16, Boris Zbarsky<bzbarsky at mit.edu>  wrote:
>> On 2/3/10 6:12 PM, Tim Hutt wrote:
>>> Ah yes that works nicely
> Hmm maybe I spoke too soon. The interaction of the CSS size and the
> canvas.width/height is confounding! It seems if you set a CSS width
> of, say 80% then that is that and you are stuck with it. Unfortunately
> it doesn't round to the nearest pixel!
> I have created a test case here:
> http://concentriclivers.com/canvas.html (the source is nicely
> formatted and very short)
> If anyone can get it to work as described on that page, then thank
> you! Otherwise I think things need to be changed to make it possible.
This one satisfies at least the styling conditions (in Firefox and Chrome):
* The canvas has 80% width
* The canvas has 50% height (This one worked in Firefox only after 
setting height 100% on body and html. Strange...)
* Resizes when the browser resizes
* Is centered
I only couldn't figure out the  "Always draw a non-aliased pattern of 
lines" part in Firefox. I tried some stuff, but it didn't work.

More information about the whatwg mailing list