// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.Primitives; using SixLabors.Shapes; namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of lines to the type. /// public static class DrawLineExtensions { /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// /// The image this method extends. /// The options. /// The brush. /// The thickness. /// The points. /// The . public static IImageProcessingContext DrawLines( this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, params PointF[] points) => source.Draw(options, 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 image this method extends. /// The brush. /// The thickness. /// The points. /// The . public static IImageProcessingContext DrawLines( this IImageProcessingContext source, IBrush brush, float thickness, params PointF[] points) => 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 image this method extends. /// The color. /// The thickness. /// The points. /// The . public static IImageProcessingContext DrawLines( this IImageProcessingContext source, Color color, float thickness, params PointF[] points) => 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 image this method extends. /// The options. /// The color. /// The thickness. /// The points. /// The .> public static IImageProcessingContext DrawLines( this IImageProcessingContext source, GraphicsOptions options, Color color, float thickness, params PointF[] points) => source.DrawLines(options, new SolidBrush(color), thickness, points); /// /// Draws the provided Points as an open Linear path with the supplied pen /// /// The image this method extends. /// The options. /// The pen. /// The points. /// The . public static IImageProcessingContext DrawLines( this IImageProcessingContext source, GraphicsOptions options, IPen pen, params PointF[] points) => source.Draw(options, pen, new Path(new LinearLineSegment(points))); /// /// Draws the provided Points as an open Linear path with the supplied pen /// /// The image this method extends. /// The pen. /// The points. /// The . public static IImageProcessingContext DrawLines( this IImageProcessingContext source, IPen pen, params PointF[] points) => source.Draw(pen, new Path(new LinearLineSegment(points))); } }