diff --git a/src/ImageSharp/Samplers/Convolution/BoxBlur.cs b/src/ImageSharp/Filters/Convolution/BoxBlur.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Convolution/BoxBlur.cs
rename to src/ImageSharp/Filters/Convolution/BoxBlur.cs
diff --git a/src/ImageSharp/Samplers/Convolution/DetectEdges.cs b/src/ImageSharp/Filters/Convolution/DetectEdges.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Convolution/DetectEdges.cs
rename to src/ImageSharp/Filters/Convolution/DetectEdges.cs
diff --git a/src/ImageSharp/Samplers/Convolution/GaussianBlur.cs b/src/ImageSharp/Filters/Convolution/GaussianBlur.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Convolution/GaussianBlur.cs
rename to src/ImageSharp/Filters/Convolution/GaussianBlur.cs
diff --git a/src/ImageSharp/Samplers/Convolution/GaussianSharpen.cs b/src/ImageSharp/Filters/Convolution/GaussianSharpen.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Convolution/GaussianSharpen.cs
rename to src/ImageSharp/Filters/Convolution/GaussianSharpen.cs
diff --git a/src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs b/src/ImageSharp/Filters/Convolution/Options/EdgeDetection.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs
rename to src/ImageSharp/Filters/Convolution/Options/EdgeDetection.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs
similarity index 89%
rename from src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs
index a8ff27aafa..efe5fcf7ef 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/BoxBlurProcessor.cs
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class BoxBlurProcessor : ImageSamplingProcessor
+ public class BoxBlurProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -43,9 +43,9 @@ namespace ImageSharp.Processors
public float[][] KernelY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs
similarity index 92%
rename from src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs
index 61b86c5d1a..c0d23adf11 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/Convolution2DProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class Convolution2DProcessor : ImageSamplingProcessor
+ public class Convolution2DProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -40,7 +40,7 @@ namespace ImageSharp.Processors
public float[][] KernelY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
int kernelYHeight = this.KernelY.Length;
int kernelYWidth = this.KernelY[0].Length;
@@ -56,8 +56,10 @@ namespace ImageSharp.Processors
int maxY = sourceBottom - 1;
int maxX = endX - 1;
+
+ TColor[] target = new TColor[source.Width * source.Height];
using (PixelAccessor sourcePixels = source.Lock())
- using (PixelAccessor targetPixels = target.Lock())
+ using (PixelAccessor targetPixels = target.Lock(source.Width, source.Height))
{
Parallel.For(
startY,
@@ -116,14 +118,15 @@ namespace ImageSharp.Processors
float green = (float)Math.Sqrt((gX * gX) + (gY * gY));
float blue = (float)Math.Sqrt((bX * bX) + (bY * bY));
- Vector4 targetColor = targetPixels[x, y].ToVector4();
TColor packed = default(TColor);
- packed.PackFromVector4(new Vector4(red, green, blue, targetColor.Z));
+ packed.PackFromVector4(new Vector4(red, green, blue, sourcePixels[x, y].ToVector4().W));
targetPixels[x, y] = packed;
}
}
});
}
+
+ source.SetPixels(source.Width, source.Height, target);
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs
similarity index 78%
rename from src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs
index 428ef9484b..42e48cf424 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/Convolution2PassProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class Convolution2PassProcessor : ImageSamplingProcessor
+ public class Convolution2PassProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -39,29 +39,37 @@ namespace ImageSharp.Processors
public float[][] KernelY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
float[][] kernelX = this.KernelX;
float[][] kernelY = this.KernelY;
+ int width = source.Width;
+ int height = source.Height;
- ImageBase firstPass = new Image(source.Width, source.Height);
- this.ApplyConvolution(firstPass, source, sourceRectangle, startY, endY, kernelX);
- this.ApplyConvolution(target, firstPass, sourceRectangle, startY, endY, kernelY);
+ TColor[] target = new TColor[width * height];
+ TColor[] firstPass = new TColor[width * height];
+
+ this.ApplyConvolution(width, height, firstPass, source.Pixels, sourceRectangle, startY, endY, kernelX);
+ this.ApplyConvolution(width, height, target, firstPass, sourceRectangle, startY, endY, kernelY);
+
+ source.SetPixels(width, height, target);
}
///
/// Applies the process to the specified portion of the specified at the specified location
/// and with the specified size.
///
- /// Target image to apply the process to.
- /// The source image. Cannot be null.
+ /// The image width.
+ /// The image height.
+ /// The target pixels to apply the process to.
+ /// The source pixels. Cannot be null.
///
/// The structure that specifies the portion of the image object to draw.
///
/// The index of the row within the source image to start processing.
/// The index of the row within the source image to end processing.
/// The kernel operator.
- private void ApplyConvolution(ImageBase target, ImageBase source, Rectangle sourceRectangle, int startY, int endY, float[][] kernel)
+ private void ApplyConvolution(int width, int height, TColor[] target, TColor[] source, Rectangle sourceRectangle, int startY, int endY, float[][] kernel)
{
int kernelHeight = kernel.Length;
int kernelWidth = kernel[0].Length;
@@ -74,8 +82,8 @@ namespace ImageSharp.Processors
int maxY = sourceBottom - 1;
int maxX = endX - 1;
- using (PixelAccessor sourcePixels = source.Lock())
- using (PixelAccessor targetPixels = target.Lock())
+ using (PixelAccessor sourcePixels = source.Lock(width, height))
+ using (PixelAccessor targetPixels = target.Lock(width, height))
{
Parallel.For(
startY,
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs
similarity index 89%
rename from src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs
index d9252a22da..f7664904ec 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/ConvolutionProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class ConvolutionProcessor : ImageSamplingProcessor
+ public class ConvolutionProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -32,7 +32,7 @@ namespace ImageSharp.Processors
public virtual float[][] KernelXY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
float[][] kernelX = this.KernelXY;
int kernelLength = kernelX.GetLength(0);
@@ -45,8 +45,9 @@ namespace ImageSharp.Processors
int maxY = sourceBottom - 1;
int maxX = endX - 1;
+ TColor[] target = new TColor[source.Width * source.Height];
using (PixelAccessor sourcePixels = source.Lock())
- using (PixelAccessor targetPixels = target.Lock())
+ using (PixelAccessor targetPixels = target.Lock(source.Width, source.Height))
{
Parallel.For(
startY,
@@ -92,14 +93,15 @@ namespace ImageSharp.Processors
float green = gX;
float blue = bX;
- Vector4 targetColor = targetPixels[x, y].ToVector4();
TColor packed = default(TColor);
- packed.PackFromVector4(new Vector4(red, green, blue, targetColor.Z));
+ packed.PackFromVector4(new Vector4(red, green, blue, sourcePixels[x, y].ToVector4().W));
targetPixels[x, y] = packed;
}
}
});
}
+
+ source.SetPixels(source.Width, source.Height, target);
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
similarity index 75%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
index c247d9a99f..0acb69980c 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetector2DProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
+ public abstract class EdgeDetector2DProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -28,13 +28,13 @@ namespace ImageSharp.Processors
public bool Grayscale { get; set; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2DProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2DProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle);
}
///
- protected override void OnApply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle)
+ protected override void OnApply(ImageBase source, Rectangle sourceRectangle)
{
if (this.Grayscale)
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
similarity index 84%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
index 1ae9e48bb8..59cf632426 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetectorCompassProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
+ public abstract class EdgeDetectorCompassProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -62,7 +62,7 @@ namespace ImageSharp.Processors
public bool Grayscale { get; set; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
float[][][] kernels = { this.North, this.NorthWest, this.West, this.SouthWest, this.South, this.SouthEast, this.East, this.NorthEast };
@@ -76,7 +76,9 @@ namespace ImageSharp.Processors
int maxY = Math.Min(source.Height, endY);
// First run.
- new ConvolutionProcessor(kernels[0]).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ ImageBase target = new Image(source.Width, source.Height);
+ target.ClonePixels(source.Width, source.Height, source.Pixels);
+ new ConvolutionProcessor(kernels[0]).Apply(target, sourceRectangle);
if (kernels.Length == 1)
{
@@ -98,10 +100,14 @@ namespace ImageSharp.Processors
}
// Additional runs.
+ // ReSharper disable once ForCanBeConvertedToForeach
for (int i = 1; i < kernels.Length; i++)
{
+ // Create a clone for each pass and copy the offset pixels across.
ImageBase pass = new Image(source.Width, source.Height);
- new ConvolutionProcessor(kernels[i]).Apply(pass, source, sourceRectangle, targetRectangle, startY, endY);
+ pass.ClonePixels(source.Width, source.Height, source.Pixels);
+
+ new ConvolutionProcessor(kernels[i]).Apply(pass, sourceRectangle);
using (PixelAccessor passPixels = pass.Lock())
using (PixelAccessor targetPixels = target.Lock())
@@ -125,10 +131,12 @@ namespace ImageSharp.Processors
});
}
}
+
+ source.SetPixels(source.Width, source.Height, target.Pixels);
}
///
- protected override void OnApply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle)
+ protected override void OnApply(ImageBase source, Rectangle sourceRectangle)
{
if (this.Grayscale)
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
similarity index 74%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
index 734d181146..847f3a1c7f 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetectorProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
+ public abstract class EdgeDetectorProcessor : ImageFilteringProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -23,13 +23,13 @@ namespace ImageSharp.Processors
public abstract float[][] KernelXY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
- new ConvolutionProcessor(this.KernelXY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new ConvolutionProcessor(this.KernelXY).Apply(source, sourceRectangle);
}
///
- protected override void OnApply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle)
+ protected override void OnApply(ImageBase source, Rectangle sourceRectangle)
{
if (this.Grayscale)
{
@@ -37,4 +37,4 @@ namespace ImageSharp.Processors
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
similarity index 94%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
index ac1c5a6fa0..65abc525f3 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public interface IEdgeDetectorProcessor : IImageSamplingProcessor, IEdgeDetectorProcessor
+ public interface IEdgeDetectorProcessor : IImageFilteringProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/KirschProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/EdgeDetection/SobelProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs
similarity index 92%
rename from src/ImageSharp/Samplers/Processors/Convolution/GaussianBlurProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs
index 4025e2125b..8553e42648 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/GaussianBlurProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/GaussianBlurProcessor.cs
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class GaussianBlurProcessor : ImageSamplingProcessor
+ public class GaussianBlurProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -81,9 +81,9 @@ namespace ImageSharp.Processors
public float[][] KernelY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs
similarity index 94%
rename from src/ImageSharp/Samplers/Processors/Convolution/GaussianSharpenProcessor.cs
rename to src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs
index 2d2a343d36..48790a7334 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/GaussianSharpenProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Convolution/GaussianSharpenProcessor.cs
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class GaussianSharpenProcessor : ImageSamplingProcessor
+ public class GaussianSharpenProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -83,9 +83,9 @@ namespace ImageSharp.Processors
public float[][] KernelY { get; }
///
- public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle);
}
///
diff --git a/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs
index 715ab49d56..263c63790c 100644
--- a/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Transforms/EntropyCropProcessor.cs
@@ -37,9 +37,10 @@ namespace ImageSharp.Processors
protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
{
ImageBase temp = new Image(source.Width, source.Height);
+ temp.ClonePixels(source.Width, source.Height, source.Pixels);
// Detect the edges.
- new SobelProcessor().Apply(temp, source, sourceRectangle);
+ new SobelProcessor().Apply(temp, sourceRectangle);
// Apply threshold binarization filter.
new BinaryThresholdProcessor(this.Value).Apply(temp, sourceRectangle);
diff --git a/tests/ImageSharp.Tests/Processors/Samplers/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processors/Filters/DetectEdgesTest.cs
similarity index 94%
rename from tests/ImageSharp.Tests/Processors/Samplers/DetectEdgesTest.cs
rename to tests/ImageSharp.Tests/Processors/Filters/DetectEdgesTest.cs
index ce088eac4f..a650f85ddd 100644
--- a/tests/ImageSharp.Tests/Processors/Samplers/DetectEdgesTest.cs
+++ b/tests/ImageSharp.Tests/Processors/Filters/DetectEdgesTest.cs
@@ -23,7 +23,7 @@ namespace ImageSharp.Tests
EdgeDetection.RobertsCross,
EdgeDetection.Robinson,
EdgeDetection.Scharr,
- EdgeDetection.Sobel,
+ EdgeDetection.Sobel
};
[Theory]
@@ -40,7 +40,7 @@ namespace ImageSharp.Tests
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
{
image.DetectEdges(detector)
- .Save(output);
+ .Save(output);
}
}
}
@@ -59,7 +59,7 @@ namespace ImageSharp.Tests
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
{
image.DetectEdges(detector, new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2))
- .Save(output);
+ .Save(output);
}
}
}
diff --git a/tests/ImageSharp.Tests/Processors/Samplers/EntropyCropTest.cs b/tests/ImageSharp.Tests/Processors/Filters/EntropyCropTest.cs
similarity index 100%
rename from tests/ImageSharp.Tests/Processors/Samplers/EntropyCropTest.cs
rename to tests/ImageSharp.Tests/Processors/Filters/EntropyCropTest.cs
diff --git a/tests/ImageSharp.Tests/Processors/Samplers/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GaussianBlurTest.cs
similarity index 100%
rename from tests/ImageSharp.Tests/Processors/Samplers/GaussianBlurTest.cs
rename to tests/ImageSharp.Tests/Processors/Filters/GaussianBlurTest.cs
diff --git a/tests/ImageSharp.Tests/Processors/Samplers/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GaussianSharpenTest.cs
similarity index 100%
rename from tests/ImageSharp.Tests/Processors/Samplers/GaussianSharpenTest.cs
rename to tests/ImageSharp.Tests/Processors/Filters/GaussianSharpenTest.cs