diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs
new file mode 100644
index 000000000..ca4f9598e
--- /dev/null
+++ b/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs
@@ -0,0 +1,102 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Processors.Effects;
+
+namespace SixLabors.ImageSharp.Processing
+{
+ ///
+ /// Defines extension methods that allow the application of user defined processing delegate to an .
+ ///
+ public static class PixelRowDelegateExtensions
+ {
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation)
+ => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None);
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ /// The to apply during the pixel conversions.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers)
+ => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers));
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ ///
+ /// The structure that specifies the portion of the image object to alter.
+ ///
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle)
+ => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None);
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ ///
+ /// The structure that specifies the portion of the image object to alter.
+ ///
+ /// The to apply during the pixel conversions.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers)
+ => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers), rectangle);
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PositionAwarePixelRowOperation rowOperation)
+ => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None);
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ /// The to apply during the pixel conversions.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PositionAwarePixelRowOperation rowOperation, PixelConversionModifiers modifiers)
+ => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers));
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ ///
+ /// The structure that specifies the portion of the image object to alter.
+ ///
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PositionAwarePixelRowOperation rowOperation, Rectangle rectangle)
+ => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None);
+
+ ///
+ /// Applies a user defined processing delegate to the image.
+ ///
+ /// The image this method extends.
+ /// The user defined processing delegate to use to modify image rows.
+ ///
+ /// The structure that specifies the portion of the image object to alter.
+ ///
+ /// The to apply during the pixel conversions.
+ /// The to allow chaining of operations.
+ public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PositionAwarePixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers)
+ => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers), rectangle);
+ }
+}
diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs
deleted file mode 100644
index 00fd54267..000000000
--- a/src/ImageSharp/Processing/Extensions/Effects/PixelShaderExtensions.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors.Effects;
-
-namespace SixLabors.ImageSharp.Processing
-{
- ///
- /// Defines extension methods that allow the application of user defined pixel shaders to an .
- ///
- public static class PixelShaderExtensions
- {
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader)
- => source.ApplyProcessor(new PixelShaderProcessor(pixelShader));
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- /// The to apply during the pixel conversions.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader, PixelConversionModifiers modifiers)
- => source.ApplyProcessor(new PixelShaderProcessor(pixelShader, modifiers));
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- ///
- /// The structure that specifies the portion of the image object to alter.
- ///
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader, Rectangle rectangle)
- => source.ApplyProcessor(new PixelShaderProcessor(pixelShader), rectangle);
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- ///
- /// The structure that specifies the portion of the image object to alter.
- ///
- /// The to apply during the pixel conversions.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PixelShader pixelShader, Rectangle rectangle, PixelConversionModifiers modifiers)
- => source.ApplyProcessor(new PixelShaderProcessor(pixelShader, modifiers), rectangle);
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader)
- => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader));
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- /// The to apply during the pixel conversions.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader, PixelConversionModifiers modifiers)
- => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader, modifiers));
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- ///
- /// The structure that specifies the portion of the image object to alter.
- ///
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader, Rectangle rectangle)
- => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader), rectangle);
-
- ///
- /// Applies a user defined pixel shader to the image.
- ///
- /// The image this method extends.
- /// The user defined pixel shader to use to modify images.
- ///
- /// The structure that specifies the portion of the image object to alter.
- ///
- /// The to apply during the pixel conversions.
- /// The to allow chaining of operations.
- public static IImageProcessingContext ApplyPixelShaderProcessor(this IImageProcessingContext source, PositionAwarePixelShader pixelShader, Rectangle rectangle, PixelConversionModifiers modifiers)
- => source.ApplyProcessor(new PositionAwarePixelShaderProcessor(pixelShader, modifiers), rectangle);
- }
-}
diff --git a/src/ImageSharp/Processing/PixelShader.cs b/src/ImageSharp/Processing/PixelRowOperation.cs
similarity index 82%
rename from src/ImageSharp/Processing/PixelShader.cs
rename to src/ImageSharp/Processing/PixelRowOperation.cs
index 0245931fb..6ef5b8bc3 100644
--- a/src/ImageSharp/Processing/PixelShader.cs
+++ b/src/ImageSharp/Processing/PixelRowOperation.cs
@@ -7,9 +7,9 @@ using System.Numerics;
namespace SixLabors.ImageSharp.Processing
{
///
- /// A representing a user defined pixel shader.
+ /// A representing a user defined processing delegate to use to modify image rows.
///
/// The target row of pixels to process.
/// The , , , and fields map the RGBA channels respectively.
- public delegate void PixelShader(Span span);
+ public delegate void PixelRowOperation(Span span);
}
diff --git a/src/ImageSharp/Processing/PositionAwarePixelShader.cs b/src/ImageSharp/Processing/PositionAwarePixelRowOperation.cs
similarity index 80%
rename from src/ImageSharp/Processing/PositionAwarePixelShader.cs
rename to src/ImageSharp/Processing/PositionAwarePixelRowOperation.cs
index c87d3ada6..c9fb1f96e 100644
--- a/src/ImageSharp/Processing/PositionAwarePixelShader.cs
+++ b/src/ImageSharp/Processing/PositionAwarePixelRowOperation.cs
@@ -7,10 +7,10 @@ using System.Numerics;
namespace SixLabors.ImageSharp.Processing
{
///
- /// A representing a user defined pixel shader.
+ /// A representing a user defined, position aware, processing delegate to use to modify image rows.
///
/// The target row of pixels to process.
/// The initial horizontal and vertical offset for the input pixels to process.
/// The , , , and fields map the RGBA channels respectively.
- public delegate void PositionAwarePixelShader(Span span, Point offset);
+ public delegate void PositionAwarePixelRowOperation(Span span, Point offset);
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs
new file mode 100644
index 000000000..84305bea3
--- /dev/null
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using SixLabors.ImageSharp.PixelFormats;
+
+namespace SixLabors.ImageSharp.Processing.Processors.Effects
+{
+ ///
+ /// Applies a user defined row processing delegate to the image.
+ ///
+ public sealed class PixelRowDelegateProcessor : IImageProcessor
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The user defined, row processing delegate.
+ /// The to apply during the pixel conversions.
+ public PixelRowDelegateProcessor(PixelRowOperation pixelRowOperation, PixelConversionModifiers modifiers)
+ {
+ this.PixelRowOperation = pixelRowOperation;
+ this.Modifiers = modifiers;
+ }
+
+ ///
+ /// Gets the user defined row processing delegate to the image.
+ ///
+ public PixelRowOperation PixelRowOperation { get; }
+
+ ///
+ /// Gets the to apply during the pixel conversions.
+ ///
+ public PixelConversionModifiers Modifiers { get; }
+
+ ///
+ public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
+ where TPixel : struct, IPixel
+ => new PixelRowDelegateProcessor(configuration, this, source, sourceRectangle);
+ }
+}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessorBase{TPixel}.cs
similarity index 76%
rename from src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs
rename to src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessorBase{TPixel}.cs
index 681f44651..019509dc2 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessorBase{TPixel}.cs
@@ -3,7 +3,6 @@
using System;
using System.Numerics;
-
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Advanced.ParallelUtils;
using SixLabors.ImageSharp.PixelFormats;
@@ -11,10 +10,10 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
///
- /// Applies a user defined pixel shader effect through a given delegate.
+ /// The base class for all processors that accept a user defined row processing delegate.
///
/// The pixel format.
- internal abstract class PixelShaderProcessorBase : ImageProcessor
+ internal abstract class PixelRowDelegateProcessorBase : ImageProcessor
where TPixel : struct, IPixel
{
///
@@ -23,17 +22,15 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
private readonly PixelConversionModifiers modifiers;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The configuration which allows altering default behaviour or extending the library.
/// The to apply during the pixel conversions.
/// The source for the current processor instance.
/// The source area to process for the current processor instance.
- protected PixelShaderProcessorBase(Configuration configuration, PixelConversionModifiers modifiers, Image source, Rectangle sourceRectangle)
+ protected PixelRowDelegateProcessorBase(Configuration configuration, PixelConversionModifiers modifiers, Image source, Rectangle sourceRectangle)
: base(configuration, source, sourceRectangle)
- {
- this.modifiers = modifiers;
- }
+ => this.modifiers = modifiers;
///
protected override void OnFrameApply(ImageFrame source)
@@ -55,8 +52,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
Span rowSpan = source.GetPixelRowSpan(y).Slice(startX, length);
PixelOperations.Instance.ToVector4(configuration, rowSpan, vectorSpan, modifiers);
- // Run the user defined pixel shader on the current row of pixels
- this.ApplyPixelShader(vectorSpan, new Point(startX, y));
+ // Run the user defined pixel shader to the current row of pixels
+ this.ApplyPixelRowDelegate(vectorSpan, new Point(startX, y));
PixelOperations.Instance.FromVector4Destructive(configuration, vectorSpan, rowSpan, modifiers);
}
@@ -64,10 +61,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
}
///
- /// Applies the current pixel shader effect on a target row of preprocessed pixels.
+ /// Applies the current pixel row delegate to a target row of preprocessed pixels.
///
/// The target row of pixels to process.
/// The initial horizontal and vertical offset for the input pixels to process.
- protected abstract void ApplyPixelShader(Span span, Point offset);
+ protected abstract void ApplyPixelRowDelegate(Span span, Point offset);
}
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel}.cs
similarity index 53%
rename from src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs
rename to src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel}.cs
index 244cfe3a7..da917eaf3 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel}.cs
@@ -9,31 +9,31 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
///
- /// Applies a user defined pixel shader effect through a given delegate.
+ /// Applies a user defined row processing delegate to the image.
///
/// The pixel format.
- internal sealed class PixelShaderProcessor : PixelShaderProcessorBase
+ internal sealed class PixelRowDelegateProcessor : PixelRowDelegateProcessorBase
where TPixel : struct, IPixel
{
///
- /// The user defined pixel shader.
+ /// The user defined pixel row processing delegate.
///
- private readonly PixelShader pixelShader;
+ private readonly PixelRowOperation pixelRowOperation;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The configuration which allows altering default behaviour or extending the library.
- /// The defining the processor parameters.
+ /// The defining the processor parameters.
/// The source for the current processor instance.
/// The source area to process for the current processor instance.
- public PixelShaderProcessor(Configuration configuration, PixelShaderProcessor definition, Image source, Rectangle sourceRectangle)
+ public PixelRowDelegateProcessor(Configuration configuration, PixelRowDelegateProcessor definition, Image source, Rectangle sourceRectangle)
: base(configuration, definition.Modifiers, source, sourceRectangle)
{
- this.pixelShader = definition.PixelShader;
+ this.pixelRowOperation = definition.PixelRowOperation;
}
///
- protected override void ApplyPixelShader(Span span, Point offset) => this.pixelShader(span);
+ protected override void ApplyPixelRowDelegate(Span span, Point offset) => this.pixelRowOperation(span);
}
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs
deleted file mode 100644
index fef80dfc4..000000000
--- a/src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessor.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-using SixLabors.ImageSharp.PixelFormats;
-
-namespace SixLabors.ImageSharp.Processing.Processors.Effects
-{
- ///
- /// Applies a user defined pixel shader effect through a given delegate.
- ///
- public sealed class PixelShaderProcessor : IImageProcessor
- {
- ///
- /// The default to apply during the pixel conversions.
- ///
- public const PixelConversionModifiers DefaultModifiers = PixelConversionModifiers.None;
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The user defined pixel shader to use to modify images.
- ///
- public PixelShaderProcessor(PixelShader pixelShader)
- {
- this.PixelShader = pixelShader;
- this.Modifiers = DefaultModifiers;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The user defined pixel shader to use to modify images.
- ///
- /// The to apply during the pixel conversions.
- public PixelShaderProcessor(PixelShader pixelShader, PixelConversionModifiers modifiers)
- {
- this.PixelShader = pixelShader;
- this.Modifiers = modifiers;
- }
-
- ///
- /// Gets the user defined pixel shader.
- ///
- public PixelShader PixelShader { get; }
-
- ///
- /// Gets the to apply during the pixel conversions.
- ///
- public PixelConversionModifiers Modifiers { get; }
-
- ///
- public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
- where TPixel : struct, IPixel
- => new PixelShaderProcessor(configuration, this, source, sourceRectangle);
- }
-}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs
new file mode 100644
index 000000000..f4a6c7ac0
--- /dev/null
+++ b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using SixLabors.ImageSharp.PixelFormats;
+
+namespace SixLabors.ImageSharp.Processing.Processors.Effects
+{
+ ///
+ /// Applies a user defined, position aware, row processing delegate to the image.
+ ///
+ public sealed class PositionAwarePixelRowDelegateProcessor : IImageProcessor
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The user defined, position aware, row processing delegate.
+ /// The to apply during the pixel conversions.
+ public PositionAwarePixelRowDelegateProcessor(PositionAwarePixelRowOperation pixelRowOperation, PixelConversionModifiers modifiers)
+ {
+ this.PixelRowOperation = pixelRowOperation;
+ this.Modifiers = modifiers;
+ }
+
+ ///
+ /// Gets the user defined, position aware, row processing delegate.
+ ///
+ public PositionAwarePixelRowOperation PixelRowOperation { get; }
+
+ ///
+ /// Gets the to apply during the pixel conversions.
+ ///
+ public PixelConversionModifiers Modifiers { get; }
+
+ ///
+ public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
+ where TPixel : struct, IPixel
+ => new PositionAwarePixelRowDelegateProcessor(configuration, this, source, sourceRectangle);
+ }
+}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor{TPixel}.cs
similarity index 60%
rename from src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs
rename to src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor{TPixel}.cs
index a539b5105..7242d8dcb 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelRowDelegateProcessor{TPixel}.cs
@@ -9,31 +9,31 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
///
- /// Applies a user defined pixel shader effect through a given delegate.
+ /// Applies a user defined, position aware, row processing delegate to the image.
///
/// The pixel format.
- internal sealed class PositionAwarePixelShaderProcessor : PixelShaderProcessorBase
+ internal sealed class PositionAwarePixelRowDelegateProcessor : PixelRowDelegateProcessorBase
where TPixel : struct, IPixel
{
///
/// The user defined pixel shader.
///
- private readonly PositionAwarePixelShader pixelShader;
+ private readonly PositionAwarePixelRowOperation pixelShader;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The configuration which allows altering default behaviour or extending the library.
- /// The defining the processor parameters.
+ /// The defining the processor parameters.
/// The source for the current processor instance.
/// The source area to process for the current processor instance.
- public PositionAwarePixelShaderProcessor(Configuration configuration, PositionAwarePixelShaderProcessor definition, Image source, Rectangle sourceRectangle)
+ public PositionAwarePixelRowDelegateProcessor(Configuration configuration, PositionAwarePixelRowDelegateProcessor definition, Image source, Rectangle sourceRectangle)
: base(configuration, definition.Modifiers, source, sourceRectangle)
{
- this.pixelShader = definition.PixelShader;
+ this.pixelShader = definition.PixelRowOperation;
}
///
- protected override void ApplyPixelShader(Span span, Point offset) => this.pixelShader(span, offset);
+ protected override void ApplyPixelRowDelegate(Span span, Point offset) => this.pixelShader(span, offset);
}
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs
deleted file mode 100644
index 7494f6ffc..000000000
--- a/src/ImageSharp/Processing/Processors/Effects/PositionAwarePixelShaderProcessor.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-using SixLabors.ImageSharp.PixelFormats;
-
-namespace SixLabors.ImageSharp.Processing.Processors.Effects
-{
- ///
- /// Applies a user defined pixel shader effect through a given delegate.
- ///
- public sealed class PositionAwarePixelShaderProcessor : IImageProcessor
- {
- ///
- /// The default to apply during the pixel conversions.
- ///
- public const PixelConversionModifiers DefaultModifiers = PixelConversionModifiers.None;
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The user defined pixel shader to use to modify images.
- ///
- public PositionAwarePixelShaderProcessor(PositionAwarePixelShader pixelShader)
- {
- this.PixelShader = pixelShader;
- this.Modifiers = DefaultModifiers;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The user defined pixel shader to use to modify images.
- ///
- /// The to apply during the pixel conversions.
- public PositionAwarePixelShaderProcessor(PositionAwarePixelShader pixelShader, PixelConversionModifiers modifiers)
- {
- this.PixelShader = pixelShader;
- this.Modifiers = modifiers;
- }
-
- ///
- /// Gets the user defined pixel shader.
- ///
- public PositionAwarePixelShader PixelShader { get; }
-
- ///
- /// Gets the to apply during the pixel conversions.
- ///
- public PixelConversionModifiers Modifiers { get; }
-
- ///
- public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
- where TPixel : struct, IPixel
- => new PositionAwarePixelShaderProcessor(configuration, this, source, sourceRectangle);
- }
-}
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs
index c18f04385..00a45a94e 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs
@@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
where TPixel : struct, IPixel
{
provider.RunValidatingProcessorTest(
- x => x.ApplyPixelShaderProcessor(
+ x => x.ProcessPixelRowsAsVector4(
span =>
{
for (int i = 0; i < span.Length; i++)
@@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
where TPixel : struct, IPixel
{
provider.RunRectangleConstrainedValidatingProcessorTest(
- (x, rect) => x.ApplyPixelShaderProcessor(
+ (x, rect) => x.ProcessPixelRowsAsVector4(
span =>
{
for (int i = 0; i < span.Length; i++)
@@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
where TPixel : struct, IPixel
{
provider.RunValidatingProcessorTest(
- c => c.ApplyPixelShaderProcessor(
+ c => c.ProcessPixelRowsAsVector4(
(span, offset) =>
{
int y = offset.Y;
@@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
where TPixel : struct, IPixel
{
provider.RunRectangleConstrainedValidatingProcessorTest(
- (c, rect) => c.ApplyPixelShaderProcessor(
+ (c, rect) => c.ProcessPixelRowsAsVector4(
(span, offset) =>
{
int y = offset.Y;