// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.Primitives;
using SixLabors.Shapes;
namespace SixLabors.ImageSharp.Processing
{
///
/// Adds extensions that allow the filling of closed linear polygons to the type.
///
public static class FillPolygonExtensions
{
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The image this method extends.
/// The options.
/// The brush.
/// The points.
/// The .
public static IImageProcessingContext FillPolygon(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush,
params PointF[] points) =>
source.Fill(options, brush, new Polygon(new LinearLineSegment(points)));
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The image this method extends.
/// The brush.
/// The points.
/// The .
public static IImageProcessingContext FillPolygon(
this IImageProcessingContext source,
IBrush brush,
params PointF[] points) =>
source.Fill(brush, new Polygon(new LinearLineSegment(points)));
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The image this method extends.
/// The options.
/// The color.
/// The points.
/// The .
public static IImageProcessingContext FillPolygon(
this IImageProcessingContext source,
GraphicsOptions options,
Color color,
params PointF[] points) =>
source.Fill(options, new SolidBrush(color), new Polygon(new LinearLineSegment(points)));
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The image this method extends.
/// The color.
/// The points.
/// The .
public static IImageProcessingContext FillPolygon(
this IImageProcessingContext source,
Color color,
params PointF[] points) =>
source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)));
}
}