Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 771 Bytes

README.md

File metadata and controls

19 lines (16 loc) · 771 Bytes

resvg.net

.NET (Core) wrapper for resvg; an SVG rendering library.

Usage

using resvg.net;
...
string svgdata = File.ReadAllText(@"C:\Path\To\Svg\File.svg", Encoding.UTF8);
using Resvg resvg = Resvg.FromData(svgdata, loadSystemFonts: true);
Size size = resvg.Size.ToSize();
using Bitmap bitmap = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppPArgb);
Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData data = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppPArgb);
resvg.Render(data.Scan0, size.Width, size.Height, PixelOpFlags.RgbaToBgra);
bitmap.UnlockBits(data);
bitmap.Save("output.png");