Esempio n. 1
0
        public void CloseContour()
        {
            if (_curX == _latestMoveToX && _curY == _latestMoveToY)
            {
                //we not need to close
            }
            else
            {
                if (_latestPart != null)
                {
                    _currentCnt.AddPart(_latestPart = new Line(_latestPart, _latestMoveToX, _latestMoveToY));
                }
                else
                {
                    _currentCnt.AddPart(_latestPart = new Line(_curX, _curY, _latestMoveToX, _latestMoveToY));
                }
            }

            _curX = _latestMoveToX;
            _curY = _latestMoveToY;

            if (_currentCnt != null &&
                _currentCnt.parts.Count > 0)
            {
                _contours.Add(_currentCnt);
                _currentCnt = null;
            }
            //
            _currentCnt = new Contour();
        }
Esempio n. 2
0
 public void MoveTo(float x0, float y0)
 {
     _latestMoveToX = _curX = x0;
     _latestMoveToY = _curY = y0;
     _latestPart    = null;
     //----------------------------
 }
Esempio n. 3
0
 public Line(ContourPart prevPart, float x1, float y1)
 {
     //this.x0 = x0;
     //this.y0 = y0;
     this.PrevPart = prevPart;
     this.x1       = x1;
     this.y1       = y1;
 }
Esempio n. 4
0
 public void BeginRead(int contourCount)
 {
     //reset all
     _contours      = new List <Contour>();
     _latestPart    = null;
     _latestMoveToX = _curX = _latestMoveToY = _curY = 0;
     //
     _currentCnt = new Contour();
     //new contour, but not add
 }
Esempio n. 5
0
 public Curve3(ContourPart prevPart, float x1, float y1, float x2, float y2)
 {
     this.PrevPart = prevPart;
     //this.x0 = x0;
     //this.y0 = y0;
     this.x1 = x1;
     this.y1 = y1;
     this.x2 = x2;
     this.y2 = y2;
 }
Esempio n. 6
0
 public void LineTo(float x1, float y1)
 {
     if (_latestPart != null)
     {
         _currentCnt.AddPart(_latestPart = new Line(_latestPart, x1, y1));
     }
     else
     {
         _currentCnt.AddPart(_latestPart = new Line(_curX, _curY, x1, y1));
     }
     _curX = x1;
     _curY = y1;
 }
Esempio n. 7
0
 public Curve4(ContourPart prevPart, float x1, float y1,
               float x2, float y2,
               float x3, float y3)
 {
     //this.x0 = x0;
     //this.y0 = y0;
     this.PrevPart = prevPart;
     this.x1       = x1;
     this.y1       = y1;
     this.x2       = x2;
     this.y2       = y2;
     this.x3       = x3;
     this.y3       = y3;
 }
Esempio n. 8
0
        public void Curve3(float x1, float y1, float x2, float y2)
        {
            if (_latestPart != null)
            {
                _currentCnt.AddPart(_latestPart = new Curve3(
                                        _latestPart,
                                        x1, y1,
                                        x2, y2));
            }
            else
            {
                _currentCnt.AddPart(new Curve3(
                                        _curX, _curY,
                                        x1, y1,
                                        x2, y2));
            }

            _curX = x2;
            _curY = y2;
        }
Esempio n. 9
0
 public void Curve4(float x1, float y1, float x2, float y2, float x3, float y3)
 {
     if (_latestPart != null)
     {
         _currentCnt.AddPart(_latestPart = new Curve4(
                                 _latestPart,
                                 x1, y1,
                                 x2, y2,
                                 x3, y3));
     }
     else
     {
         _currentCnt.AddPart(_latestPart = new Curve4(
                                 _curX, _curY,
                                 x1, y1,
                                 x2, y2,
                                 x3, y3));
     }
     _curX = x3;
     _curY = y3;
 }
Esempio n. 10
0
 public void AddPart(ContourPart part)
 {
     parts.Add(part);
 }