svg-net / SVG

Fork of the ms svg library
http://svg-net.github.io/SVG/
Microsoft Public License
1.16k stars 474 forks source link

Draw to bitmap, sometime zoom-in, sometime crop... #135

Closed rvs76 closed 5 years ago

rvs76 commented 9 years ago

Hi, I try the SVG library in a basic program. The code is very simple:

        DialogResult selectResult = filePicker.ShowDialog();
        if (selectResult == System.Windows.Forms.DialogResult.OK)
        {
            txtSelectedFile.Text = filePicker.FileName;

            svgDocument = SvgDocument.Open(filePicker.FileName);
            float sf1 = pictConvertedImage.Width / svgDocument.Width;
            float sf2 = pictConvertedImage.Height / svgDocument.Height;
            float sf = Math.Min(sf1, sf2);
            svgDocument.Width *= sf;
            svgDocument.Height *= sf;
            pictConvertedImage.Image = svgDocument.Draw();
        }
    }

With https://github.com/picons/picons-source/blob/master/build-source/tv/alekino%2Bhd.svg, the svg fit correctly the PictureBox(PictConvertedImage), but if i try with https://github.com/picons/picons-source/blob/master/build-source/tv/123tvhd.svg, the svg is always crop. I don' t know if it's a bug from SVG or if it's a bad implementation from me.

Test with the latest code (2015/03/09).

Sorry for my bad english.

mrbean-bremen commented 5 years ago

As this is quite old, the links are invalid and the information is not sufficient to explain the problem, I'm closing this. Feel free to reopen it with more information.