System.Drawing.Graphics.FillClosedCurve C# (CSharp) Method

FillClosedCurve() public method

public FillClosedCurve ( Brush brush, PointF points, FillMode fillmode, float tension = 0.5f ) : void
brush Brush
points PointF
fillmode FillMode
tension float
return void
        public void FillClosedCurve(Brush brush, PointF [] points, FillMode fillmode, float tension = 0.5f)
        {
            if (brush == null)
                throw new ArgumentNullException ("brush");
            if (points == null)
                throw new ArgumentNullException ("points");

            int count = points.Length;
            if (count == 2)
                FillPolygon(brush, points, FillMode.Alternate);
            else {
                int segments = (count > 3) ? (count-1) : (count-2);

                var tangents = GeomUtilities.GetCurveTangents (GraphicsPath.CURVE_MIN_TERMS, points, count, tension, CurveType.Close);
                MakeCurve (points, tangents, 0, segments, CurveType.Close);
                FillBrush(brush);
            }
        }

Same methods

Graphics::FillClosedCurve ( Brush brush, Point points ) : void
Graphics::FillClosedCurve ( Brush brush, Point points, FillMode fillmode, float tension = 0.5f ) : void
Graphics::FillClosedCurve ( Brush brush, PointF points ) : void

Usage Example

Example #1
0
        /// <summary>
        /// Draws the shape.
        /// </summary>
        /// <param name="G">The g.</param>
        /// <param name="FillShape">The fill shape.</param>
        /// <param name="DrawShape">The draw shape.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// FillModes - null
        /// or
        /// FillModes - null
        /// or
        /// ShapeTypes - null
        /// </exception>
        public void DrawShape(System.Drawing.Graphics G, Brush FillShape, Pen DrawShape)
        {
            foreach (List <Point> points in Points)
            {
                switch (ShapeType)
                {
                case ShapeTypes.Polygon:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillPolygon(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillPolygon(FillShape, points.ToArray());
                        G.DrawPolygon(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                case ShapeTypes.Spline:
                    switch (FillMode)
                    {
                    case FillModes.Fill:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        break;

                    case FillModes.Border:
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    case FillModes.Both:
                        G.FillClosedCurve(FillShape, points.ToArray());
                        G.DrawClosedCurve(DrawShape, points.ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(FillModes), FillMode, null);
                    }

                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(ShapeTypes), ShapeType, null);
                }
            }
        }
All Usage Examples Of System.Drawing.Graphics::FillClosedCurve