Exemple #1
0
            public void ParseSVGPath(string p)
            {
                Token Current = new Token();


                for (int i = 0; i < p.Length; i++)
                {
                    if (Current.AddChar(p[i]) == false)
                    {
                        Tokens.Add(Current);
                        Current = new Token();
                        Current.AddChar(p[i]);
                    }
                }


                if (Current.Type != TokenType.NoType)
                {
                    Current.AddChar(' ');
                    Tokens.Add(Current);
                }

                Token N = NextToken();

                while (N != null)
                {
                    switch (N.command)
                    {
                    case 'M': MoveToAbs(NextToken().value, NextToken().value); break;

                    case 'm': MoveToRel(NextToken().value, NextToken().value); break;

                    case 'L': LineToAbs(NextToken().value, NextToken().value); break;

                    case 'l':
                        LineToRel(NextToken().value, NextToken().value);
                        break;

                    case 'H':
                        HorizToAbs(NextToken().value);
                        break;

                    case 'h':
                        HorizToRel(NextToken().value);
                        break;

                    case 'V':
                        VertToAbs(NextToken().value);
                        break;

                    case 'v':
                        VertToRel(NextToken().value);
                        break;

                    case 'C':
                        CurveToAbs(NextToken().value, NextToken().value, NextToken().value, NextToken().value, NextToken().value, NextToken().value);
                        break;

                    case 'c':
                        CurveToRel(NextToken().value, NextToken().value, NextToken().value, NextToken().value, NextToken().value, NextToken().value);
                        break;

                    case 'Z':
                    case 'z':
                        ClosePoly();
                        break;
                    }
                    N = NextToken();
                }

                ClosePoly();
            }