예제 #1
0
 protected SvgPathSegArc(SvgPathSegType type, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) : base(type)
 {
     this.x            = x;
     this.y            = y;
     this.r1           = r1;
     this.r2           = r2;
     this.angle        = angle;
     this.largeArcFlag = largeArcFlag;
     this.sweepFlag    = sweepFlag;
 }
예제 #2
0
 protected SvgPathSegArc(SvgPathSegType type, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)
     : base(type)
 {
     this.x = x;
     this.y = y;
     this.r1 = r1;
     this.r2 = r2;
     this.angle = angle;
     this.largeArcFlag = largeArcFlag;
     this.sweepFlag = sweepFlag;
 }
 protected SvgPathSegArc(SvgPathSegType type, double x, double y, double r1, double r2,
                         double angle, bool largeArcFlag, bool sweepFlag)
     : base(type)
 {
     _x            = x;
     _y            = y;
     _r1           = r1;
     _r2           = r2;
     _angle        = angle;
     _largeArcFlag = largeArcFlag;
     _sweepFlag    = sweepFlag;
 }
예제 #4
0
 protected SvgPathSegArc(SvgPathSegType type, double x, double y, double r1, double r2,
                         double angle, bool largeArcFlag, bool sweepFlag)
     : base(type)
 {
     this.x            = x;
     this.y            = y;
     this.r1           = r1;
     this.r2           = r2;
     this.angle        = angle;
     this.largeArcFlag = largeArcFlag;
     this.sweepFlag    = sweepFlag;
 }
예제 #5
0
 protected SvgPathSegArc(SvgPathSegType type, double x, double y, double r1, double r2,
     double angle, bool largeArcFlag, bool sweepFlag)
     : base(type)
 {
     this.x            = x;
     this.y            = y;
     this.r1           = r1;
     this.r2           = r2;
     this.angle        = angle;
     this.largeArcFlag = largeArcFlag;
     this.sweepFlag    = sweepFlag;
 }
예제 #6
0
파일: Types.cs 프로젝트: 894880010/MP
 public PathSeg(SvgPathSegType t, bool a, float[] arr)
 {
     _type = t;
     _abs  = a;
     _data = arr;
 }
 protected SvgPathSegCurvetoQuadratic(SvgPathSegType type)
     : base(type)
 {
 }
 protected SvgPathSegMoveto(SvgPathSegType type, double x, double y)
     : base(type)
 {
     _x = x;
     _y = y;
 }
 protected SvgPathSegLineto(SvgPathSegType type) : base(type)
 {
 }
예제 #10
0
 protected SvgPathSegMoveto(SvgPathSegType type, float x, float y) : base(type)
 {
     this.x = x;
     this.y = y;
 }
예제 #11
0
파일: Types.cs 프로젝트: luizcorreia/SvgNet
 public PathSeg(SvgPathSegType t, bool a, float[] arr)
 {
     _type = t;
     _abs = a;
     _data = arr;
 }
예제 #12
0
 public PathSeg(SvgPathSegType t, bool a, float[] arr)
 {
     this._type = t;
     this._abs  = a;
     this._data = arr;
 }
예제 #13
0
        /// <summary>
        /// The parsing of the path is not completely perfect yet.  You can only have one space between path elements.
        /// </summary>
        /// <param name="s"></param>
        public void FromString(string s)
        {
            string[] sa = s.Split(new char[] { ' ', ',', '\t', '\r', '\n' });

            PathSeg        ps;
            int            datasize = 0;
            SvgPathSegType pt       = SvgPathSegType.SVG_SEGTYPE_UNKNOWN;
            bool           abs      = false;
            int            i        = 0;
            char           segTypeChar;

            _path = new ArrayList();


            while (i < sa.Length)
            {
                if (sa[i] == "")
                {
                    i += 1;
                    continue;
                }

                //check for a segment-type character

                if (char.IsLetter(sa[i][0]))
                {
                    segTypeChar = sa[i][0];


                    if (segTypeChar == 'M' || segTypeChar == 'm')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_MOVETO;
                        abs      = (segTypeChar == 'M');
                        datasize = 2;
                    }
                    else if (segTypeChar == 'Z' || segTypeChar == 'z')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_CLOSEPATH;
                        datasize = 0;
                    }
                    else if (segTypeChar == 'L' || segTypeChar == 'l')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_LINETO;
                        abs      = (segTypeChar == 'L');
                        datasize = 2;
                    }
                    else if (segTypeChar == 'H' || segTypeChar == 'h')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_HLINETO;
                        abs      = (segTypeChar == 'H');
                        datasize = 1;
                    }
                    else if (segTypeChar == 'V' || segTypeChar == 'v')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_VLINETO;
                        abs      = (segTypeChar == 'V');
                        datasize = 1;
                    }
                    else if (segTypeChar == 'C' || segTypeChar == 'c')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_CURVETO;
                        abs      = (segTypeChar == 'C');
                        datasize = 6;
                    }
                    else if (segTypeChar == 'S' || segTypeChar == 's')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_SMOOTHCURVETO;
                        abs      = (segTypeChar == 'S');
                        datasize = 4;
                    }
                    else if (segTypeChar == 'Q' || segTypeChar == 'q')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_BEZIERTO;
                        abs      = (segTypeChar == 'Q');
                        datasize = 4;
                    }
                    else if (segTypeChar == 'T' || segTypeChar == 't')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_SMOOTHBEZIERTO;
                        abs      = (segTypeChar == 'T');
                        datasize = 2;
                    }
                    else if (segTypeChar == 'A' || segTypeChar == 'a')
                    {
                        pt       = SvgPathSegType.SVG_SEGTYPE_ARCTO;
                        abs      = (segTypeChar == 'A');
                        datasize = 7;
                    }
                    else
                    {
                        throw new SvgException("Invalid SvgPath", s);
                    }

                    //strip off type character
                    sa[i] = sa[i].Substring(1);

                    if (sa[i] == "")
                    {
                        i += 1;
                    }
                }


                if (pt == SvgPathSegType.SVG_SEGTYPE_UNKNOWN)
                {
                    throw new SvgException("Invalid SvgPath", s);
                }

                float[] arr = new float[datasize];

                for (int j = 0; j < datasize; ++j)
                {
                    arr[j] = float.Parse(sa[i + j], System.Globalization.CultureInfo.InvariantCulture);
                }

                ps = new PathSeg(pt, abs, arr);

                _path.Add(ps);

                i += datasize;
            }
        }
