diff --git a/src/ImageSharp.Drawing/Drawing/Brushes/IBrush.cs b/src/ImageSharp.Drawing/Drawing/Brushes/IBrush.cs
index bb907281b..41d9081eb 100644
--- a/src/ImageSharp.Drawing/Drawing/Brushes/IBrush.cs
+++ b/src/ImageSharp.Drawing/Drawing/Brushes/IBrush.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
-using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
diff --git a/src/ImageSharp.Drawing/Drawing/Brushes/RecolorBrush{TPixel}.cs b/src/ImageSharp.Drawing/Drawing/Brushes/RecolorBrush{TPixel}.cs
index ac2588038..4cef8cc83 100644
--- a/src/ImageSharp.Drawing/Drawing/Brushes/RecolorBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Drawing/Brushes/RecolorBrush{TPixel}.cs
@@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp.Drawing.Brushes
this.targetColor = targetColor.ToVector4();
this.targetColorPixel = targetColor;
- // Lets hack a min max extreams for a color space by letting the IPackedPixel clamp our values to something in the correct spaces :)
+ // Lets hack a min max extremes for a color space by letting the IPackedPixel clamp our values to something in the correct spaces :)
var maxColor = default(TPixel);
maxColor.PackFromVector4(new Vector4(float.MaxValue));
var minColor = default(TPixel);
diff --git a/src/ImageSharp.Drawing/Drawing/Brushes/SolidBrush{TPixel}.cs b/src/ImageSharp.Drawing/Drawing/Brushes/SolidBrush{TPixel}.cs
index 3aff3aea1..1511ce86c 100644
--- a/src/ImageSharp.Drawing/Drawing/Brushes/SolidBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Drawing/Brushes/SolidBrush{TPixel}.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Drawing.Brushes.Processors;
using SixLabors.ImageSharp.Memory;
diff --git a/src/ImageSharp.Drawing/Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Drawing/Pens/IPen.cs
index 0680ec2f5..ed7de1461 100644
--- a/src/ImageSharp.Drawing/Drawing/Pens/IPen.cs
+++ b/src/ImageSharp.Drawing/Drawing/Pens/IPen.cs
@@ -1,8 +1,8 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System;
using SixLabors.ImageSharp.Drawing.Brushes;
-using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Drawing.Pens
@@ -21,7 +21,7 @@ namespace SixLabors.ImageSharp.Drawing.Pens
}
///
- /// Iterface represting the pattern and size of the stroke to apply with a Pen.
+ /// Interface representing the pattern and size of the stroke to apply with a Pen.
///
public interface IPen
{
@@ -33,6 +33,6 @@ namespace SixLabors.ImageSharp.Drawing.Pens
///
/// Gets the stoke pattern.
///
- System.ReadOnlySpan StrokePattern { get; }
+ ReadOnlySpan StrokePattern { get; }
}
}
diff --git a/src/ImageSharp.Drawing/Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Drawing/Pens/Pens.cs
index 6478b1b81..4eb2d5d20 100644
--- a/src/ImageSharp.Drawing/Drawing/Pens/Pens.cs
+++ b/src/ImageSharp.Drawing/Drawing/Pens/Pens.cs
@@ -7,14 +7,15 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Drawing.Pens
{
///
- /// Common Pen styles
+ /// Contains a collection of common Pen styles
///
public static class Pens
{
- private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f };
- private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f };
- private static readonly float[] DottedPattern = new[] { 1f, 1f };
- private static readonly float[] DashedPattern = new[] { 3f, 1f };
+ private static readonly float[] DashDotPattern = { 3f, 1f, 1f, 1f };
+ private static readonly float[] DashDotDotPattern = { 3f, 1f, 1f, 1f, 1f, 1f };
+ private static readonly float[] DottedPattern = { 1f, 1f };
+ private static readonly float[] DashedPattern = { 3f, 1f };
+ internal static readonly float[] EmptyPattern = new float[0];
///
/// Create a solid pen with out any drawing patterns
diff --git a/src/ImageSharp.Drawing/Drawing/Pens/Pen{TPixel}.cs b/src/ImageSharp.Drawing/Drawing/Pens/Pen{TPixel}.cs
index d2748e111..3956dde0c 100644
--- a/src/ImageSharp.Drawing/Drawing/Pens/Pen{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Drawing/Pens/Pen{TPixel}.cs
@@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Numerics;
using SixLabors.ImageSharp.Drawing.Brushes;
-using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Drawing.Pens
@@ -24,11 +22,10 @@ namespace SixLabors.ImageSharp.Drawing.Pens
public class Pen : IPen
where TPixel : struct, IPixel
{
- private static readonly float[] EmptyPattern = new float[0];
private readonly float[] pattern;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The color.
/// The width.
@@ -39,7 +36,7 @@ namespace SixLabors.ImageSharp.Drawing.Pens
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The brush.
/// The width.
@@ -52,7 +49,7 @@ namespace SixLabors.ImageSharp.Drawing.Pens
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The color.
/// The width.
@@ -62,12 +59,12 @@ namespace SixLabors.ImageSharp.Drawing.Pens
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The brush.
/// The width.
public Pen(IBrush brush, float width)
- : this(brush, width, EmptyPattern)
+ : this(brush, width, Pens.EmptyPattern)
{
}
diff --git a/src/ImageSharp.Drawing/Processing/Paths/ShapePath.cs b/src/ImageSharp.Drawing/Primitives/ShapePath.cs
similarity index 68%
rename from src/ImageSharp.Drawing/Processing/Paths/ShapePath.cs
rename to src/ImageSharp.Drawing/Primitives/ShapePath.cs
index 4c2278719..6b4ccd917 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/ShapePath.cs
+++ b/src/ImageSharp.Drawing/Primitives/ShapePath.cs
@@ -1,14 +1,9 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
-using System.Buffers;
-using System.Numerics;
-
-using SixLabors.ImageSharp.Memory;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp.Drawing
+namespace SixLabors.ImageSharp.Primitives
{
///
/// A mapping between a and a region.
@@ -20,10 +15,10 @@ namespace SixLabors.ImageSharp.Drawing
///
/// The shape.
/// The pen to apply to the shape.
- // SixLabors.shape willbe moving to a Span/ReadOnlySpan based API shortly use ToArray for now.
- public ShapePath(IPath shape, Pens.IPen pen)
+ // TODO: SixLabors.shape will be moving to a Span/ReadOnlySpan based API shortly use ToArray for now.
+ public ShapePath(IPath shape, Drawing.Pens.IPen pen)
: base(shape.GenerateOutline(pen.StrokeWidth, pen.StrokePattern.ToArray()))
{
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/Paths/ShapeRegion.cs b/src/ImageSharp.Drawing/Primitives/ShapeRegion.cs
similarity index 95%
rename from src/ImageSharp.Drawing/Processing/Paths/ShapeRegion.cs
rename to src/ImageSharp.Drawing/Primitives/ShapeRegion.cs
index 9e1f1bc35..cfd1945d0 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/ShapeRegion.cs
+++ b/src/ImageSharp.Drawing/Primitives/ShapeRegion.cs
@@ -2,12 +2,10 @@
// Licensed under the Apache License, Version 2.0.
using System;
-
-using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp.Drawing
+namespace SixLabors.ImageSharp.Primitives
{
///
/// A mapping between a and a region.
diff --git a/src/ImageSharp.Drawing/Processing/Paths/DrawBezierExtensions.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawBezierExtensions.cs
similarity index 72%
rename from src/ImageSharp.Drawing/Processing/Paths/DrawBezierExtensions.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawBezierExtensions.cs
index 7476f3a75..974c7a650 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/DrawBezierExtensions.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawBezierExtensions.cs
@@ -1,24 +1,21 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Numerics;
-using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Brushes;
using SixLabors.ImageSharp.Drawing.Pens;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// EAdds extensions that allow the drawing of Bezier paths to the type.
+ /// Adds extensions that allow the drawing of Bezier paths to the type.
///
public static class DrawBezierExtensions
{
///
- /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
+ /// 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.
@@ -28,13 +25,11 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)), options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)), options);
///
- /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
+ /// 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.
@@ -43,13 +38,11 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)));
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), new Path(new CubicBezierLineSegment(points)));
///
- /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
+ /// 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.
@@ -58,13 +51,11 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.DrawBeziers(new SolidBrush(color), thickness, points);
- }
+ where TPixel : struct, IPixel
+ => source.DrawBeziers(new SolidBrush(color), thickness, points);
///
- /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush
+ /// 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.
@@ -74,13 +65,11 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.DrawBeziers(new SolidBrush(color), thickness, points, options);
- }
+ where TPixel : struct, IPixel
+ => source.DrawBeziers(new SolidBrush(color), thickness, points, options);
///
- /// Draws the provided Points as an open Bezier path with the supplied pen
+ /// Draws the provided points as an open Bezier path with the supplied pen
///
/// The type of the color.
/// The image this method extends.
@@ -89,13 +78,11 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, new Path(new CubicBezierLineSegment(points)), options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, new Path(new CubicBezierLineSegment(points)), options);
///
- /// Draws the provided Points as an open Bezier path with the supplied pen
+ /// Draws the provided points as an open Bezier path with the supplied pen
///
/// The type of the color.
/// The image this method extends.
@@ -103,9 +90,7 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawBeziers(this IImageProcessingContext source, IPen pen, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, new Path(new CubicBezierLineSegment(points)));
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, new Path(new CubicBezierLineSegment(points)));
}
}
diff --git a/src/ImageSharp.Drawing/Processing/Overlays/DrawImage.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawImageExtensions.cs
similarity index 78%
rename from src/ImageSharp.Drawing/Processing/Overlays/DrawImage.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawImageExtensions.cs
index 9ff593d3e..1fa16da49 100644
--- a/src/ImageSharp.Drawing/Processing/Overlays/DrawImage.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawImageExtensions.cs
@@ -1,34 +1,17 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Drawing.Processors;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Processing.Overlays.Processors;
using SixLabors.Primitives;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// Extension methods for the type.
+ /// Adds extensions that allow the drawing of images to the type.
///
- public static partial class ImageExtensions
+ public static class DrawImageExtensions
{
- ///
- /// Draws the given image together with the current one by blending their pixels.
- ///
- /// The image this method extends.
- /// The image to blend with the currently processing image.
- /// The pixel format.
- /// The location to draw the blended image.
- /// The options.
- /// The .
- public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, Point location, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- source.ApplyProcessor(new DrawImageProcessor(image, location, options));
- return source;
- }
-
///
/// Draws the given image together with the current one by blending their pixels.
///
@@ -39,11 +22,7 @@ namespace SixLabors.ImageSharp
/// The .
public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, float opacity)
where TPixel : struct, IPixel
- {
- GraphicsOptions options = GraphicsOptions.Default;
- options.BlendPercentage = opacity;
- return DrawImage(source, image, Point.Empty, options);
- }
+ => source.ApplyProcessor(new DrawImageProcessor(image, opacity));
///
/// Draws the given image together with the current one by blending their pixels.
@@ -56,12 +35,7 @@ namespace SixLabors.ImageSharp
/// The .
public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity)
where TPixel : struct, IPixel
- {
- GraphicsOptions options = GraphicsOptions.Default;
- options.BlendPercentage = opacity;
- options.BlenderMode = blender;
- return DrawImage(source, image, Point.Empty, options);
- }
+ => source.ApplyProcessor(new DrawImageProcessor(image, opacity, blender));
///
/// Draws the given image together with the current one by blending their pixels.
@@ -74,7 +48,7 @@ namespace SixLabors.ImageSharp
public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, GraphicsOptions options)
where TPixel : struct, IPixel
{
- return DrawImage(source, image, Point.Empty, options);
+ return source.ApplyProcessor(new DrawImageProcessor(image, options));
}
///
@@ -88,11 +62,7 @@ namespace SixLabors.ImageSharp
/// The .
public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, float opacity, Point location)
where TPixel : struct, IPixel
- {
- GraphicsOptions options = GraphicsOptions.Default;
- options.BlendPercentage = opacity;
- return source.DrawImage(image, location, options);
- }
+ => source.ApplyProcessor(new DrawImageProcessor(image, location, opacity));
///
/// Draws the given image together with the current one by blending their pixels.
@@ -106,11 +76,19 @@ namespace SixLabors.ImageSharp
/// The .
public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity, Point location)
where TPixel : struct, IPixel
- {
- GraphicsOptions options = GraphicsOptions.Default;
- options.BlenderMode = blender;
- options.BlendPercentage = opacity;
- return source.DrawImage(image, location, options);
- }
+ => source.ApplyProcessor(new DrawImageProcessor(image, location, opacity, blender));
+
+ ///
+ /// Draws the given image together with the current one by blending their pixels.
+ ///
+ /// The image this method extends.
+ /// The image to blend with the currently processing image.
+ /// The pixel format.
+ /// The location to draw the blended image.
+ /// The options containing the blend mode and opacity.
+ /// The .
+ public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, Point location, GraphicsOptions options)
+ where TPixel : struct, IPixel
+ => source.ApplyProcessor(new DrawImageProcessor(image, location, options));
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/Paths/DrawLines.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawLineExtensions.cs
similarity index 78%
rename from src/ImageSharp.Drawing/Processing/Paths/DrawLines.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawLineExtensions.cs
index 397cd20e7..8bf42a07f 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/DrawLines.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawLineExtensions.cs
@@ -1,21 +1,18 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Numerics;
-using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Brushes;
using SixLabors.ImageSharp.Drawing.Pens;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// Extension methods for the type.
+ /// Adds extensions that allow the drawing of lines to the type.
///
- public static partial class ImageExtensions
+ public static class DrawLineExtensions
{
///
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
@@ -28,10 +25,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options);
- }
+ where TPixel : struct, IPixel
+ => 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
@@ -43,10 +38,8 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)));
- }
+ where TPixel : struct, IPixel
+ => 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
@@ -58,10 +51,8 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.DrawLines(new SolidBrush(color), thickness, points);
- }
+ where TPixel : struct, IPixel
+ => source.DrawLines(new SolidBrush(color), thickness, points);
///
/// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush
@@ -74,10 +65,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .>
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, TPixel color, float thickness, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.DrawLines(new SolidBrush(color), thickness, points, options);
- }
+ where TPixel : struct, IPixel
+ => source.DrawLines(new SolidBrush(color), thickness, points, options);
///
/// Draws the provided Points as an open Linear path with the supplied pen
@@ -89,10 +78,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, new Path(new LinearLineSegment(points)), options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, new Path(new LinearLineSegment(points)), options);
///
/// Draws the provided Points as an open Linear path with the supplied pen
@@ -103,9 +90,7 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawLines(this IImageProcessingContext source, IPen pen, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, new Path(new LinearLineSegment(points)));
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, new Path(new LinearLineSegment(points)));
}
}
diff --git a/src/ImageSharp.Drawing/Processing/Paths/DrawPathCollection.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawPathCollectionExtensions.cs
similarity index 82%
rename from src/ImageSharp.Drawing/Processing/Paths/DrawPathCollection.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawPathCollectionExtensions.cs
index 17d7fed41..191a73a36 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/DrawPathCollection.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawPathCollectionExtensions.cs
@@ -1,19 +1,17 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Brushes;
using SixLabors.ImageSharp.Drawing.Pens;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// Extension methods for the type.
+ /// Adds extensions that allow the drawing of collections of polygon outlines to the type.
///
- public static partial class ImageExtensions
+ public static class DrawPathCollectionExtensions
{
///
/// Draws the outline of the polygon with the provided pen.
@@ -44,10 +42,8 @@ namespace SixLabors.ImageSharp
/// The paths.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, paths, GraphicsOptions.Default);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, paths, GraphicsOptions.Default);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -60,10 +56,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), paths, options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), paths, options);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -75,10 +69,8 @@ namespace SixLabors.ImageSharp
/// The paths.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPathCollection paths)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), paths);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), paths);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -91,10 +83,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPathCollection paths, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new SolidBrush(color), thickness, paths, options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new SolidBrush(color), thickness, paths, options);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -106,9 +96,7 @@ namespace SixLabors.ImageSharp
/// The paths.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPathCollection paths)
- where TPixel : struct, IPixel
- {
- return source.Draw(new SolidBrush(color), thickness, paths);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new SolidBrush(color), thickness, paths);
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/Paths/DrawPath.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawPathExtensions.cs
similarity index 79%
rename from src/ImageSharp.Drawing/Processing/Paths/DrawPath.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawPathExtensions.cs
index b265342a4..7f86ddee6 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/DrawPath.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawPathExtensions.cs
@@ -1,19 +1,18 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Brushes;
using SixLabors.ImageSharp.Drawing.Pens;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Primitives;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// Extension methods for the type.
+ /// Adds extensions that allow the drawing of polygon outlines to the type.
///
- public static partial class ImageExtensions
+ public static class DrawPathExtensions
{
///
/// Draws the outline of the polygon with the provided pen.
@@ -25,10 +24,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Fill(pen.StrokeFill, new ShapePath(path, pen), options);
- }
+ where TPixel : struct, IPixel
+ => source.Fill(pen.StrokeFill, new ShapePath(path, pen), options);
///
/// Draws the outline of the polygon with the provided pen.
@@ -39,10 +36,8 @@ namespace SixLabors.ImageSharp
/// The path.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path)
- where TPixel : struct, IPixel
- {
- return source.Draw(pen, path, GraphicsOptions.Default);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(pen, path, GraphicsOptions.Default);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -55,10 +50,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), path, options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), path, options);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -70,10 +63,8 @@ namespace SixLabors.ImageSharp
/// The path.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), path);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new Pen(brush, thickness), path);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -86,10 +77,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPath path, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new SolidBrush(color), thickness, path, options);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new SolidBrush(color), thickness, path, options);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
@@ -101,9 +90,7 @@ namespace SixLabors.ImageSharp
/// The path.
/// The .
public static IImageProcessingContext Draw(this IImageProcessingContext source, TPixel color, float thickness, IPath path)
- where TPixel : struct, IPixel
- {
- return source.Draw(new SolidBrush(color), thickness, path);
- }
+ where TPixel : struct, IPixel
+ => source.Draw(new SolidBrush(color), thickness, path);
}
}
diff --git a/src/ImageSharp.Drawing/Processing/Paths/DrawPolygon.cs b/src/ImageSharp.Drawing/Processing/Overlays/DrawPolygonExtensions.cs
similarity index 78%
rename from src/ImageSharp.Drawing/Processing/Paths/DrawPolygon.cs
rename to src/ImageSharp.Drawing/Processing/Overlays/DrawPolygonExtensions.cs
index 7615284d2..f56ab19d8 100644
--- a/src/ImageSharp.Drawing/Processing/Paths/DrawPolygon.cs
+++ b/src/ImageSharp.Drawing/Processing/Overlays/DrawPolygonExtensions.cs
@@ -1,21 +1,18 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Numerics;
-using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Brushes;
using SixLabors.ImageSharp.Drawing.Pens;
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using SixLabors.Shapes;
-namespace SixLabors.ImageSharp
+namespace SixLabors.ImageSharp.Processing.Overlays
{
///
- /// Extension methods for the type.
+ /// Adds extensions that allow the drawing of closed linear polygons to the type.
///
- public static partial class ImageExtensions
+ public static class DrawPolygonExtensions
{
///
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
@@ -28,10 +25,8 @@ namespace SixLabors.ImageSharp
/// The options.
/// The .
public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points, GraphicsOptions options)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options);
- }
+ where TPixel : struct, IPixel
+ => 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.
@@ -43,10 +38,8 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawPolygon(this IImageProcessingContext source, IBrush brush, float thickness, PointF[] points)
- where TPixel : struct, IPixel
- {
- return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)));
- }
+ where TPixel : struct, IPixel
+ => 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.
@@ -58,10 +51,8 @@ namespace SixLabors.ImageSharp
/// The points.
/// The .
public static IImageProcessingContext DrawPolygon(this IImageProcessingContext