RE: getZoomPercent - Zoom level needed for Canvas bitmaps

Internet Explorer has the deviceXDPI property: http://msdn.microsoft.com/en-us/library/ms533721(VS.85).aspx (First added in IE6)
Starting with IE8, the browser's initial zoom level will match the OS DPI setting (For example, a lot of laptops are set to 120dpi (not 96dpi); all OS / app UI is drawn scaled up 1.25x; so 125% zoom is the initial default in IE.)

To solve the authoring issue, a media query based approach was introduced on the webkit blog some time ago: http://webkit.org/blog/55/high-dpi-web-sites/ but afaik is not actually implemented anywhere.


-----Original Message-----
From: public-canvas-api-request@w3.org [mailto:public-canvas-api-request@w3.org] On Behalf Of Charles Pritchard
Sent: Monday, November 08, 2010 11:12 AM
To: public-canvas-api@w3.org
Subject: getZoomPercent - Zoom level needed for Canvas bitmaps

Is there a standard in place to get the current zoom level?

When a user agent zooms the web page, changing the logical pixel ratio, Canvas elements may be repainted at a higher resolution, to maintain crispness.

For example, at a 2x zoom, the pixel width/height are effectively doubled.

So the following would show up at 300x150 pixels, matching the bitmap:
<canvas style="width: 150px; height: 75px;" width="300" height="150">

I've brought this up in a few groups, but I don't know that it's gone anywhere.

Some Chrome-related discussion of zoom APIs can be found at the following link:
http://code.google.com/p/chromium/issues/detail?id=30583

document.body.style.zoom
chrome.tabs.getZoomPercent

There is a whole lot of quirk between the major browsers, in identifying the current zoom level and available screen pixels. By standardizing an onZoom event and zoomRatio getter, we could both repaint our canvas elements to match the zoom level. Our current method for detecting zoom is fragile and low precision.


-Charles

Received on Monday, 8 November 2010 20:02:12 UTC