예제 #14
0
 protected SvgPathSegMoveto(SvgPathSegType type, double x, double y)
     : base(type)
 {
     this.x = x;
     this.y = y;
 }
예제 #15
0
 protected SvgPathSegMoveto(SvgPathSegType type, double x, double y)
     : base(type)
 {
     this.x = x;
     this.y = y;
 }
예제 #16
0
 protected SvgPathSegLineto(SvgPathSegType type)
     : base(type)
 {
 }
예제 #17
0
 protected SvgPathSegCurvetoCubic(SvgPathSegType type)
     : base(type)
 {
 }
예제 #18
0
 protected SvgPathSeg(SvgPathSegType type)
 {
     this._type = type;
 }
예제 #19
0
 protected SvgPathSegCurvetoCubic(SvgPathSegType type) : base(type)
 {
 }
예제 #20
0
        public void FromString(string s)
        {
            string[] array = s.Split(new char[]
            {
                ' ',
                ',',
                '\t',
                '\r',
                '\n'
            });
            int            num            = 0;
            SvgPathSegType svgPathSegType = SvgPathSegType.SVG_SEGTYPE_UNKNOWN;
            bool           a = false;
            int            i = 0;

            this._path = new ArrayList();
            while (i < array.Length)
            {
                if (array[i] == "")
                {
                    i++;
                }
                else
                {
                    if (char.IsLetter(array[i][0]))
                    {
                        char c = array[i][0];
                        if (c == 'M' || c == 'm')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_MOVETO;
                            a   = (c == 'M');
                            num = 2;
                        }
                        else if (c == 'Z' || c == 'z')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_CLOSEPATH;
                            num            = 0;
                        }
                        else if (c == 'L' || c == 'l')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_LINETO;
                            a   = (c == 'L');
                            num = 2;
                        }
                        else if (c == 'H' || c == 'h')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_HLINETO;
                            a   = (c == 'H');
                            num = 1;
                        }
                        else if (c == 'V' || c == 'v')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_VLINETO;
                            a   = (c == 'V');
                            num = 1;
                        }
                        else if (c == 'C' || c == 'c')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_CURVETO;
                            a   = (c == 'C');
                            num = 6;
                        }
                        else if (c == 'S' || c == 's')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_SMOOTHCURVETO;
                            a   = (c == 'S');
                            num = 4;
                        }
                        else if (c == 'Q' || c == 'q')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_BEZIERTO;
                            a   = (c == 'Q');
                            num = 4;
                        }
                        else if (c == 'T' || c == 't')
                        {
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_SMOOTHBEZIERTO;
                            a   = (c == 'T');
                            num = 2;
                        }
                        else
                        {
                            if (c != 'A' && c != 'a')
                            {
                                throw new SvgException("Invalid SvgPath", s);
                            }
                            svgPathSegType = SvgPathSegType.SVG_SEGTYPE_ARCTO;
                            a   = (c == 'A');
                            num = 7;
                        }
                        array[i] = array[i].Substring(1);
                        if (array[i] == "")
                        {
                            i++;
                        }
                    }
                    if (svgPathSegType == SvgPathSegType.SVG_SEGTYPE_UNKNOWN)
                    {
                        throw new SvgException("Invalid SvgPath", s);
                    }
                    float[] array2 = new float[num];
                    for (int j = 0; j < num; j++)
                    {
                        array2[j] = float.Parse(array[i + j], CultureInfo.InvariantCulture);
                    }
                    PathSeg value = new PathSeg(svgPathSegType, a, array2);
                    this._path.Add(value);
                    i += num;
                }
            }
        }
예제 #21
0
 protected SvgPathSeg(SvgPathSegType type)
 {
     this.type = type;
 }
예제 #22
0
 protected SvgPathSeg(SvgPathSegType type)
 {
     _type = type;
 }
예제 #23
0
 protected SvgPathSegCurvetoQuadratic(SvgPathSegType type)
     : base(type)
 {
 }
예제 #24
0
 protected SvgPathSegMoveto(SvgPathSegType type, float x, float y)
     : base(type)
 {
     this.x = x;
     this.y = y;
 }