public void RenderSceneToSVG() { using var svg = SVGSceneDrawing2D.CreateGraphic(); var scene = SceneFactory.CreateRecord3D("Scene1"); scene.DrawTo(svg, 1024, 1024, new Vector3(7, 5, 20)); AttachmentInfo.From("document.svg").WriteAllText(svg.ToSVGContent()); }
public void ParsePathAndFill(string path) { using (var svg = SVGSceneDrawing2D.CreateGraphic()) { svg.DrawPath(System.Numerics.Matrix3x2.Identity, path, (System.Drawing.Color.Red, System.Drawing.Color.Blue, 2)); var document = svg.ToSVGContent(); AttachmentInfo.From("document.svg").WriteAllText(document); } }
public void TestSVG() { using (var svg = SVGSceneDrawing2D.CreateGraphic()) { svg.DrawLine((0, 0), (100, 100), 2, (COLOR.SkyBlue, LineCapStyle.Round, LineCapStyle.Triangle)); svg.DrawRectangle((10, 10), (80, 80), (COLOR.Blue, 4)); svg.DrawEllipse(new Vector2(50, 50), 70, 70, (COLOR.Red, 2)); AttachmentInfo.From("document.svg").WriteAllText(svg.ToSVGContent()); } }
public static void AttachToCurrentTest(this Record2D batch, string filePath) { var ainfo = NUnit.Framework.AttachmentInfo.From(filePath); if (filePath.ToLower().EndsWith(".svg")) { ainfo.WriteObject(f => SVGSceneDrawing2D.SaveToSVG(f, batch)); return; } if (filePath.ToLower().EndsWith(".png") || filePath.ToLower().EndsWith(".jpg") || filePath.ToLower().EndsWith(".gif")) { ainfo.WriteObject(f => Canvas2DFactory.SaveToBitmap(f, 1024, 1024, null, batch)); return; } }