diff --git a/src/ImageSharp.Drawing/Processing/DrawingHelpers.cs b/src/ImageSharp.Drawing/Processing/DrawingHelpers.cs
index 314b65f7e..b4ce0c5cb 100644
--- a/src/ImageSharp.Drawing/Processing/DrawingHelpers.cs
+++ b/src/ImageSharp.Drawing/Processing/DrawingHelpers.cs
@@ -1,5 +1,5 @@
-// // Copyright (c) Six Labors and contributors.
-// // Licensed under the Apache License, Version 2.0.
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
@@ -8,6 +8,9 @@ namespace SixLabors.ImageSharp.Processing
{
internal static class DrawingHelpers
{
+ ///
+ /// Convert a to a of the given pixel type.
+ ///
public static DenseMatrix ToPixelMatrix(this DenseMatrix colorMatrix, Configuration configuration)
where TPixel : struct, IPixel
{
diff --git a/src/ImageSharp.Drawing/Processing/Extensions/DrawPathExtensions.cs b/src/ImageSharp.Drawing/Processing/Extensions/DrawPathExtensions.cs
index f231f1baa..efafdde5a 100644
--- a/src/ImageSharp.Drawing/Processing/Extensions/DrawPathExtensions.cs
+++ b/src/ImageSharp.Drawing/Processing/Extensions/DrawPathExtensions.cs
@@ -15,80 +15,90 @@ namespace SixLabors.ImageSharp.Processing
///
/// Draws the outline of the polygon with the provided pen.
///
-
/// The image this method extends.
/// The options.
/// The pen.
/// The path.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IPen pen, IPath path)
-
- => source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
+ public static IImageProcessingContext Draw(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ IPen pen,
+ IPath path) =>
+ source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
///
/// Draws the outline of the polygon with the provided pen.
///
-
/// The image this method extends.
/// The pen.
/// The path.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path)
-
- => source.Draw(GraphicsOptions.Default, pen, path);
+ public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) =>
+ source.Draw(GraphicsOptions.Default, pen, path);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
-
/// The image this method extends.
/// The options.
/// The brush.
/// The thickness.
/// The shape.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, float thickness, IPath path)
-
- => source.Draw(options, new Pen(brush, thickness), path);
+ public static IImageProcessingContext Draw(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ IBrush brush,
+ float thickness,
+ IPath path) =>
+ source.Draw(options, new Pen(brush, thickness), path);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
-
/// The image this method extends.
/// The brush.
/// The thickness.
/// The path.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, IBrush brush, float thickness, IPath path)
-
- => source.Draw(new Pen(brush, thickness), path);
+ public static IImageProcessingContext Draw(
+ this IImageProcessingContext source,
+ IBrush brush,
+ float thickness,
+ IPath path) =>
+ source.Draw(new Pen(brush, thickness), path);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
-
/// The image this method extends.
/// The options.
/// The color.
/// The thickness.
/// The path.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, GraphicsOptions options, Color color, float thickness, IPath path)
-
- => source.Draw(options, new SolidBrush(color), thickness, path);
+ public static IImageProcessingContext Draw(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ Color color,
+ float thickness,
+ IPath path) =>
+ source.Draw(options, new SolidBrush(color), thickness, path);
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
-
/// The image this method extends.
/// The color.
/// The thickness.
/// The path.
/// The .
- public static IImageProcessingContext Draw(this IImageProcessingContext source, Color color, float thickness, IPath path)
-
- => source.Draw(new SolidBrush(color), thickness, path);
+ public static IImageProcessingContext Draw(
+ this IImageProcessingContext source,
+ Color color,
+ float thickness,
+ IPath path) =>
+ source.Draw(new SolidBrush(color), thickness, path);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs b/src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs
index 7cf67612a..718016a9e 100644
--- a/src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs
+++ b/src/ImageSharp.Drawing/Processing/Extensions/FillPathExtensions.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Shapes;
@@ -15,51 +14,51 @@ namespace SixLabors.ImageSharp.Processing
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
-
/// The image this method extends.
/// The graphics options.
/// The brush.
/// The shape.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, IPath path)
-
- => source.Fill(options, brush, new ShapeRegion(path));
+ public static IImageProcessingContext Fill(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ IBrush brush,
+ IPath path) =>
+ source.Fill(options, brush, new ShapeRegion(path));
///
/// Flood fills the image in the shape of the provided polygon with the specified brush.
///
-
/// The image this method extends.
/// The brush.
/// The path.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path)
-
- => source.Fill(GraphicsOptions.Default, brush, new ShapeRegion(path));
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, IPath path) =>
+ source.Fill(GraphicsOptions.Default, brush, new ShapeRegion(path));
///
/// Flood fills the image in the shape of the provided polygon with the specified brush..
///
-
/// The image this method extends.
/// The options.
/// The color.
/// The path.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, Color color, IPath path)
-
- => source.Fill(options, new SolidBrush(color), path);
+ public static IImageProcessingContext Fill(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ Color color,
+ IPath path) =>
+ source.Fill(options, new SolidBrush(color), path);
///
/// Flood fills the image in the shape of the provided polygon with the specified brush..
///
-
/// The image this method extends.
/// The color.
/// The path.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, IPath path)
-
- => source.Fill(new SolidBrush(color), path);
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, IPath path) =>
+ source.Fill(new SolidBrush(color), path);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs b/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs
index 457ad98b0..294e57514 100644
--- a/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs
+++ b/src/ImageSharp.Drawing/Processing/Extensions/FillRegionExtensions.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Drawing;
@@ -15,85 +14,82 @@ namespace SixLabors.ImageSharp.Processing
///
/// Flood fills the image with the specified brush.
///
-
/// The image this method extends.
/// The details how to fill the region of interest.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush)
-
- => source.Fill(GraphicsOptions.Default, brush);
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush) =>
+ source.Fill(GraphicsOptions.Default, brush);
///
/// Flood fills the image with the specified color.
///
-
/// The image this method extends.
/// The color.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color)
-
- => source.Fill(new SolidBrush(color));
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color) =>
+ source.Fill(new SolidBrush(color));
///
/// Flood fills the image with in the region with the specified brush.
///
-
/// The image this method extends.
/// The brush.
/// The region.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region)
-
- => source.Fill(GraphicsOptions.Default, brush, region);
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, IBrush brush, Region region) =>
+ source.Fill(GraphicsOptions.Default, brush, region);
///
/// Flood fills the image with in the region with the specified color.
///
-
/// The image this method extends.
/// The options.
/// The color.
/// The region.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, Color color, Region region)
-
- => source.Fill(options, new SolidBrush(color), region);
+ public static IImageProcessingContext Fill(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ Color color,
+ Region region) =>
+ source.Fill(options, new SolidBrush(color), region);
///
/// Flood fills the image with in the region with the specified color.
///
-
/// The image this method extends.
/// The color.
/// The region.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, Region region)
-
- => source.Fill(new SolidBrush(color), region);
+ public static IImageProcessingContext Fill(this IImageProcessingContext source, Color color, Region region) =>
+ source.Fill(new SolidBrush(color), region);
///
/// Flood fills the image with in the region with the specified brush.
///
-
/// The image this method extends.
/// The graphics options.
/// The brush.
/// The region.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush, Region region)
-
- => source.ApplyProcessor(new FillRegionProcessor(brush, region, options));
+ public static IImageProcessingContext Fill(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ IBrush brush,
+ Region region) =>
+ source.ApplyProcessor(new FillRegionProcessor(brush, region, options));
///
/// Flood fills the image with the specified brush.
///
-
/// The image this method extends.
/// The graphics options.
/// The details how to fill the region of interest.
/// The .
- public static IImageProcessingContext Fill(this IImageProcessingContext source, GraphicsOptions options, IBrush brush)
-
- => source.ApplyProcessor(new FillProcessor(brush, options));
+ public static IImageProcessingContext Fill(
+ this IImageProcessingContext source,
+ GraphicsOptions options,
+ IBrush brush) =>
+ source.ApplyProcessor(new FillProcessor(brush, options));
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/GradientBrushBase.cs b/src/ImageSharp.Drawing/Processing/GradientBrushBase.cs
index a877ea96c..6e1e0086d 100644
--- a/src/ImageSharp.Drawing/Processing/GradientBrushBase.cs
+++ b/src/ImageSharp.Drawing/Processing/GradientBrushBase.cs
@@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Processing
///
/// Base class for gradient brush applicators
///
- protected abstract class GradientBrushApplicatorBase : BrushApplicator
+ internal abstract class GradientBrushApplicatorBase : BrushApplicator
where TPixel : struct, IPixel
{
private readonly ColorStop[] colorStops;
diff --git a/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs b/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs
index c156153be..6aed8a030 100644
--- a/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs
+++ b/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs
@@ -21,16 +21,16 @@ namespace SixLabors.ImageSharp.Processing
///
/// Reflect the gradient.
- /// Similar to , but each other repetition uses inverse order of s.
+ /// Similar to , but each other repetition uses inverse order of s.
/// Used on a Black-White gradient, Reflect leads to Black->{gray}->White->{gray}->White...
///
Reflect,
///
/// With DontFill a gradient does not touch any pixel beyond it's borders.
- /// For the this is beyond the orthogonal through start and end,
+ /// For the this is beyond the orthogonal through start and end,
/// TODO For the cref="PolygonalGradientBrush" it's outside the polygon,
- /// For and it's beyond 1.0.
+ /// For and it's beyond 1.0.
///
DontFill
}
diff --git a/src/ImageSharp.Drawing/Processing/IBrush.cs b/src/ImageSharp.Drawing/Processing/IBrush.cs
index aa8c25b95..0cd2e20fd 100644
--- a/src/ImageSharp.Drawing/Processing/IBrush.cs
+++ b/src/ImageSharp.Drawing/Processing/IBrush.cs
@@ -9,16 +9,16 @@ namespace SixLabors.ImageSharp.Processing
///
/// Brush represents a logical configuration of a brush which can be used to source pixel colors
///
- /// The pixel format.
///
/// A brush is a simple class that will return an that will perform the
- /// logic for converting a pixel location to a .
+ /// logic for retrieving pixel values for specific locations.
///
public interface IBrush
{
///
/// Creates the applicator for this brush.
///
+ /// The pixel type.
/// The source image.
/// The region the brush will be applied to.
/// The graphic options
diff --git a/src/ImageSharp.Drawing/Processing/IPen.cs b/src/ImageSharp.Drawing/Processing/IPen.cs
index b9e359d60..af7517905 100644
--- a/src/ImageSharp.Drawing/Processing/IPen.cs
+++ b/src/ImageSharp.Drawing/Processing/IPen.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
+
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing
@@ -15,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing
/// Gets the stroke fill.
///
IBrush StrokeFill { get; }
-
+
///
/// Gets the width to apply to the stroke
///
@@ -26,4 +27,4 @@ namespace SixLabors.ImageSharp.Processing
///
ReadOnlySpan StrokePattern { get; }
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processing/ImageBrush.cs b/src/ImageSharp.Drawing/Processing/ImageBrush.cs
index c2a8d3a26..33f7b831a 100644
--- a/src/ImageSharp.Drawing/Processing/ImageBrush.cs
+++ b/src/ImageSharp.Drawing/Processing/ImageBrush.cs
@@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.Processing
}
specificImage = this.image.CloneAs();
-
+
return new ImageBrushApplicator(source, specificImage, region, options, true);
}
diff --git a/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs b/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs
index fac43ad63..6eeadee5d 100644
--- a/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs
+++ b/src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs
@@ -14,7 +14,6 @@ namespace SixLabors.ImageSharp.Processing
/// - a set of colors in relative distances to each other.
///
public sealed class LinearGradientBrush : GradientBrushBase
-
{
private readonly PointF p1;
@@ -39,8 +38,17 @@ namespace SixLabors.ImageSharp.Processing
}
///
- public override BrushApplicator CreateApplicator(ImageFrame source, RectangleF region, GraphicsOptions options)
- => new LinearGradientBrushApplicator(source, this.p1, this.p2, this.ColorStops, this.RepetitionMode, options);
+ public override BrushApplicator CreateApplicator(
+ ImageFrame source,
+ RectangleF region,
+ GraphicsOptions options) =>
+ new LinearGradientBrushApplicator(
+ source,
+ this.p1,
+ this.p2,
+ this.ColorStops,
+ this.RepetitionMode,
+ options);
///
/// The linear gradient brush applicator.
@@ -137,9 +145,7 @@ namespace SixLabors.ImageSharp.Processing
float y4 = y + (k * this.alongX);
// get distance from (x4,y4) to start
- float distance = (float)Math.Sqrt(
- Math.Pow(x4 - this.start.X, 2)
- + Math.Pow(y4 - this.start.Y, 2));
+ float distance = (float)Math.Sqrt(Math.Pow(x4 - this.start.X, 2) + Math.Pow(y4 - this.start.Y, 2));
// get and return ratio
float ratio = distance / this.length;