//================================================================================
 public SVGPathSegLinetoHorizontalRel(float x, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Horizontal_Rel;
     if(segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = _previousPoint + new Vector2(x, 0f);
 }
 //================================================================================
 public SVGPathSegLinetoVerticalAbs(float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Vertical_Abs;
     if(segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = new Vector2(_previousPoint.x, y);
 }
 //================================================================================
 public SVGPathSegLinetoHorizontalAbs(float x, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Horizontal_Abs;
     if(segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = new Vector2(x, _previousPoint.y);
 }
 //================================================================================
 public SVGPathSegLinetoVerticalRel(float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Vertical_Rel;
     if(segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = _previousPoint + new Vector2(0f, y);
 }
Exemplo n.º 5
0
 /***********************************************************************************/
 private void SetList(SVGPathSeg newItem)
 {
     if (newItem != null)
     {
         newItem.SetList(this);
     }
 }
Exemplo n.º 6
0
        private SVGPathSegClosePath CreateSVGPathSegClosePath()
        {
            SVGPathSeg lastSegment  = _segList.GetLastItem();
            SVGPathSeg firstSegment = _segList.GetItem(0);

            /*
             * SVGPathSegMovetoAbs _firstPoint = _segList.GetItem(0) as SVGPathSegMovetoAbs;
             * if (_firstPoint == null)
             * {
             *  SVGPathSegMovetoRel _firstPoint1 = _segList.GetItem(0) as SVGPathSegMovetoRel;
             *  if (_firstPoint1 != null)
             *      return new SVGPathSegClosePath(_firstPoint1.currentPoint, lastSegment);
             * } else
             * {
             *  return new SVGPathSegClosePath(_firstPoint.currentPoint, lastSegment);
             * }
             */
            if (firstSegment != null)
            {
                return(new SVGPathSegClosePath(firstSegment.currentPoint, lastSegment));
            }
            else
            {
                return(null);
            }
        }
 //================================================================================
 public SVGPathSegCurvetoQuadraticAbs(float x1, float y1, float x, float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.CurveTo_Quadratic_Abs;
     if(segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = new Vector2(x, y);        
     _controlPoint1 = new Vector2(x1, y1);
 }
Exemplo n.º 8
0
        public void SetPreviousSegment(SVGPathSeg prevSeg)
        {
            if(prevSeg == null)
                return;

            this._prevSeg = prevSeg;
            _previousPoint = prevSeg.currentPoint;
        }
     //================================================================================
     public SVGPathSegLinetoAbs(float x, float y, SVGPathSeg segment) : base()
     {
 //        Debug.Log(string.Format("LinetoAbs: x: {0}, y: {1}",x, y));
         this._type = SVGPathSegTypes.LineTo_Abs;
         if(segment != null)
             _previousPoint = segment.currentPoint;
         _currentPoint = new Vector2(x, y);
     }
 //================================================================================
 public SVGPathSegLinetoHorizontalAbs(float x, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Horizontal_Abs;
     if (segment != null)
     {
         _previousPoint = segment.currentPoint;
     }
     _currentPoint = new Vector2(x, _previousPoint.y);
 }
Exemplo n.º 11
0
 //================================================================================
 public SVGPathSegLinetoVerticalAbs(float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Vertical_Abs;
     if (segment != null)
     {
         _previousPoint = segment.currentPoint;
     }
     _currentPoint = new Vector2(_previousPoint.x, y);
 }
Exemplo n.º 12
0
 //================================================================================
 public SVGPathSegLinetoRel(float x, float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.LineTo_Rel;
     if (segment != null)
     {
         _previousPoint = segment.currentPoint;
     }
     _currentPoint = _previousPoint + new Vector2(x, y);
 }
Exemplo n.º 13
0
 //================================================================================
 public SVGPathSegCurvetoQuadraticAbs(float x1, float y1, float x, float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.CurveTo_Quadratic_Abs;
     if (segment != null)
     {
         _previousPoint = segment.currentPoint;
     }
     _currentPoint  = new Vector2(x, y);
     _controlPoint1 = new Vector2(x1, y1);
 }
Exemplo n.º 14
0
        public void SetPreviousSegment(SVGPathSeg prevSeg)
        {
            if (prevSeg == null)
            {
                return;
            }

            this._prevSeg  = prevSeg;
            _previousPoint = prevSeg.currentPoint;
        }
Exemplo n.º 15
0
 //================================================================================
 public SVGPathSegLinetoAbs(float x, float y, SVGPathSeg segment) : base()
 {
     //        Debug.Log(string.Format("LinetoAbs: x: {0}, y: {1}",x, y));
     this._type = SVGPathSegTypes.LineTo_Abs;
     if (segment != null)
     {
         _previousPoint = segment.currentPoint;
     }
     _currentPoint = new Vector2(x, y);
 }
Exemplo n.º 16
0
        //================================================================================
        public SVGPathSegMovetoRel(float x, float y, SVGPathSeg segment) : base()
        {
            this._type = SVGPathSegTypes.MoveTo_Rel;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint = _previousPoint + new Vector2(x, y);

//            Debug.Log("SVGPathSegMovetoRel: "+ new Vector2(x, y) +", currentPosition: "+_currentPoint+ ", LastPosition: "+_previousPoint);
        }
        //================================================================================
        public SVGPathSegMovetoRel(float x, float y, SVGPathSeg segment) : base()
        {


            this._type = SVGPathSegTypes.MoveTo_Rel;
            if(segment != null)
                _previousPoint = segment.currentPoint;
            _currentPoint = _previousPoint + new Vector2(x, y);

//            Debug.Log("SVGPathSegMovetoRel: "+ new Vector2(x, y) +", currentPosition: "+_currentPoint+ ", LastPosition: "+_previousPoint);
        }
        //================================================================================
        public SVGPathSegCurvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y, SVGPathSeg segment) : base()
        {
    //        Debug.Log(string.Format("CurveCubicAbs x1: {0}, y1: {1}, x2: {2}, y2: {3}, x: {4}, y: {5}", x1, y1, x2, y2, x, y));
            this._type = SVGPathSegTypes.CurveTo_Cubic_Abs;
            if(segment != null)
                _previousPoint = segment.currentPoint;
            _currentPoint = new Vector2(x, y);        
            _controlPoint1 = new Vector2(x1, y1);
            _controlPoint2 = new Vector2(x2, y2);

    //        Debug.Log(string.Format("_controlPoint1: {0}, _controlPoint2: {1}, _currentPoint: {2}",_controlPoint1,_controlPoint2, _currentPoint));
        }
Exemplo n.º 19
0
        //-----------
        public SVGPathSeg AppendItem(SVGPathSeg newItem)
        {
            if(newItem == null)
                return null;

            int segListCount = this._segList.Count;
            newItem.SetIndex(segListCount);
            //newItem.SetPreviousSegment(GetPreviousSegment(newItem.index));
            this._segList.Add(newItem);
            this.SetList(newItem);
            return newItem;
        }
Exemplo n.º 20
0
        //================================================================================

        //-----

        //================================================================================
        public SVGPathSegArcRel(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, float x, float y, SVGPathSeg segment) : base()
        {
            this._type = SVGPathSegTypes.Arc_Rel;
            if(segment != null)
                _previousPoint = segment.currentPoint;
            _currentPoint = _previousPoint + new Vector2(x, y);

            this._r1 = r1;
            this._r2 = r2;
            this._angle = angle;
            this._largeArcFlag = largeArcFlag;
            this._sweepFlag = sweepFlag;
        }
Exemplo n.º 21
0
        private SVGPathSegClosePath CreateSVGPathSegClosePath()
        {
            SVGPathSeg lastSegment  = _segList.GetLastItem();
            SVGPathSeg firstSegment = _segList.GetItem(0);

            if (firstSegment != null)
            {
                return(new SVGPathSegClosePath(firstSegment.currentPoint, lastSegment));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 22
0
        //-----------
        public SVGPathSeg AppendItem(SVGPathSeg newItem)
        {
            if (newItem == null)
            {
                return(null);
            }

            int segListCount = this._segList.Count;

            newItem.SetIndex(segListCount);
            //newItem.SetPreviousSegment(GetPreviousSegment(newItem.index));
            this._segList.Add(newItem);
            this.SetList(newItem);
            return(newItem);
        }
 //================================================================================
 public SVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, SVGPathSeg segment) : base()
 {
     this._type = SVGPathSegTypes.CurveTo_Quadratic_Smooth_Abs;
     if (segment != null)
         _previousPoint = segment.currentPoint;
     _currentPoint = new Vector2(x, y);
     
     SVGPathSegCurvetoQuadratic pSegment = segment as SVGPathSegCurvetoQuadratic;
     if (pSegment != null)
     {
         _controlPoint1 = _previousPoint + (_previousPoint - pSegment.controlPoint1);
     } else
     {
         _controlPoint1 = _previousPoint;
     }
 }
        //================================================================================
        public SVGPathSegClosePath(Vector2 value, SVGPathSeg segment) : base()
        {
    //        Debug.Log(string.Format("Close: x: {0}, y: {1}",value.x, value.y));
            this._type = SVGPathSegTypes.Close;
            if(segment != null)
                _previousPoint = segment.currentPoint;
            _currentPoint = value;

            /*
            if (value.x == float.MinValue && value.y == float.MinValue)
            {
                _currentPoint = _previousPoint;
            } else {
                _currentPoint = value;
            } 
            */
        }
Exemplo n.º 25
0
        //================================================================================
        public SVGPathSegClosePath(Vector2 value, SVGPathSeg segment) : base()
        {
            //        Debug.Log(string.Format("Close: x: {0}, y: {1}",value.x, value.y));
            this._type = SVGPathSegTypes.Close;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint = value;

            /*
             * if (value.x == float.MinValue && value.y == float.MinValue)
             * {
             *  _currentPoint = _previousPoint;
             * } else {
             *  _currentPoint = value;
             * }
             */
        }
Exemplo n.º 26
0
        //================================================================================
        public SVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, SVGPathSeg segment) : base()
        {
            this._type = SVGPathSegTypes.CurveTo_Quadratic_Smooth_Abs;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint = new Vector2(x, y);

            SVGPathSegCurvetoQuadratic pSegment = segment as SVGPathSegCurvetoQuadratic;

            if (pSegment != null)
            {
                _controlPoint1 = _previousPoint + (_previousPoint - pSegment.controlPoint1);
            }
            else
            {
                _controlPoint1 = _previousPoint;
            }
        }
        //================================================================================
        public SVGPathSegCurvetoCubicSmoothRel(float x2, float y2, float x, float y, SVGPathSeg segment) : base()
        {
            //Debug.Log("SVGPathSegCurvetoCubicSmoothRel: "+new Vector2(x2, y2)+", "+new Vector2(x, y));

            this._type = SVGPathSegTypes.CurveTo_Cubic_Smooth_Rel;
            if(segment != null)
                _previousPoint = segment.currentPoint;
            _currentPoint = _previousPoint + new Vector2(x, y);

            SVGPathSegCurvetoCubic pSegment = segment as SVGPathSegCurvetoCubic;

            if(pSegment != null)
            {
                _controlPoint1 = _previousPoint + (_previousPoint - pSegment.controlPoint2);
            } else
            {
                _controlPoint1 = _previousPoint;
            }

            _controlPoint2 = _previousPoint + new Vector2(x2, y2);
        }
Exemplo n.º 28
0
        //================================================================================
        public SVGPathSegCurvetoCubicSmoothRel(float x2, float y2, float x, float y, SVGPathSeg segment) : base()
        {
            //Debug.Log("SVGPathSegCurvetoCubicSmoothRel: "+new Vector2(x2, y2)+", "+new Vector2(x, y));

            this._type = SVGPathSegTypes.CurveTo_Cubic_Smooth_Rel;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint = _previousPoint + new Vector2(x, y);

            SVGPathSegCurvetoCubic pSegment = segment as SVGPathSegCurvetoCubic;

            if (pSegment != null)
            {
                _controlPoint1 = _previousPoint + (_previousPoint - pSegment.controlPoint2);
            }
            else
            {
                _controlPoint1 = _previousPoint;
            }

            _controlPoint2 = _previousPoint + new Vector2(x2, y2);
        }
Exemplo n.º 29
0
        private void Initial()
        {
            string     _d               = _attrList.GetValue("d");
            SVGPathSeg lastSegment      = null;
            SVGPathSeg firstPathSegment = null;

            List <char>   _charList  = new List <char>();
            List <string> _valueList = new List <string>();

            SVGStringExtractor.ExtractPathSegList(_d, ref _charList, ref _valueList);
            _segList = new SVGPathSegList(_charList.Count);
            int i, j, paramsLength;

            for (i = 0; i < _charList.Count; i++)
            {
                //lastSegment = _segList.GetLastItem();
                char _char = _charList [i];

                string _value = _valueList [i];

                float[] parms = SVGStringExtractor.ExtractTransformValueAsPX(_value);
                paramsLength = parms.Length;

                switch (_char)
                {
                case 'Z':
                case 'z':
                    if (_segList.Count > 0 && firstPathSegment != null)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoAbs(firstPathSegment.currentPoint.x, firstPathSegment.currentPoint.y, lastSegment));
                    }
                    _segList.AppendItem(CreateSVGPathSegClosePath());
                    firstPathSegment = null;
                    break;

                case 'M':
                    if (lastSegment != null && lastSegment.type != SVGPathSegTypes.Close && lastSegment.type != SVGPathSegTypes.MoveTo_Abs && lastSegment.type != SVGPathSegTypes.MoveTo_Rel)
                    {
                        firstPathSegment = null;
                    }
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegMovetoAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'm':
                    if (lastSegment != null && lastSegment.type != SVGPathSegTypes.Close && lastSegment.type != SVGPathSegTypes.MoveTo_Abs && lastSegment.type != SVGPathSegTypes.MoveTo_Rel)
                    {
                        firstPathSegment = null;
                    }
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegMovetoRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'L':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'l':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'C':
                    if (paramsLength < 6)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 6)
                    {
                        if (paramsLength - j < 6)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'c':
                    if (paramsLength < 6)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 6)
                    {
                        if (paramsLength - j < 6)
                        {
                            continue;
                        }
//                            Debug.Log(string.Format("CubicCurveRel: {0}, {1}, {2}, {3}, {4}, {5}", parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5]));
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'S':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 's':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'Q':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'q':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'T':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 't':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'A':
                    if (paramsLength < 7)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 7)
                    {
                        if (paramsLength - j < 7)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegArcAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3] == 1f, parms [j + 4] == 1f, parms [j + 5], parms [j + 6], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'a':
                    if (paramsLength < 7)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 7)
                    {
                        if (paramsLength - j < 7)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegArcRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3] == 1f, parms [j + 4] == 1f, parms [j + 5], parms [j + 6], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'H':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoHorizontalAbs(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'h':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoHorizontalRel(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'V':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoVerticalAbs(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'v':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoVerticalRel(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;
                }
            }
        }
Exemplo n.º 30
0
        bool GetSegment(SVGPathElement svgElement, SVGPathSeg segment, List <List <Vector2> > output, List <Vector2> positionBuffer, SVGMatrix matrix)
        {
            if (segment == null)
            {
                return(false);
            }

//            Debug.Log("command: "+segment.type+", lastCommand: "+lastCommand);

            switch (segment.type)
            {
            case SVGPathSegTypes.Arc_Abs:
                SVGPathSegArcAbs arcAbs = segment as SVGPathSegArcAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("arcAbs");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.Arc(SVGGeomUtils.TransformPoint(arcAbs.previousPoint, matrix), arcAbs.r1, arcAbs.r2, arcAbs.angle, arcAbs.largeArcFlag, arcAbs.sweepFlag, SVGGeomUtils.TransformPoint(arcAbs.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.Arc_Rel:
                SVGPathSegArcRel arcRel = segment as SVGPathSegArcRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("arcRel");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.Arc(SVGGeomUtils.TransformPoint(arcRel.previousPoint, matrix), arcRel.r1, arcRel.r2, arcRel.angle, arcRel.largeArcFlag, arcRel.sweepFlag, SVGGeomUtils.TransformPoint(arcRel.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.Close:
                    #if PATH_COMMAND_DEBUG
                Debug.Log("Close");
                    #endif
                //Debug.Log("Close");
                if (positionBuffer.Count > 0)
                {
                    output.Add(new List <Vector2>(positionBuffer.ToArray()));
                }
                positionBuffer.Clear();
                break;

            case SVGPathSegTypes.CurveTo_Cubic_Abs:
                SVGPathSegCurvetoCubicAbs curvetoCubicAbs = segment as SVGPathSegCurvetoCubicAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoCubicAbs");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.CurveTo_Cubic_Rel:
                SVGPathSegCurvetoCubicRel curvetoCubicRel = segment as SVGPathSegCurvetoCubicRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoCubicRel");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.CurveTo_Cubic_Smooth_Abs:
                SVGPathSegCurvetoCubicSmoothAbs curvetoCubicSmoothAbs = segment as SVGPathSegCurvetoCubicSmoothAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoCubicSmoothAbs");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.CurveTo_Cubic_Smooth_Rel:
                SVGPathSegCurvetoCubicSmoothRel curvetoCubicSmoothRel = segment as SVGPathSegCurvetoCubicSmoothRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoCubicSmoothRel");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.currentPoint, matrix)));

                break;

            case SVGPathSegTypes.CurveTo_Quadratic_Abs:
                SVGPathSegCurvetoQuadraticAbs curvetoQuadraticAbs = segment as SVGPathSegCurvetoQuadraticAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoQuadraticAbs");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.currentPoint, matrix)));
                break;

            case SVGPathSegTypes.CurveTo_Quadratic_Rel:
                SVGPathSegCurvetoQuadraticRel curvetoQuadraticRel = segment as SVGPathSegCurvetoQuadraticRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoQuadraticRel");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticRel.currentPoint, matrix)));

                break;

            case SVGPathSegTypes.CurveTo_Quadratic_Smooth_Abs:
                SVGPathSegCurvetoQuadraticSmoothAbs curvetoQuadraticSmoothAbs = segment as SVGPathSegCurvetoQuadraticSmoothAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoQuadraticSmoothAbs");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.currentPoint, matrix)));

                break;

            case SVGPathSegTypes.CurveTo_Quadratic_Smooth_Rel:
                SVGPathSegCurvetoQuadraticSmoothRel curvetoQuadraticSmoothRel = segment as SVGPathSegCurvetoQuadraticSmoothRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("curvetoQuadraticSmoothRel");
                    #endif
                positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.currentPoint, matrix)));

                break;

            case SVGPathSegTypes.LineTo_Abs:
                SVGPathSegLinetoAbs linetoAbs = segment as SVGPathSegLinetoAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoAbs");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoAbs.currentPoint, matrix));
                break;

            case SVGPathSegTypes.LineTo_Horizontal_Abs:
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoHorizontalAbs");
                    #endif
                SVGPathSegLinetoHorizontalAbs linetoHorizontalAbs = segment as SVGPathSegLinetoHorizontalAbs;
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoHorizontalAbs.currentPoint, matrix));
                break;

            case SVGPathSegTypes.LineTo_Horizontal_Rel:
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoHorizontalRel");
                    #endif
                SVGPathSegLinetoHorizontalRel linetoHorizontalRel = segment as SVGPathSegLinetoHorizontalRel;
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoHorizontalRel.currentPoint, matrix));
                break;

            case SVGPathSegTypes.LineTo_Rel:
                SVGPathSegLinetoRel linetoRel = segment as SVGPathSegLinetoRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoRel");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoRel.currentPoint, matrix));
                break;

            case SVGPathSegTypes.LineTo_Vertical_Abs:
                SVGPathSegLinetoVerticalAbs linetoVerticalAbs = segment as SVGPathSegLinetoVerticalAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoVerticalAbs");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoVerticalAbs.currentPoint, matrix));
                break;

            case SVGPathSegTypes.LineTo_Vertical_Rel:
                SVGPathSegLinetoVerticalRel linetoVerticalRel = segment as SVGPathSegLinetoVerticalRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("linetoVerticalRel");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoVerticalRel.currentPoint, matrix));
                break;

            case SVGPathSegTypes.MoveTo_Abs:
                if (lastCommand != SVGPathSegTypes.Close && lastCommand != SVGPathSegTypes.MoveTo_Abs && lastCommand != SVGPathSegTypes.MoveTo_Rel)
                {
                    if (positionBuffer.Count > 0)
                    {
                        output.Add(new List <Vector2>(positionBuffer.ToArray()));
                        positionBuffer.Clear();
                    }
                }
                SVGPathSegMovetoAbs movetoAbs = segment as SVGPathSegMovetoAbs;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("movetoAbs");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(movetoAbs.currentPoint, matrix));
                break;

            case SVGPathSegTypes.MoveTo_Rel:
                if (lastCommand != SVGPathSegTypes.Close && lastCommand != SVGPathSegTypes.MoveTo_Abs && lastCommand != SVGPathSegTypes.MoveTo_Rel)
                {
                    if (positionBuffer.Count > 0)
                    {
                        output.Add(new List <Vector2>(positionBuffer.ToArray()));
                        positionBuffer.Clear();
                    }
                }
                SVGPathSegMovetoRel movetoRel = segment as SVGPathSegMovetoRel;
                    #if PATH_COMMAND_DEBUG
                Debug.Log("movetoRel");
                    #endif
                positionBuffer.Add(SVGGeomUtils.TransformPoint(movetoRel.currentPoint, matrix));
                break;
            }

            lastCommand = segment.type;
            return(true);
        }
