Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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());
            }
        }
Ejemplo n.º 4
0
        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;
            }
        }