コード例 #1
0
        public void QuickTest()
        {
            var svgFilePath = Path.Combine(Utils.TestFolder, "Test", "Test.svg");

            Debug.WriteLine($"Testing QuickTest: {Path.GetFileName(svgFilePath)} in {Path.GetDirectoryName(svgFilePath)}");
            using (Image <Rgba32> svgImg = SvgImageRenderer.RenderFromString <Rgba32>(File.ReadAllText(svgFilePath)))
            {
                svgImg.Save(Path.Combine(Path.GetDirectoryName(svgFilePath), Path.GetFileNameWithoutExtension(svgFilePath) + ".png"));
            }
        }
コード例 #2
0
 public void SvgTest12(string svgFilePath, string pngFilePath, string resultFilePath)
 {
     Debug.WriteLine($"Testing SVG12: {Path.GetFileName(svgFilePath)} in {Path.GetDirectoryName(svgFilePath)}");
     using (Image <Rgba32> svgImg = SvgImageRenderer.RenderFromString <Rgba32>(File.ReadAllText(svgFilePath)))
         using (var pngImg = Image.Load(pngFilePath))
             using (var result = new Image <Rgba32>(pngImg.Width * 2, pngImg.Height))
             {
                 result.Mutate(x => x.DrawImage(pngImg, new Point(0, 0), 1.0f));
                 result.Mutate(x => x.DrawImage(svgImg, new Point(pngImg.Width, 0), 1.0f));
                 result.Save(resultFilePath);
             }
 }