// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.Shapes;
namespace SixLabors.ImageSharp.Processing
{
///
/// Adds extensions that allow the filling of collections of polygon outlines to the type.
///
public static class FillPathCollectionExtensions
{
///
/// 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 shapes.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush,
IPathCollection paths)
{
foreach (IPath s in paths)
{
source.Fill(options, brush, s);
}
return source;
}
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
/// The image this method extends.
/// The brush.
/// The paths.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
IBrush brush,
IPathCollection paths) =>
source.Fill(new GraphicsOptions(), brush, paths);
///
/// 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 paths.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
Color color,
IPathCollection paths) =>
source.Fill(options, new SolidBrush(color), paths);
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
/// The image this method extends.
/// The color.
/// The paths.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
Color color,
IPathCollection paths) =>
source.Fill(new SolidBrush(color), paths);
}
}