Exemplo n.º 31
0
        //================================================================================

        //-----

        //================================================================================
        public SVGPathSegArcRel(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, float x, float y, SVGPathSeg segment) : base()
        {
            this._type = SVGPathSegTypes.Arc_Rel;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint = _previousPoint + new Vector2(x, y);

            this._r1           = r1;
            this._r2           = r2;
            this._angle        = angle;
            this._largeArcFlag = largeArcFlag;
            this._sweepFlag    = sweepFlag;
        }
Exemplo n.º 32
0
        static bool GetSegment(SVGPathElement svgElement, SVGPathSeg segment, List<List<Vector2>> output, List<Vector2> positionBuffer, SVGMatrix matrix)
        {
            if (segment == null)
                return false;

//            Debug.Log("command: "+segment.type+", lastCommand: "+lastCommand);

            switch (segment.type)
            {
                case SVGPathSegTypes.Arc_Abs:
                    SVGPathSegArcAbs arcAbs = segment as SVGPathSegArcAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("arcAbs");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.Arc(SVGGeomUtils.TransformPoint(arcAbs.previousPoint, matrix), arcAbs.r1, arcAbs.r2, arcAbs.angle, arcAbs.largeArcFlag, arcAbs.sweepFlag, SVGGeomUtils.TransformPoint(arcAbs.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.Arc_Rel:
                    SVGPathSegArcRel arcRel = segment as SVGPathSegArcRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("arcRel");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.Arc(SVGGeomUtils.TransformPoint(arcRel.previousPoint, matrix), arcRel.r1, arcRel.r2, arcRel.angle, arcRel.largeArcFlag, arcRel.sweepFlag, SVGGeomUtils.TransformPoint(arcRel.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.Close:
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("Close");
                    #endif
                    //Debug.Log("Close");
                    if(positionBuffer.Count > 0)
                    {
                        output.Add(new List<Vector2>(positionBuffer.ToArray()));
                    }
                    positionBuffer.Clear();
                    break;
                case SVGPathSegTypes.CurveTo_Cubic_Abs:
                    SVGPathSegCurvetoCubicAbs curvetoCubicAbs = segment as SVGPathSegCurvetoCubicAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoCubicAbs");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicAbs.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.CurveTo_Cubic_Rel:
                    SVGPathSegCurvetoCubicRel curvetoCubicRel = segment as SVGPathSegCurvetoCubicRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoCubicRel");
                    #endif          
                    positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicRel.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.CurveTo_Cubic_Smooth_Abs:
                    SVGPathSegCurvetoCubicSmoothAbs curvetoCubicSmoothAbs = segment as SVGPathSegCurvetoCubicSmoothAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoCubicSmoothAbs");
                    #endif               
                    positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothAbs.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.CurveTo_Cubic_Smooth_Rel:
                    SVGPathSegCurvetoCubicSmoothRel curvetoCubicSmoothRel = segment as SVGPathSegCurvetoCubicSmoothRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoCubicSmoothRel");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.CubicCurve(SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.controlPoint2, matrix), SVGGeomUtils.TransformPoint(curvetoCubicSmoothRel.currentPoint, matrix)));
                    
                    break;
                case SVGPathSegTypes.CurveTo_Quadratic_Abs:
                    SVGPathSegCurvetoQuadraticAbs curvetoQuadraticAbs = segment as SVGPathSegCurvetoQuadraticAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoQuadraticAbs");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticAbs.currentPoint, matrix)));
                    break;
                case SVGPathSegTypes.CurveTo_Quadratic_Rel:
                    SVGPathSegCurvetoQuadraticRel curvetoQuadraticRel = segment as SVGPathSegCurvetoQuadraticRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoQuadraticRel");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticRel.currentPoint, matrix)));
                    
                    break;
                case SVGPathSegTypes.CurveTo_Quadratic_Smooth_Abs:
                    SVGPathSegCurvetoQuadraticSmoothAbs curvetoQuadraticSmoothAbs = segment as SVGPathSegCurvetoQuadraticSmoothAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoQuadraticSmoothAbs");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothAbs.currentPoint, matrix)));
                    
                    break;
                case SVGPathSegTypes.CurveTo_Quadratic_Smooth_Rel:
                    SVGPathSegCurvetoQuadraticSmoothRel curvetoQuadraticSmoothRel = segment as SVGPathSegCurvetoQuadraticSmoothRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("curvetoQuadraticSmoothRel");
                    #endif
                    positionBuffer.AddRange(SVGGeomUtils.QuadraticCurve(SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.previousPoint, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.controlPoint1, matrix), SVGGeomUtils.TransformPoint(curvetoQuadraticSmoothRel.currentPoint, matrix)));
                    
                    break;
                case SVGPathSegTypes.LineTo_Abs:
                    SVGPathSegLinetoAbs linetoAbs = segment as SVGPathSegLinetoAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoAbs");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoAbs.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.LineTo_Horizontal_Abs:
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoHorizontalAbs");
                    #endif
                    SVGPathSegLinetoHorizontalAbs linetoHorizontalAbs = segment as SVGPathSegLinetoHorizontalAbs;
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoHorizontalAbs.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.LineTo_Horizontal_Rel:
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoHorizontalRel");
                    #endif
                    SVGPathSegLinetoHorizontalRel linetoHorizontalRel = segment as SVGPathSegLinetoHorizontalRel;
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoHorizontalRel.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.LineTo_Rel:
                    SVGPathSegLinetoRel linetoRel = segment as SVGPathSegLinetoRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoRel");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoRel.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.LineTo_Vertical_Abs:
                    SVGPathSegLinetoVerticalAbs linetoVerticalAbs = segment as SVGPathSegLinetoVerticalAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoVerticalAbs");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoVerticalAbs.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.LineTo_Vertical_Rel:
                    SVGPathSegLinetoVerticalRel linetoVerticalRel = segment as SVGPathSegLinetoVerticalRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("linetoVerticalRel");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(linetoVerticalRel.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.MoveTo_Abs:
                    if(lastCommand != SVGPathSegTypes.Close && lastCommand != SVGPathSegTypes.MoveTo_Abs && lastCommand != SVGPathSegTypes.MoveTo_Rel)
                    {
                        if(positionBuffer.Count > 0)
                        {
                            output.Add(new List<Vector2>(positionBuffer.ToArray()));
                            positionBuffer.Clear();
                        }
                    }
                    SVGPathSegMovetoAbs movetoAbs = segment as SVGPathSegMovetoAbs;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("movetoAbs");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(movetoAbs.currentPoint, matrix));
                    break;
                case SVGPathSegTypes.MoveTo_Rel:
                    if(lastCommand != SVGPathSegTypes.Close && lastCommand != SVGPathSegTypes.MoveTo_Abs && lastCommand != SVGPathSegTypes.MoveTo_Rel)
                    {
                        if(positionBuffer.Count > 0)
                        {
                            output.Add(new List<Vector2>(positionBuffer.ToArray()));
                            positionBuffer.Clear();
                        }
                    }
                    SVGPathSegMovetoRel movetoRel = segment as SVGPathSegMovetoRel;
                    #if PATH_COMMAND_DEBUG
                    Debug.Log("movetoRel");
                    #endif
                    positionBuffer.Add(SVGGeomUtils.TransformPoint(movetoRel.currentPoint, matrix));
                    break;
            }
            
            lastCommand = segment.type;
            return true;
        }
        //================================================================================
        public SVGPathSegCurvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y, SVGPathSeg segment) : base()
        {
            this._type = SVGPathSegTypes.CurveTo_Cubic_Rel;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint  = _previousPoint + new Vector2(x, y);
            _controlPoint1 = _previousPoint + new Vector2(x1, y1);
            _controlPoint2 = _previousPoint + new Vector2(x2, y2);

            /*
             * Debug.Log(string.Format("CurveCubicRel x1: {0}, y1: {1}, x2: {2}, y2: {3}, x: {4}, y: {5}", x1, y1, x2, y2, x, y)+"\n"+
             *        string.Format("_controlPoint1: {0}, _controlPoint2: {1}, _currentPoint: {2}",_controlPoint1,_controlPoint2, _currentPoint)
             *        );
             */
        }
        //================================================================================
        public SVGPathSegCurvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y, SVGPathSeg segment) : base()
        {
            //        Debug.Log(string.Format("CurveCubicAbs x1: {0}, y1: {1}, x2: {2}, y2: {3}, x: {4}, y: {5}", x1, y1, x2, y2, x, y));
            this._type = SVGPathSegTypes.CurveTo_Cubic_Abs;
            if (segment != null)
            {
                _previousPoint = segment.currentPoint;
            }
            _currentPoint  = new Vector2(x, y);
            _controlPoint1 = new Vector2(x1, y1);
            _controlPoint2 = new Vector2(x2, y2);

            //        Debug.Log(string.Format("_controlPoint1: {0}, _controlPoint2: {1}, _currentPoint: {2}",_controlPoint1,_controlPoint2, _currentPoint));
        }
Exemplo n.º 35
0
 /***********************************************************************************/
 private void SetList(SVGPathSeg newItem)
 {
     if (newItem != null)
         newItem.SetList(this);
 }