Exemplo n.º 1
0
        private int ParseMCommand(int startIndex, List <string> splited, List <SvgCommand> result, bool isAbsolut = true)
        {
            double x = Double.Parse(splited[++startIndex], CultureInfo.InvariantCulture);
            double y = Double.Parse(splited[++startIndex], CultureInfo.InvariantCulture);

            //Console.WriteLine($"M {x} {y}");
            if (isAbsolut)
            {
                result.Add(factory.MCmd(x, y));
            }
            else
            {
                result.Add(factory.mCmd(x, y));
            }

            return(startIndex);
        }
Exemplo n.º 2
0
        static void testrun1()
        {
            //
            var a = new SvgDocumentParser();
            SvgCommandFactory factory = new SvgCommandFactory();
            SvgCommand        p1      = factory.MCmd(0, 0);
            SvgCommand        p2      = factory.LCmd(70, 70);
            //SvgCommand p3 = factory.LCmd(70, 60);

            SvgElement line = new SvgElement();

            line.Path.Add(p1);
            line.Path.Add(p2);
            //line.Path.Add(p3);
            line.SetAttribute("stroke", "red");
            line.SetAttribute("fill", "transparent");

            //PathOperation.ScalePath(ref line, 0.5);
            //PathOperation.TranslatePath(ref line, 250, 250);

            SvgCommand d = new SvgCommand();

            d.x = 35;
            d.y = 35;

            PathMatrixOperation.RotatePathToDegrees(ref line, 45, d);



            SvgDocumentWriter writer = new SvgDocumentWriter();

            SvgWrapper wrapper = new SvgWrapper();

            wrapper.SetChild("one", line);

            writer.WriteToFile("MySvg.svg", wrapper);
        }