diff --git a/ImageSharp.sln b/ImageSharp.sln
index f1e9fb1045..503a5b8601 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -60,11 +60,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageSharp.Sandbox46", "tes
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26} = {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}
{27AD4B5F-ECC4-4C63-9ECB-04EC772FDB6F} = {27AD4B5F-ECC4-4C63-9ECB-04EC772FDB6F}
{7213767C-0003-41CA-AB18-0223CFA7CE4B} = {7213767C-0003-41CA-AB18-0223CFA7CE4B}
+ {E5BD4F96-28A8-410C-8B63-1C5731948549} = {E5BD4F96-28A8-410C-8B63-1C5731948549}
{C77661B9-F793-422E-8E27-AC60ECC5F215} = {C77661B9-F793-422E-8E27-AC60ECC5F215}
{556ABDCF-ED93-4327-BE98-F6815F78B9B8} = {556ABDCF-ED93-4327-BE98-F6815F78B9B8}
{A623CFE9-9D2B-4528-AD1F-2E834B061134} = {A623CFE9-9D2B-4528-AD1F-2E834B061134}
EndProjectSection
EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ImageSharp.Drawing.Paths", "src\ImageSharp.Drawing.Paths\ImageSharp.Drawing.Paths.xproj", "{E5BD4F96-28A8-410C-8B63-1C5731948549}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -115,6 +118,10 @@ Global
{96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96188137-5FA6-4924-AB6E-4EFF79C6E0BB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E5BD4F96-28A8-410C-8B63-1C5731948549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E5BD4F96-28A8-410C-8B63-1C5731948549}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E5BD4F96-28A8-410C-8B63-1C5731948549}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E5BD4F96-28A8-410C-8B63-1C5731948549}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -132,5 +139,6 @@ Global
{A623CFE9-9D2B-4528-AD1F-2E834B061134} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{9E574A07-F879-4811-9C41-5CBDC6BAFDB7} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
{96188137-5FA6-4924-AB6E-4EFF79C6E0BB} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
+ {E5BD4F96-28A8-410C-8B63-1C5731948549} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
EndGlobalSection
EndGlobal
diff --git a/src/ImageSharp.Drawing.Paths/DrawBeziers.cs b/src/ImageSharp.Drawing.Paths/DrawBeziers.cs
new file mode 100644
index 0000000000..6515db5771
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/DrawBeziers.cs
@@ -0,0 +1,120 @@
+//
+// 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 Drawing.Processors;
+ using SixLabors.Shapes;
+
+ using Path = SixLabors.Shapes.Path;
+
+ ///
+ /// 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 source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The pen.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The pen.
+ /// The points.
+ /// The Image
+ public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, new Path(new BezierLineSegment(points)));
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing.Paths/DrawLines.cs b/src/ImageSharp.Drawing.Paths/DrawLines.cs
new file mode 100644
index 0000000000..2e4f849870
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/DrawLines.cs
@@ -0,0 +1,120 @@
+//
+// 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 Drawing.Processors;
+ using SixLabors.Shapes;
+
+ using Path = SixLabors.Shapes.Path;
+
+ ///
+ /// 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 source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The pen.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ 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 source.
+ /// The pen.
+ /// The points.
+ /// The Image
+ public static Image DrawLines(this Image source, IPen pen, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, new Path(new LinearLineSegment(points)));
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing.Paths/DrawPath.cs b/src/ImageSharp.Drawing.Paths/DrawPath.cs
new file mode 100644
index 0000000000..201984e0ac
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/DrawPath.cs
@@ -0,0 +1,124 @@
+//
+// 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 Drawing.Processors;
+ using SixLabors.Shapes;
+
+ ///
+ /// Extension methods for the type.
+ ///
+ public static partial class ImageExtensions
+ {
+ ///
+ /// Draws the outline of the polygon with the provided pen.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The pen.
+ /// The path.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, new ShapePath(path), options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided pen.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The pen.
+ /// The path.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IPen pen, IPath path)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, path, GraphicsOptions.Default);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The shape.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), path, options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The path.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IBrush brush, float thickness, IPath path)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), path);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The path.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, TColor color, float thickness, IPath path, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new SolidBrush(color), thickness, path, options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The path.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, TColor color, float thickness, IPath path)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new SolidBrush(color), thickness, path);
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing.Paths/DrawPolygon.cs b/src/ImageSharp.Drawing.Paths/DrawPolygon.cs
new file mode 100644
index 0000000000..73d8ec0e7f
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/DrawPolygon.cs
@@ -0,0 +1,104 @@
+//
+// 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 Drawing.Processors;
+ using SixLabors.Shapes;
+
+ ///
+ /// Extension methods for the type.
+ ///
+ public static partial class ImageExtensions
+ {
+ ///
+ /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options);
+ }
+
+ ///
+ /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)));
+ }
+
+ ///
+ /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The Image
+ public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.DrawPolygon(new SolidBrush(color), thickness, points);
+ }
+
+ ///
+ /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.DrawPolygon(new SolidBrush(color), thickness, points, options);
+ }
+
+ ///
+ /// Draws the provided Points as a closed Linear Polygon with the provided Pen.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The pen.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, new Polygon(new LinearLineSegment(points)), options);
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing/DrawRectangle.cs b/src/ImageSharp.Drawing.Paths/DrawRectangle.cs
similarity index 73%
rename from src/ImageSharp.Drawing/DrawRectangle.cs
rename to src/ImageSharp.Drawing.Paths/DrawRectangle.cs
index 243aa082d4..28ea3d6e03 100644
--- a/src/ImageSharp.Drawing/DrawRectangle.cs
+++ b/src/ImageSharp.Drawing.Paths/DrawRectangle.cs
@@ -30,10 +30,10 @@ namespace ImageSharp
///
/// The Image
///
- public static Image DrawPolygon(this Image source, IPen pen, RectangleF shape, GraphicsOptions options)
+ public static Image Draw(this Image source, IPen pen, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.Apply(new DrawPathProcessor(pen, new ShapeRegion(new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height)), options));
+ return source.Draw(pen, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options);
}
///
@@ -44,10 +44,10 @@ namespace ImageSharp
/// The pen.
/// The shape.
/// The Image
- public static Image DrawPolygon(this Image source, IPen pen, RectangleF shape)
+ public static Image Draw(this Image source, IPen pen, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.DrawPolygon(pen, shape, GraphicsOptions.Default);
+ return source.Draw(pen, shape, GraphicsOptions.Default);
}
///
@@ -62,10 +62,10 @@ namespace ImageSharp
///
/// The Image
///
- public static Image DrawPolygon(this Image source, IBrush brush, float thickness, RectangleF shape, GraphicsOptions options)
+ public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.DrawPolygon(new Pen(brush, thickness), shape, options);
+ return source.Draw(new Pen(brush, thickness), shape, options);
}
///
@@ -77,10 +77,10 @@ namespace ImageSharp
/// The thickness.
/// The shape.
/// The Image
- public static Image DrawPolygon(this Image source, IBrush brush, float thickness, RectangleF shape)
+ public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.DrawPolygon(new Pen(brush, thickness), shape);
+ return source.Draw(new Pen(brush, thickness), shape);
}
///
@@ -95,10 +95,10 @@ namespace ImageSharp
///
/// The Image
///
- public static Image DrawPolygon(this Image source, TColor color, float thickness, RectangleF shape, GraphicsOptions options)
+ public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape, GraphicsOptions options)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.DrawPolygon(new SolidBrush(color), thickness, shape, options);
+ return source.Draw(new SolidBrush(color), thickness, shape, options);
}
///
@@ -110,10 +110,10 @@ namespace ImageSharp
/// The thickness.
/// The shape.
/// The Image
- public static Image DrawPolygon(this Image source, TColor color, float thickness, RectangleF shape)
+ public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape)
where TColor : struct, IPackedPixel, IEquatable
{
- return source.DrawPolygon(new SolidBrush(color), thickness, shape);
+ return source.Draw(new SolidBrush(color), thickness, shape);
}
}
}
diff --git a/src/ImageSharp.Drawing.Paths/DrawShape.cs b/src/ImageSharp.Drawing.Paths/DrawShape.cs
new file mode 100644
index 0000000000..15ae2b1797
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/DrawShape.cs
@@ -0,0 +1,118 @@
+//
+// 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 Drawing.Processors;
+ using SixLabors.Shapes;
+
+ ///
+ /// Extension methods for the type.
+ ///
+ public static partial class ImageExtensions
+ {
+ ///
+ /// Draws the outline of the polygon with the provided pen.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The pen.
+ /// The shape.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IPen pen, IShape shape, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, new ShapePath(shape), options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided pen.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The pen.
+ /// The shape.
+ /// The Image
+ public static Image Draw(this Image source, IPen pen, IShape shape)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(pen, shape, GraphicsOptions.Default);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The shape.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, IBrush brush, float thickness, IShape shape, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), shape, options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The thickness.
+ /// The shape.
+ /// The Image
+ public static Image Draw(this Image source, IBrush brush, float thickness, IShape shape)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new Pen(brush, thickness), shape);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The shape.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Draw(this Image source, TColor color, float thickness, IShape shape, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new SolidBrush(color), thickness, shape, options);
+ }
+
+ ///
+ /// Draws the outline of the polygon with the provided brush at the provided thickness.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The thickness.
+ /// The shape.
+ /// The Image
+ public static Image Draw(this Image source, TColor color, float thickness, IShape shape)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Draw(new SolidBrush(color), thickness, shape);
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing.Paths/FillPaths.cs b/src/ImageSharp.Drawing.Paths/FillPaths.cs
new file mode 100644
index 0000000000..3095ee7cdf
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/FillPaths.cs
@@ -0,0 +1,87 @@
+//
+// 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.Processors;
+
+ using SixLabors.Shapes;
+
+ ///
+ /// Extension methods for the type.
+ ///
+ public static partial class ImageExtensions
+ {
+ ///
+ /// Flood fills the image in the shape of the provided polygon with the specified brush..
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The shape.
+ /// The graphics options.
+ ///
+ /// The Image
+ ///
+ public static Image Fill(this Image source, IBrush brush, IPath path, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(brush, new ShapeRegion(path), options);
+ }
+
+ ///
+ /// Flood fills the image in the shape of the provided polygon with the specified brush.
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The path.
+ ///
+ /// The Image
+ ///
+ public static Image Fill(this Image source, IBrush brush, IPath path)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default);
+ }
+
+ ///
+ /// Flood fills the image in the shape of the provided polygon with the specified brush..
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The path.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image Fill(this Image source, TColor color, IPath path, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(new SolidBrush(color), path, options);
+ }
+
+ ///
+ /// Flood fills the image in the shape of the provided polygon with the specified brush..
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The path.
+ ///
+ /// The Image
+ ///
+ public static Image Fill(this Image source, TColor color, IPath path)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(new SolidBrush(color), path);
+ }
+ }
+}
diff --git a/src/ImageSharp.Drawing.Paths/FillPolygon.cs b/src/ImageSharp.Drawing.Paths/FillPolygon.cs
new file mode 100644
index 0000000000..4092e5fc64
--- /dev/null
+++ b/src/ImageSharp.Drawing.Paths/FillPolygon.cs
@@ -0,0 +1,83 @@
+//
+// 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.Processors;
+
+ using SixLabors.Shapes;
+
+ ///
+ /// Extension methods for the type.
+ ///
+ public static partial class ImageExtensions
+ {
+ ///
+ /// Flood fills the image in the shape of a Linear polygon described by the points
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options);
+ }
+
+ ///
+ /// Flood fills the image in the shape of a Linear polygon described by the points
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The brush.
+ /// The points.
+ /// The Image
+ public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(brush, new Polygon(new LinearLineSegment(points)));
+ }
+
+ ///
+ /// Flood fills the image in the shape of a Linear polygon described by the points
+ ///
+ /// The type of the color.
+ /// The source.
+ /// The color.
+ /// The points.
+ /// The options.
+ ///
+ /// The Image
+ ///
+ public static Image FillPolygon(this Image source, TColor color, Vector2[] points, GraphicsOptions options)
+ where TColor : struct, IPackedPixel, IEquatable
+ {
+ return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options);
+ }
+
+ ///