// 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 rectangles to the type.
///
public static class FillRectangleExtensions
{
///
/// Flood fills the image in the shape of the provided rectangle with the specified brush.
///
/// The image this method extends.
/// The options.
/// The brush.
/// The shape.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
IBrush brush,
RectangleF shape) =>
source.Fill(options, brush, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
///
/// Flood fills the image in the shape of the provided rectangle with the specified brush.
///
/// The image this method extends.
/// The brush.
/// The shape.
/// The .
public static IImageProcessingContext
Fill(this IImageProcessingContext source, IBrush brush, RectangleF shape) =>
source.Fill(brush, new RectangularPolygon(shape.X, shape.Y, shape.Width, shape.Height));
///
/// Flood fills the image in the shape of the provided rectangle with the specified brush.
///
/// The image this method extends.
/// The options.
/// The color.
/// The shape.
/// The .
public static IImageProcessingContext Fill(
this IImageProcessingContext source,
GraphicsOptions options,
Color color,
RectangleF shape) =>
source.Fill(options, new SolidBrush(color), shape);
///
/// Flood fills the image in the shape of the provided rectangle with the specified brush.
///
/// The image this method extends.
/// The color.
/// The shape.
/// The .
public static IImageProcessingContext
Fill(this IImageProcessingContext source, Color color, RectangleF shape) =>
source.Fill(new SolidBrush(color), shape);
}
}