// // 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 SixLabors.Shapes; /// /// 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 image this method extends. /// The brush. /// The shape. /// The graphics options. /// The . public static Image Fill(this Image source, IBrush brush, IPath path, GraphicsOptions options) where TColor : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), options); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush. /// /// The type of the color. /// The image this method extends. /// The brush. /// The path. /// The . public static Image Fill(this Image source, IBrush brush, IPath path) where TColor : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The image this method extends. /// The color. /// The path. /// The options. /// The . public static Image Fill(this Image source, TColor color, IPath path, GraphicsOptions options) where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), path, options); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// /// The type of the color. /// The image this method extends. /// The color. /// The path. /// The . public static Image Fill(this Image source, TColor color, IPath path) where TColor : struct, IPixel { return source.Fill(new SolidBrush(color), path); } } }