// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp { using System; using System.Numerics; using Drawing; using Drawing.Brushes; using Drawing.Pens; using SixLabors.Shapes; /// /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. /// The options. /// The . public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. /// The . public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points) where TColor : struct, IPixel { return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. /// The . public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points) where TColor : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. /// The options. /// The .> public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) where TColor : struct, IPixel { return source.DrawLines(new SolidBrush(color), thickness, points, options); } /// /// Draws the provided Points as an open Linear path with the supplied pen /// /// The type of the color. /// The image this method extends. /// The pen. /// The points. /// The options. /// The . public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) where TColor : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points)), options); } /// /// Draws the provided Points as an open Linear path with the supplied pen /// /// The type of the color. /// The image this method extends. /// The pen. /// The points. /// The . public static Image DrawLines(this Image source, IPen pen, Vector2[] points) where TColor : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points))); } } }