有没有一种简单的方法可以将 SVG 路径标记转换为 C# System.Drawing.Drawing2D.GraphicsPath?它们密切相关,我希望可以轻松地将 SVG 路径数据转换为 GraphicsPath 点。
最佳答案
This SVG project通过以下方式提供解决方案:
var pathData = ...;
var graphicsPath = new GraphicsPath();
foreach (var segment in SvgPathBuilder.Parse(pathData))
segment.AddToPath(graphicsPath);
graphics.DrawPath(Pens.Black, graphicsPath);
它可以作为 NuGet 包通过以下方式获得:
PM> Install-Package Svg
关于c# - 将 SVG 路径数据转换为 GDI+ GraphicsPath 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5711503/