Exemplo n.º 1
0
 /***********************************************************************************/
 private void SetList(SVGPathSeg newItem)
 {
     if (newItem != null)
     {
         newItem.SetList(this);
     }
 }
Exemplo n.º 2
0
 public SVGPathSegQuadBezTo(float x1, float y1, float x, float y, bool isRel, SVGPathSeg prevSeg) : base(isRel, prevSeg)
 {
     _x1 = x1;
     _y1 = y1;
     _x  = x;
     _y  = y;
 }
Exemplo n.º 3
0
 public SVGPathSegQuadBezShortTo(float x, float y, bool isRel, SVGPathSeg prevSeg)
     : base(0, 0, x, y, isRel, prevSeg)
 {
     if (prevSeg.GetType() == typeof(SVGPathSegQuadBezShortTo))
     {
         SVGPathSegQuadBezShortTo prev = _prevSeg as SVGPathSegQuadBezShortTo;
         //_x1 = -prev.X1;
         //_y1 = -prev.Y1;
         _x1 = prev.getCursor().x - prev.dX1;
         _y1 = prev.getCursor().y - prev.dY1;
         if (_coord_type == PathCoordType.SVG_PATH_RELATIVE)
         {
             _x1 -= prev.getCursor().x;
             _y1 -= prev.getCursor().y;
         }
     }
     else if (prevSeg.GetType() == typeof(SVGPathSegQuadBezTo))
     {
         SVGPathSegQuadBezTo prev = _prevSeg as SVGPathSegQuadBezTo;
         //_x1 = -prev.X1;
         //_y1 = -prev.Y1;
         _x1 = prev.getCursor().x - prev.dX1;
         _y1 = prev.getCursor().y - prev.dY1;
         if (_coord_type == PathCoordType.SVG_PATH_RELATIVE)
         {
             _x1 -= prev.getCursor().x;
             _y1 -= prev.getCursor().y;
         }
     }
     // else {
     //	_x1 = 2 * prevSeg.getCursor().x;
     //	_y1 = 2 * prevSeg.getCursor().y;
     //}
 }
Exemplo n.º 4
0
    public SVGPathSegLineTo(float x, float y, bool isRel, SVGPathSeg prevPath, LineToType type = LineToType.NORMAL) : base(isRel, prevPath)
    {
        _x       = x;
        _y       = y;
        lineType = type;
        switch (type)
        {
        case LineToType.NORMAL:
            break;

        case LineToType.HORIZONTAL:
            if (_coord_type == PathCoordType.SVG_PATH_ABSOLUTE)
            {
                _y = prevPath.getCursor().y;
            }
            break;

        case LineToType.VERTICAL:
            if (_coord_type == PathCoordType.SVG_PATH_ABSOLUTE)
            {
                _x = prevPath.getCursor().x;
            }
            break;
        }
    }
Exemplo n.º 5
0
 internal SVGPathSeg GetPreviousSegment(SVGPathSeg seg)
 {
     int index = this._segList.IndexOf(seg);
     if(index <= 0)
       return null;
     else
       return (SVGPathSeg)GetItem(index - 1);
 }
Exemplo n.º 6
0
 public SVGPathSeg(bool isRel, SVGPathSeg prevSeg)
 {
     if (isRel)
     {
         _coord_type = PathCoordType.SVG_PATH_RELATIVE;
     }
     else
     {
         _coord_type = PathCoordType.SVG_PATH_ABSOLUTE;
     }
     _prevSeg = prevSeg;
 }
Exemplo n.º 7
0
    /***********************************************************************************/
    internal SVGPathSeg GetPreviousSegment(SVGPathSeg seg)
    {
        int index = this._segList.IndexOf(seg);

        if (index <= 0)
        {
            return(null);
        }
        else
        {
            return((SVGPathSeg)GetItem(index - 1));
        }
    }
Exemplo n.º 8
0
 public SVGPathSegMoveTo(float x, float y, bool isRel, SVGPathSeg prevSeg) : base(isRel, prevSeg)
 {
     _x = x;
     _y = y;
 }
Exemplo n.º 9
0
 //-----------
 public SVGPathSeg AppendItem(SVGPathSeg newItem)
 {
     this._segList.Add(newItem);
     SetList(newItem);
     return(newItem);
 }
