[cairo] SVG viewBox misunderstanding

Travis Griggs tgriggs at cincom.com
Thu Oct 22 21:45:58 PDT 2009


Carl's response, and some further discussion in irc helped me get to  
the bottom of things, kind of.

Carl's svg2png trace showed that the svg file does represent the icon  
properly, which isn't a surprise (I've attached a lighter/trimmed  
version of it again).

What the trace shows is a singular matrix set:

[0.141041    0                     1.842245
0                 0.144761        3.217366 ]

What I don't get is how it came to that conclusion, *in particular*  
the yy value. The 3 inputs from the svg file are:

viewBox ( 0 0 64.424 51.278 )
width&height 16
additional transform matrix (0.6031636,  0,  0,  0.6190702,  7.87836,   
5.1860675)

If one runs the number for the XX component of the matrix, it should  
be 16 / 64.424 * 0.6031636. Which it is. It's correct. But if one does  
16 / 51.278 * 0.619072, it is NOT 0.144761. What seems to be correct,  
is to ignore the height of the viewBox attribute, and use the width as  
the height instead: 16 / 64.424 * 0.619072.

So what I don't understand, and am begging any SVG gurus to explain,  
is why the 64.424 is used for both width and height. That's obviously  
what I'm supposed to have done here, but I don't get *why*. I looked  
around in librsvg a *little* and didn't see anything obvious right away.

TIA

--
Travis Griggs
Objologist
My Other Machine runs OSX. But then... so does this one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Array.svg
Type: image/svg+xml
Size: 5295 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20091022/c192ae7a/attachment.svg 
-------------- next part --------------



More information about the cairo mailing list