W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2012

[whatwg] Size of SVG->Img->Canvas

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 31 Jan 2012 19:39:30 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1201311938450.3868@ps20323.dreamhostps.com>
On Thu, 17 Nov 2011, Gavin Kistner wrote:
>
> Imagine an SVG file displayed in an img: <img id="i" src="my.svg" ... >
> 
> The SVG file can have an explicit size (height and width attributes, in 
> a variety of CSS units), or it can have no size (defaulting to "100%"). 
> Whether or not the SVG file has explicit units, it may have an intrinsic 
> aspect ratio (via the viewBox attribute).
> 
> The img can have an explicit size (height and width attributes) or no 
> size. Separate from these, it may or may not have a separate display 
> size (CSS units).
> 
> Now imagine that the user draws this img to a canvas:
> 
>     myCanvasContext.drawImage( document.querySelector('#i'), 0, 0 );
> 
> In each of the eight combinations of (img heightwidth/CSS 
> heightwidth/SVG heightwidth) being present or not, what are the 
> intrinsic dimensions of the "image" drawn to the canvas?

As others have pointed out, this is defined by reference to the CSS 
"Concrete Object Size Resolution" algorithm.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 31 January 2012 11:39:30 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:39 UTC