Exemplo n.º 10
0
        private void ParsePathType(char type, string values)
        {
            float[] vals = StringParser.StringPathValues(values);

            SVGPathSeg last = null;

            if (segList.Count > 0)
            {
                last = segList[segList.Count - 1];
            }

            switch (type)
            {
            case 'm':
            case 'M':
                segList.Add(new SVGPathSegMoveTo(vals[0], vals[1], type == 'm' ? true : false, last));
                break;

            case 'l':
            case 'L':
                segList.Add(new SVGPathSegLineTo(vals[0], vals[1], type == 'l' ? true : false, last));
                break;

            case 'H':
            case 'h':
                segList.Add(new SVGPathSegLineTo(vals[0], 0, type == 'h' ? true : false, last, SVGPathSegLineTo.LineToType.HORIZONTAL));
                break;

            case 'V':
            case 'v':
                segList.Add(new SVGPathSegLineTo(0, vals[0], type == 'v' ? true : false, last, SVGPathSegLineTo.LineToType.VERTICAL));
                break;

            case 'C':
            case 'c':
                segList.Add(new SVGPathSegCubicBezTo(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], type == 'c' ? true : false, last));
                break;

            case 'S':
            case 's':
                segList.Add(new SVGPathSegCubicBezShortTo(vals[0], vals[1], vals[2], vals[3], type == 's' ? true : false, last));
                break;

            case 'Q':
            case 'q':
                segList.Add(new SVGPathSegQuadBezTo(vals[0], vals[1], vals[2], vals[3], type == 'q' ? true : false, last));
                break;

            case 'T':
            case 't':
                segList.Add(new SVGPathSegQuadBezShortTo(vals[0], vals[1], type == 't' ? true : false, last));
                break;

            case 'Z':
            case 'z':
                segList.Add(new SVGPathSegClose(type == 'z' ? true : false, last));
                break;

            case 'A':
            case 'a':
                //A rx ry x-axis-rotation large-arc-flag sweep-flag x y
                //a rx ry x-axis - rotation large - arc - flag sweep - flag dx dy
                segList.Add(new SVGPathSegArc(vals[0], vals[1], vals[2], !(vals[3] == 0), !(vals[4] == 0), vals[5], vals[6], type == 'a' ? true : false, last));
                break;

            default:
                break;
            }
        }
Exemplo n.º 11
0
 /***********************************************************************************/
 private void SetList(SVGPathSeg newItem)
 {
     if(newItem != null)
       newItem.SetList(this);
 }
Exemplo n.º 12
0
 //-----------
 public SVGPathSeg AppendItem(SVGPathSeg newItem)
 {
     this._segList.Add(newItem);
     SetList(newItem);
     return newItem;
 }
Exemplo n.º 13
0
    //A rx ry x-axis-rotation large-arc-flag sweep-flag x y
    //a rx ry x-axis - rotation large - arc - flag sweep - flag dx dy
    public SVGPathSegArc(float rx, float ry, float xAxRot, bool largeArcFlag, bool sweepFlag, float x, float y, bool isRel, SVGPathSeg prevSeg) : base(isRel, prevSeg)
    {
        _rx           = rx;
        _ry           = ry;
        _xAxRot       = xAxRot;
        _largeArcFlag = largeArcFlag;
        _sweepFlag    = sweepFlag;
        _x            = x;
        _y            = y;
        EndpointToCenterArcParams();

        //Debug.Log(" rx:" + _rx + " ry:" + _ry + " xAxisRotation:" + _xAxRot + " largeArcFlag:" + _largeArcFlag + " sweepFlag:" + _sweepFlag + " x:" + _x + " y:" + _y);
        //Debug.Log("Calculated params: cx:" + _cx + " cy:" + _cy + " theta:" + _theta + " delta:" + _delta);
    }
Exemplo n.º 14
0
 public SVGPathSegClose(bool isRel, SVGPathSeg prevSeg) : base(isRel, prevSeg)
 {
 }
Exemplo n.º 15
0
 public SVGPathSegCubicBezTo(float x1, float y1, float x2, float y2, float x, float y, bool isRel, SVGPathSeg prevSeg) : base(isRel, prevSeg)
 {
     _x1 = x1;
     _y1 = y1;
     _x2 = x2;
     _y2 = y2;
     _x  = x;
     _y  = y;
 }