예제 #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();
        }
예제 #2
0
 public void MoveTo(float x0, float y0)
 {
     _latestMoveToX = _curX = x0;
     _latestMoveToY = _curY = y0;
     _latestPart    = null;
     //----------------------------
 }
예제 #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;
 }
예제 #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
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
        }
예제 #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;
 }
예제 #10
0
 public void AddPart(ContourPart part)
 {
     parts.Add(part);
 }