// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System; using System.Numerics; using SixLabors.ImageSharp.Drawing; using SixLabors.ImageSharp.Drawing.Brushes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; using SixLabors.Shapes; namespace SixLabors.ImageSharp { /// /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image in the shape of a Linear polygon described by the points /// /// The type of the color. /// The image this method extends. /// The brush. /// The points. /// The options. /// The . public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); } /// /// Flood fills the image in the shape of a Linear polygon described by the points /// /// The type of the color. /// The image this method extends. /// The brush. /// The points. /// The . public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, IBrush brush, PointF[] points) where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points))); } /// /// Flood fills the image in the shape of a Linear polygon described by the points /// /// The type of the color. /// The image this method extends. /// The color. /// The points. /// The options. /// The . public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); } /// /// Flood fills the image in the shape of a Linear polygon described by the points /// /// The type of the color. /// The image this method extends. /// The color. /// The points. /// The . public static IImageProcessingContext FillPolygon(this IImageProcessingContext source, TPixel color, PointF[] points) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); } } }