|
|
|
@ -19,6 +19,25 @@ namespace ImageSharp |
|
|
|
/// </summary>
|
|
|
|
public static partial class ImageExtensions |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Draws the outline of the polygon with the provided pen.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="pen">The pen.</param>
|
|
|
|
/// <param name="shape">The shape.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, IPen<TColor, TPacked> pen, IShape shape, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.Process(new DrawPathProcessor<TColor, TPacked>(pen, shape, options)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the outline of the polygon with the provided pen.
|
|
|
|
/// </summary>
|
|
|
|
@ -32,7 +51,27 @@ namespace ImageSharp |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.Process(new DrawPathProcessor<TColor, TPacked>(pen, shape)); |
|
|
|
return source.DrawPolygon(pen, shape, GraphicsOptions.Default); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the outline of the polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="brush">The brush.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="shape">The shape.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, float thickness, IShape shape, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPolygon(new Pen<TColor, TPacked>(brush, thickness), shape, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -52,6 +91,26 @@ namespace ImageSharp |
|
|
|
return source.DrawPolygon(new Pen<TColor, TPacked>(brush, thickness), shape); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the outline of the polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="color">The color.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="shape">The shape.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float thickness, IShape shape, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPolygon(new SolidBrush<TColor, TPacked>(color), thickness, shape, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the outline of the polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
@ -69,6 +128,26 @@ namespace ImageSharp |
|
|
|
return source.DrawPolygon(new SolidBrush<TColor, TPacked>(color), thickness, shape); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="brush">The brush.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPolygon(new Pen<TColor, TPacked>(brush, thickness), new Polygon(new LinearLineSegment(points)), options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
@ -103,6 +182,44 @@ namespace ImageSharp |
|
|
|
return source.DrawPolygon(new SolidBrush<TColor, TPacked>(color), thickness, points); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="color">The color.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPolygon(new SolidBrush<TColor, TPacked>(color), thickness, points, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="pen">The pen.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPolygon<TColor, TPacked>(this Image<TColor, TPacked> source, IPen<TColor, TPacked> pen, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points)), options); |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
|
|
|
|
/// </summary>
|
|
|
|
@ -119,6 +236,25 @@ namespace ImageSharp |
|
|
|
return source.DrawPolygon(pen, new Polygon(new LinearLineSegment(points))); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the path with the provided pen.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="pen">The pen.</param>
|
|
|
|
/// <param name="path">The path.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPath<TColor, TPacked>(this Image<TColor, TPacked> source, IPen<TColor, TPacked> pen, IPath path, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.Process(new DrawPathProcessor<TColor, TPacked>(pen, path, options)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the path with the provided pen.
|
|
|
|
/// </summary>
|
|
|
|
@ -132,7 +268,27 @@ namespace ImageSharp |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.Process(new DrawPathProcessor<TColor, TPacked>(pen, path)); |
|
|
|
return source.Process(new DrawPathProcessor<TColor, TPacked>(pen, path, GraphicsOptions.Default)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the path with the bursh at the privdied thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="brush">The brush.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="path">The path.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPath<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, float thickness, IPath path, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(new Pen<TColor, TPacked>(brush, thickness), path, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -152,6 +308,26 @@ namespace ImageSharp |
|
|
|
return source.DrawPath(new Pen<TColor, TPacked>(brush, thickness), path); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the path with the bursh at the privdied thickness.
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="color">The color.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="path">The path.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawPath<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float thickness, IPath path, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(new SolidBrush<TColor, TPacked>(color), thickness, path, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the path with the bursh at the privdied thickness.
|
|
|
|
/// </summary>
|
|
|
|
@ -169,6 +345,26 @@ namespace ImageSharp |
|
|
|
return source.DrawPath(new SolidBrush<TColor, TPacked>(color), thickness, path); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="brush">The brush.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawLines<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(new Pen<TColor, TPacked>(brush, thickness), new Path(new LinearLineSegment(points)), options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
|
|
|
|
/// </summary>
|
|
|
|
@ -203,6 +399,45 @@ namespace ImageSharp |
|
|
|
return source.DrawLines(new SolidBrush<TColor, TPacked>(color), thickness, points); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="color">The color.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawLines<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawLines(new SolidBrush<TColor, TPacked>(color), thickness, points, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Linear path with the supplied pen
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="pen">The pen.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawLines<TColor, TPacked>(this Image<TColor, TPacked> source, IPen<TColor, TPacked> pen, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(pen, new Path(new LinearLineSegment(points)), options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Linear path with the supplied pen
|
|
|
|
/// </summary>
|
|
|
|
@ -218,7 +453,26 @@ namespace ImageSharp |
|
|
|
{ |
|
|
|
return source.DrawPath(pen, new Path(new LinearLineSegment(points))); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="brush">The brush.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawBeziers<TColor, TPacked>(this Image<TColor, TPacked> source, IBrush<TColor, TPacked> brush, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(new Pen<TColor, TPacked>(brush, thickness), new Path(new BezierLineSegment(points)), options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
|
|
|
|
@ -254,6 +508,45 @@ namespace ImageSharp |
|
|
|
return source.DrawBeziers(new SolidBrush<TColor, TPacked>(color), thickness, points); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="color">The color.</param>
|
|
|
|
/// <param name="thickness">The thickness.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawBeziers<TColor, TPacked>(this Image<TColor, TPacked> source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawBeziers(new SolidBrush<TColor, TPacked>(color), thickness, points, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Bezier path with the supplied pen
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|
|
|
/// <typeparam name="TPacked">The type of the packed.</typeparam>
|
|
|
|
/// <param name="source">The source.</param>
|
|
|
|
/// <param name="pen">The pen.</param>
|
|
|
|
/// <param name="points">The points.</param>
|
|
|
|
/// <param name="options">The options.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// The Image
|
|
|
|
/// </returns>
|
|
|
|
public static Image<TColor, TPacked> DrawBeziers<TColor, TPacked>(this Image<TColor, TPacked> source, IPen<TColor, TPacked> pen, Vector2[] points, GraphicsOptions options) |
|
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|
where TPacked : struct |
|
|
|
{ |
|
|
|
return source.DrawPath(pen, new Path(new BezierLineSegment(points)), options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Draws the provided Points as an open Bezier path with the supplied pen
|
|
|
|
/// </summary>
|
|
|
|
|