// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Primitives;
using SixLabors.Shapes;
namespace SixLabors.ImageSharp.Processing
{
///
/// Adds extensions that allow the filling of polygon outlines to the type.
///
public static class FillPathExtensions
{
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
/// The image this method extends.
/// The graphics options.
/// The brush.
/// The shape.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush,
IPath path) =>
source.Fill(options, brush, new ShapeRegion(path));
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
/// The image this method extends.
/// The brush.
/// The path.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path) =>
source.Fill(new GraphicsOptions(), brush, new ShapeRegion(path));
///
/// Flood fills the image in the shape of the provided polygon with the specified brush..
///
/// The image this method extends.
/// The options.
/// The color.
/// The path.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
Color color,
IPath path) =>
source.Fill(options, new SolidBrush(color), path);
///
/// Flood fills the image in the shape of the provided polygon with the specified brush..
///
/// The image this method extends.
/// The color.
/// The path.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, IPath path) =>
source.Fill(new SolidBrush(color), path);
}
}