// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp { using Drawing; using Drawing.Brushes; using ImageSharp.PixelFormats; 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 shapes. /// The graphics options. /// The . public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { foreach (IPath s in paths) { source.Fill(brush, s, options); } return source; } /// /// 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 paths. /// The . public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, IBrush brush, IPathCollection paths) where TPixel : struct, IPixel { return source.Fill(brush, paths, 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 paths. /// The options. /// The . public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPathCollection paths, GraphicsOptions options) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), paths, 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 paths. /// The . public static IImageProcessorApplicator Fill(this IImageProcessorApplicator source, TPixel color, IPathCollection paths) where TPixel : struct, IPixel { return source.Fill(new SolidBrush(color), paths); } } }