// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Drawing;
namespace SixLabors.ImageSharp.Processing
{
///
/// Adds extensions that allow the filling of regions with various brushes to the type.
///
public static class FillRegionExtensions
{
///
/// Flood fills the image with the specified brush.
///
/// The image this method extends.
/// The details how to fill the region of interest.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush) =>
source.Fill(new GraphicsOptions(), brush);
///
/// Flood fills the image with the specified color.
///
/// The image this method extends.
/// The color.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color) =>
source.Fill(new SolidBrush(color));
///
/// Flood fills the image with in the region with the specified brush.
///
/// The image this method extends.
/// The brush.
/// The region.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region) =>
source.Fill(new GraphicsOptions(), brush, region);
///
/// Flood fills the image with in the region with the specified color.
///
/// The image this method extends.
/// The options.
/// The color.
/// The region.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
Color color,
Region region) =>
source.Fill(options, new SolidBrush(color), region);
///
/// Flood fills the image with in the region with the specified color.
///
/// The image this method extends.
/// The color.
/// The region.
/// The .
public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, Region region) =>
source.Fill(new SolidBrush(color), region);
///
/// Flood fills the image with in the region with the specified brush.
///
/// The image this method extends.
/// The graphics options.
/// The brush.
/// The region.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush,
Region region) =>
source.ApplyProcessor(new FillRegionProcessor(options, brush, region));
///
/// Flood fills the image with the specified brush.
///
/// The image this method extends.
/// The graphics options.
/// The details how to fill the region of interest.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush) =>
source.ApplyProcessor(new FillProcessor(options, brush));
}
}