Aspect ratio quirk/bug in version 1.7.0

Oct 9, 2014 at 10:38 AM
Hello,

I just spent a lot of time trying to figure out why I cannot draw my SVG files with other than 1:1 aspect ratio with the latest version of SVG Rendering Engine. I had exactly the same code in 2 projects, only difference being that the other one used version 1.6.1, and the other one 1.7.0.

The code:
Bitmap target = new Bitmap(400, 400);

using (var g = Graphics.FromImage(target))
{
     g.Clear(Color.Black);
     Svg.SvgDocument svgDoc = Svg.SvgDocument.Open(@"C:\\button.svg");
     int x = 100;
     int y = 200;
     svgDoc.Width = x;
     svgDoc.Height = y;
     g.DrawImage(svgDoc.Draw(), 0, 0, x, y); 
}

this.pictureBox1.Image = target;
So what this code is doing is it renders the button.svg to the top left corner of 400x400 bitmap with width of 100 and height of 200. But the thing is, with the newer 1.7.0 version the result is not as expected - the image is translated rather than stretched. With version 1.6.1 the result is as expected.

The reason is that the default value for AspectRatio member is "xMidYMid", when in the version 1.6.1 it was "none".

The workaround is to do svgDoc.AspectRatio = new SvgAspectRatio(); after instantiating the svgDoc.

But is this a known bug, or a feature?
Dec 10, 2014 at 10:11 PM
the codeplex repo is over 2 years old, please use this fork now: https://github.com/vvvv/SVG