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