// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp { using System; using Drawing; using Drawing.Brushes; using Drawing.Processors; /// /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The source. /// The brush. /// The shape. /// The options. /// /// The Image /// public static Image Fill(this Image source, IBrush brush, RectangleF shape, GraphicsOptions options) where TColor : struct, IPackedPixel, IEquatable { return source.Apply(new FillShapeProcessor(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options)); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The source. /// The brush. /// The shape. /// The Image public static Image Fill(this Image source, IBrush brush, RectangleF shape) where TColor : struct, IPackedPixel, IEquatable { return source.Apply(new FillShapeProcessor(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), GraphicsOptions.Default)); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The source. /// The color. /// The shape. /// The options. /// /// The Image /// public static Image Fill(this Image source, TColor color, RectangleF shape, GraphicsOptions options) where TColor : struct, IPackedPixel, IEquatable { return source.Fill(new SolidBrush(color), shape, options); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The source. /// The color. /// The shape. /// The Image public static Image Fill(this Image source, TColor color, RectangleF shape) where TColor : struct, IPackedPixel, IEquatable { return source.Fill(new SolidBrush(color), shape); } } }