
通过 安装,命令窗口方式:
Install-Package Svgdotnet add package SvgLinux环境
sudo add-apt-repository ppa:quamotion/ppasudo apt-get updatesudo apt-get install -y libgdiplus使用例子
画三个圈重叠例子
代码:
class Program{static void Main(string[] args) {string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"../../../sample.svg");var sampleDoc = SvgDocument.Open<SvgDocument>(filePath, new Dictionary<string, string> { {"entity1", "fill:red" }, {"entity2", "fill:yellow" } });sampleDoc.Draw().Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"../../../sample.png")); }}Svg代码:
<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" width="800" height="800"><g style="fill-opacity:0.7;"><circle cx="6.5cm" cy="2cm" r="100" style="&entity1;" transform="translate(0,50)" /><circle cx="6.5cm" cy="2cm" r="100" style="&entity2;" transform="translate(70,150)" /><circle cx="6.5cm" cy="2cm" r="100" style="fill:green;" transform="translate(-70,150)"/></g></svg>
项目地址:https://github.com/svg-net/SVG