public void CloseFigure()
 {
     if (!NativeObject.LastFigureClosed)
     {
         NativeObject.closePath();
     }
 }
 internal void AddRectangle(float x, float y, float w, float h)
 {
     NativeObject.moveTo(x, y);
     NativeObject.lineTo(x + w, y);
     NativeObject.lineTo(x + w, y + h);
     NativeObject.lineTo(x, y + h);
     NativeObject.closePath();
 }
        public void AddPolygon(PointF [] points)
        {
            if (points == null)
            {
                throw new ArgumentNullException("points");
            }

            if (points.Length < 3)
            {
                throw new ArgumentException("Invalid parameter used.");
            }

            NativeObject.moveTo(points[0].X, points[0].Y);
            for (int i = 1; i < points.Length; i++)
            {
                NativeObject.lineTo(points[i].X, points[i].Y);
            }
            NativeObject.closePath();
        }
        private void SetPath(Point [] pts, byte [] types)
        {
            NativeObject.Clear();
            if (((PathPointType)types [0] & PathPointType.PathTypeMask) != PathPointType.Start)
            {
                NativeObject.moveTo(pts [0].X, pts [0].Y);
            }

            for (int i = 0; i < pts.Length; i++)
            {
                switch (((PathPointType)types [i] & PathPointType.PathTypeMask))
                {
                case PathPointType.Start:
                    NativeObject.moveTo(pts [i].X, pts [i].Y);
                    break;

                case PathPointType.Line:
                    NativeObject.lineTo(pts [i].X, pts [i].Y);
                    break;

                case PathPointType.Bezier3:
                    float x1 = pts [i].X;
                    float y1 = pts [i].Y;
                    i++;
                    float x2 = pts [i].X;
                    float y2 = pts [i].Y;
                    i++;
                    float x3 = pts [i].X;
                    float y3 = pts [i].Y;
                    NativeObject.curveTo(x1, y1, x2, y2, x3, y3);
                    break;
                }
                if (((PathPointType)types [i] & PathPointType.CloseSubpath) != 0)
                {
                    NativeObject.closePath();
                }

                if (((PathPointType)types [i] & PathPointType.PathMarker) != 0)
                {
                    NativeObject.SetMarkers();
                }
            }
        }