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

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