// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.Shapes; namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of collections of polygon outlines to the type. /// public static class DrawPathCollectionExtensions { /// /// Draws the outline of the polygon with the provided pen. /// /// The image this method extends. /// The options. /// The pen. /// The paths. /// The . public static IImageProcessingContext Draw( this IImageProcessingContext source, GraphicsOptions options, IPen pen, IPathCollection paths) { foreach (IPath path in paths) { source.Draw(options, pen, path); } return source; } /// /// Draws the outline of the polygon with the provided pen. /// /// The image this method extends. /// The pen. /// The paths. /// The . public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths) => source.Draw(new GraphicsOptions(), pen, paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The image this method extends. /// The options. /// The brush. /// The thickness. /// The shapes. /// The . public static IImageProcessingContext Draw( this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, IPathCollection paths) => source.Draw(options, new Pen(brush, thickness), paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The image this method extends. /// The brush. /// The thickness. /// The paths. /// The . public static IImageProcessingContext Draw( this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths) => source.Draw(new Pen(brush, thickness), paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The image this method extends. /// The options. /// The color. /// The thickness. /// The paths. /// The . public static IImageProcessingContext Draw( this IImageProcessingContext source, GraphicsOptions options, Color color, float thickness, IPathCollection paths) => source.Draw(options, new SolidBrush(color), thickness, paths); /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// /// The image this method extends. /// The color. /// The thickness. /// The paths. /// The . public static IImageProcessingContext Draw( this IImageProcessingContext source, Color color, float thickness, IPathCollection paths) => source.Draw(new SolidBrush(color), thickness, paths); } }