diff --git a/Settings.StyleCop b/Settings.StyleCop
index aeee88627a..dbff3379a8 100644
--- a/Settings.StyleCop
+++ b/Settings.StyleCop
@@ -34,6 +34,8 @@
cmyk
Paeth
th
+ desensitivity
+ premultiplied
diff --git a/contributing.md b/contributing.md
index b4900b0446..9e0b71cf8e 100644
--- a/contributing.md
+++ b/contributing.md
@@ -1,10 +1,10 @@
-# How to contribute to ImageProcessor
+# How to contribute to ImageSHarp
#### **Did you find a bug?**
-- Please **ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/JimBobSquarePants/ImageProcessor/issues).
+- Please **ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/JimBobSquarePants/ImageSharp/issues).
-- If you're unable to find an open issue addressing the problem, please [open a new one](https://github.com/JimBobSquarePants/ImageProcessor/issues/new). Be sure to include a **title, the applicable version (Core or Framework), a clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. Please do not hijack existing issues.
+- If you're unable to find an open issue addressing the problem, please [open a new one](https://github.com/JimBobSquarePants/ImageSharp/issues/new). Be sure to include a **title, the applicable version, a clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. Please do not hijack existing issues.
#### **Did you write a patch that fixes a bug?**
@@ -16,19 +16,15 @@
#### **Do you intend to add a new feature or change an existing one?**
-* Suggest your change in the [ImageProcessor Gitter Chat Room](https://gitter.im/JimBobSquarePants/ImageProcessor) and start writing code.
+* Suggest your change in the [ImageSharp Gitter Chat Room](https://gitter.im/ImageSharp/General) and start writing code.
* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes.
#### **Do you have questions about the source code?**
-* Ask any question about how to use ImageProcessor in the [ImageProcessor Gitter Chat Room](https://gitter.im/JimBobSquarePants/ImageProcessor).
+* Ask any question about how to use ImageProcessor in the [ImageSharp Gitter Chat Room](https://gitter.im/ImageSharp/General).
-#### **Do you want to contribute to the ImageProcessor documentation?**
-
-* The documentation is also open source and is contained within the [gh-pages](https://github.com/JimBobSquarePants/ImageProcessor/tree/gh-pages). We are always looking for ways to improve our documentation!
-
-And please remember. ImageProcessor is the work of a very, very, small number of developers who struggle balancing time to contribute to the project with family time and work commitments. We encourage you to pitch in and help make our vision of simple accessible imageprocessing available to all. Open Source can only exist with your help.
+And please remember. ImageSharp is the work of a very, very, small number of developers who struggle balancing time to contribute to the project with family time and work commitments. We encourage you to pitch in and help make our vision of simple accessible imageprocessing available to all. Open Source can only exist with your help.
Thanks for reading!
diff --git a/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs b/src/ImageSharp/Colors/Vector4BlendTransforms.cs
similarity index 82%
rename from src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs
rename to src/ImageSharp/Colors/Vector4BlendTransforms.cs
index 4851baedf3..b1d6ebb8c9 100644
--- a/src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs
+++ b/src/ImageSharp/Colors/Vector4BlendTransforms.cs
@@ -17,7 +17,7 @@ namespace ImageSharp
///
/// The epsilon for comparing floating point numbers.
///
- private const float Epsilon = 0.001F;
+ private const float Epsilon = 0.0001F;
///
/// The blending formula simply selects the source vector.
@@ -186,7 +186,52 @@ namespace ImageSharp
}
///
- /// Multiplies or screens the color component, depending on the component value.
+ /// Linearly interpolates from one vector to another based on the given weighting.
+ /// The two vectors are premultiplied before operating.
+ ///
+ /// The backdrop vector.
+ /// The source vector.
+ ///
+ /// A value between 0 and 1 indicating the weight of the second source vector.
+ /// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
+ ///
+ ///
+ /// The
+ ///
+ public static Vector4 PremultipliedLerp(Vector4 backdrop, Vector4 source, float amount)
+ {
+ amount = amount.Clamp(0, 1);
+
+ // Santize on zero alpha
+ if (Math.Abs(backdrop.W) < Epsilon)
+ {
+ source.W *= amount;
+ return source;
+ }
+
+ if (Math.Abs(source.W) < Epsilon)
+ {
+ return backdrop;
+ }
+
+ // Premultiply the source vector.
+ // Oddly premultiplying the background vector creates dark outlines when pixels
+ // Have low alpha values.
+ source = new Vector4(source.X, source.Y, source.Z, 1) * (source.W * amount);
+
+ // This should be implementing the following formula
+ // https://en.wikipedia.org/wiki/Alpha_compositing
+ // Vout = Vs + Vb (1 - Vsa)
+ // Aout = Vsa + Vsb (1 - Vsa)
+ Vector3 inverseW = new Vector3(1 - source.W);
+ Vector3 xyzB = new Vector3(backdrop.X, backdrop.Y, backdrop.Z);
+ Vector3 xyzS = new Vector3(source.X, source.Y, source.Z);
+
+ return new Vector4(xyzS + (xyzB * inverseW), source.W + (backdrop.W * (1 - source.W)));
+ }
+
+ ///
+ /// Multiplies or screens the backdrop component, depending on the component value.
///
/// The backdrop component.
/// The source component.
diff --git a/src/ImageSharp/Filters/BinaryThreshold.cs b/src/ImageSharp/Filters/Binarization/BinaryThreshold.cs
similarity index 100%
rename from src/ImageSharp/Filters/BinaryThreshold.cs
rename to src/ImageSharp/Filters/Binarization/BinaryThreshold.cs
diff --git a/src/ImageSharp/Filters/BlackWhite.cs b/src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs
similarity index 100%
rename from src/ImageSharp/Filters/BlackWhite.cs
rename to src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs
diff --git a/src/ImageSharp/Filters/ColorBlindness.cs b/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs
similarity index 98%
rename from src/ImageSharp/Filters/ColorBlindness.cs
rename to src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs
index e1a14e0f0d..30f5fefd4f 100644
--- a/src/ImageSharp/Filters/ColorBlindness.cs
+++ b/src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs
@@ -42,7 +42,7 @@ namespace ImageSharp
where TColor : struct, IPackedPixel
where TPacked : struct
{
- IImageFilter processor;
+ IImageFilteringProcessor processor;
switch (colorBlindness)
{
diff --git a/src/ImageSharp/Filters/Grayscale.cs b/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs
similarity index 91%
rename from src/ImageSharp/Filters/Grayscale.cs
rename to src/ImageSharp/Filters/ColorMatrix/Grayscale.cs
index ce827e54c7..1a68e3e04a 100644
--- a/src/ImageSharp/Filters/Grayscale.cs
+++ b/src/ImageSharp/Filters/ColorMatrix/Grayscale.cs
@@ -42,8 +42,8 @@ namespace ImageSharp
where TColor : struct, IPackedPixel
where TPacked : struct
{
- IImageFilter processor = mode == GrayscaleMode.Bt709
- ? (IImageFilter)new GrayscaleBt709Processor()
+ IImageFilteringProcessor processor = mode == GrayscaleMode.Bt709
+ ? (IImageFilteringProcessor)new GrayscaleBt709Processor()
: new GrayscaleBt601Processor();
return source.Process(rectangle, processor);
diff --git a/src/ImageSharp/Filters/Hue.cs b/src/ImageSharp/Filters/ColorMatrix/Hue.cs
similarity index 100%
rename from src/ImageSharp/Filters/Hue.cs
rename to src/ImageSharp/Filters/ColorMatrix/Hue.cs
diff --git a/src/ImageSharp/Filters/Kodachrome.cs b/src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs
similarity index 100%
rename from src/ImageSharp/Filters/Kodachrome.cs
rename to src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs
diff --git a/src/ImageSharp/Filters/Lomograph.cs b/src/ImageSharp/Filters/ColorMatrix/Lomograph.cs
similarity index 100%
rename from src/ImageSharp/Filters/Lomograph.cs
rename to src/ImageSharp/Filters/ColorMatrix/Lomograph.cs
diff --git a/src/ImageSharp/Filters/Options/ColorBlindness.cs b/src/ImageSharp/Filters/ColorMatrix/Options/ColorBlindness.cs
similarity index 100%
rename from src/ImageSharp/Filters/Options/ColorBlindness.cs
rename to src/ImageSharp/Filters/ColorMatrix/Options/ColorBlindness.cs
diff --git a/src/ImageSharp/Filters/Options/GrayscaleMode.cs b/src/ImageSharp/Filters/ColorMatrix/Options/GrayscaleMode.cs
similarity index 100%
rename from src/ImageSharp/Filters/Options/GrayscaleMode.cs
rename to src/ImageSharp/Filters/ColorMatrix/Options/GrayscaleMode.cs
diff --git a/src/ImageSharp/Filters/Polaroid.cs b/src/ImageSharp/Filters/ColorMatrix/Polaroid.cs
similarity index 100%
rename from src/ImageSharp/Filters/Polaroid.cs
rename to src/ImageSharp/Filters/ColorMatrix/Polaroid.cs
diff --git a/src/ImageSharp/Filters/Saturation.cs b/src/ImageSharp/Filters/ColorMatrix/Saturation.cs
similarity index 100%
rename from src/ImageSharp/Filters/Saturation.cs
rename to src/ImageSharp/Filters/ColorMatrix/Saturation.cs
diff --git a/src/ImageSharp/Filters/Sepia.cs b/src/ImageSharp/Filters/ColorMatrix/Sepia.cs
similarity index 100%
rename from src/ImageSharp/Filters/Sepia.cs
rename to src/ImageSharp/Filters/ColorMatrix/Sepia.cs
diff --git a/src/ImageSharp/Filters/Alpha.cs b/src/ImageSharp/Filters/Effects/Alpha.cs
similarity index 100%
rename from src/ImageSharp/Filters/Alpha.cs
rename to src/ImageSharp/Filters/Effects/Alpha.cs
diff --git a/src/ImageSharp/Filters/BackgroundColor.cs b/src/ImageSharp/Filters/Effects/BackgroundColor.cs
similarity index 100%
rename from src/ImageSharp/Filters/BackgroundColor.cs
rename to src/ImageSharp/Filters/Effects/BackgroundColor.cs
diff --git a/src/ImageSharp/Filters/Brightness.cs b/src/ImageSharp/Filters/Effects/Brightness.cs
similarity index 100%
rename from src/ImageSharp/Filters/Brightness.cs
rename to src/ImageSharp/Filters/Effects/Brightness.cs
diff --git a/src/ImageSharp/Filters/Contrast.cs b/src/ImageSharp/Filters/Effects/Contrast.cs
similarity index 100%
rename from src/ImageSharp/Filters/Contrast.cs
rename to src/ImageSharp/Filters/Effects/Contrast.cs
diff --git a/src/ImageSharp/Filters/Invert.cs b/src/ImageSharp/Filters/Effects/Invert.cs
similarity index 100%
rename from src/ImageSharp/Filters/Invert.cs
rename to src/ImageSharp/Filters/Effects/Invert.cs
diff --git a/src/ImageSharp/Filters/Blend.cs b/src/ImageSharp/Filters/Overlays/Blend.cs
similarity index 72%
rename from src/ImageSharp/Filters/Blend.cs
rename to src/ImageSharp/Filters/Overlays/Blend.cs
index 448fb7aa0d..4a1fc534d8 100644
--- a/src/ImageSharp/Filters/Blend.cs
+++ b/src/ImageSharp/Filters/Overlays/Blend.cs
@@ -21,11 +21,11 @@ namespace ImageSharp
/// The image to blend with the currently processing image.
/// The opacity of the image image to blend. Must be between 0 and 100.
/// The .
- public static Image Blend(this Image source, ImageBase image, int percent = 50)
+ public static Image Blend(this Image source, Image image, int percent = 50)
where TColor : struct, IPackedPixel
where TPacked : struct
{
- return Blend(source, image, percent, source.Bounds);
+ return Blend(source, image, percent, default(Size), default(Point));
}
///
@@ -36,15 +36,24 @@ namespace ImageSharp
/// The pixel format.
/// The packed format. uint, long, float.
/// The opacity of the image image to blend. Must be between 0 and 100.
- ///
- /// The structure that specifies the portion of the image object to alter.
- ///
+ /// The size to draw the blended image.
+ /// The location to draw the blended image.
/// The .
- public static Image Blend(this Image source, ImageBase image, int percent, Rectangle rectangle)
+ public static Image Blend(this Image source, Image image, int percent, Size size, Point location)
where TColor : struct, IPackedPixel
where TPacked : struct
{
- return source.Process(rectangle, new BlendProcessor(image, percent));
+ if (size == default(Size))
+ {
+ size = new Size(image.Width, image.Height);
+ }
+
+ if (location == default(Point))
+ {
+ location = Point.Empty;
+ }
+
+ return source.Process(source.Bounds, new BlendProcessor(image, size, location, percent));
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Filters/Glow.cs b/src/ImageSharp/Filters/Overlays/Glow.cs
similarity index 100%
rename from src/ImageSharp/Filters/Glow.cs
rename to src/ImageSharp/Filters/Overlays/Glow.cs
diff --git a/src/ImageSharp/Filters/Vignette.cs b/src/ImageSharp/Filters/Overlays/Vignette.cs
similarity index 100%
rename from src/ImageSharp/Filters/Vignette.cs
rename to src/ImageSharp/Filters/Overlays/Vignette.cs
diff --git a/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs
index 09c6a96f3d..407dd8d053 100644
--- a/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs
@@ -9,12 +9,12 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to perform binary threshold filtering against an
+ /// An to perform binary threshold filtering against an
/// . The image will be converted to grayscale before thresholding occurs.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class BinaryThresholdProcessor : ImageFilter
+ public class BinaryThresholdProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/BlendProcessor.cs b/src/ImageSharp/Filters/Processors/BlendProcessor.cs
deleted file mode 100644
index 4f326361fe..0000000000
--- a/src/ImageSharp/Filters/Processors/BlendProcessor.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Processors
-{
- using System;
- using System.Numerics;
- using System.Threading.Tasks;
-
- ///
- /// Combines two images together by blending the pixels.
- ///
- /// The pixel format.
- /// The packed format. uint, long, float.
- public class BlendProcessor : ImageFilter
- where TColor : struct, IPackedPixel
- where TPacked : struct
- {
- ///
- /// The image to blend.
- ///
- private readonly ImageBase blend;
-
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The image to blend with the currently processing image.
- /// Disposal of this image is the responsibility of the developer.
- ///
- /// The opacity of the image to blend. Between 0 and 100.
- public BlendProcessor(ImageBase image, int alpha = 100)
- {
- Guard.MustBeBetweenOrEqualTo(alpha, 0, 100, nameof(alpha));
- this.blend = image;
- this.Value = alpha;
- }
-
- ///
- /// Gets the alpha percentage value.
- ///
- public int Value { get; }
-
- ///
- protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
- {
- int startX = sourceRectangle.X;
- int endX = sourceRectangle.Right;
- Rectangle bounds = this.blend.Bounds;
-
- // Align start/end positions.
- int minX = Math.Max(0, startX);
- int maxX = Math.Min(source.Width, endX);
- int minY = Math.Max(0, startY);
- int maxY = Math.Min(source.Height, endY);
-
- // Reset offset if necessary.
- if (minX > 0)
- {
- startX = 0;
- }
-
- if (minY > 0)
- {
- startY = 0;
- }
-
- float alpha = this.Value / 100F;
-
- using (PixelAccessor toBlendPixels = this.blend.Lock())
- using (PixelAccessor sourcePixels = source.Lock())
- {
- Parallel.For(
- minY,
- maxY,
- this.ParallelOptions,
- y =>
- {
- int offsetY = y - startY;
- for (int x = minX; x < maxX; x++)
- {
- int offsetX = x - startX;
- Vector4 color = sourcePixels[offsetX, offsetY].ToVector4();
-
- if (bounds.Contains(offsetX, offsetY))
- {
- Vector4 blendedColor = toBlendPixels[offsetX, offsetY].ToVector4();
-
- if (blendedColor.W > 0)
- {
- // Lerping colors is dependent on the alpha of the blended color
- color = Vector4.Lerp(color, blendedColor, alpha > 0 ? alpha : blendedColor.W);
- }
- }
-
- TColor packed = default(TColor);
- packed.PackFromVector4(color);
- sourcePixels[offsetX, offsetY] = packed;
- }
- });
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs
index be6f277e04..32bc227b18 100644
--- a/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs
+++ b/src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class ColorMatrixFilter : ImageFilter, IColorMatrixFilter
+ public abstract class ColorMatrixFilter : ImageFilteringProcessor, IColorMatrixFilter
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs
index ede66fd715..82cc2166d2 100644
--- a/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs
+++ b/src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public interface IColorMatrixFilter : IImageFilter
+ public interface IColorMatrixFilter : IImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs
index 60f7c78157..e73a39e325 100644
--- a/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs
@@ -31,8 +31,8 @@ namespace ImageSharp.Processors
// Stop at -1 to prevent inversion.
saturationFactor++;
- // The matrix is set up to "shear" the colour space using the following set of values.
- // Note that each colour component has an effective luminance which contributes to the
+ // The matrix is set up to "shear" the color space using the following set of values.
+ // Note that each color component has an effective luminance which contributes to the
// overall brightness of the pixel.
// See http://graficaobscura.com/matrix/index.html
float saturationComplement = 1.0f - saturationFactor;
diff --git a/src/ImageSharp/Filters/Processors/AlphaProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs
similarity index 92%
rename from src/ImageSharp/Filters/Processors/AlphaProcessor.cs
rename to src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs
index 08c05acdd2..ea4f7e44a2 100644
--- a/src/ImageSharp/Filters/Processors/AlphaProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to change the alpha component of an .
+ /// An to change the alpha component of an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class AlphaProcessor : ImageFilter
+ public class AlphaProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/BackgroundColorProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs
similarity index 95%
rename from src/ImageSharp/Filters/Processors/BackgroundColorProcessor.cs
rename to src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs
index 37dd580fa1..cc81179f80 100644
--- a/src/ImageSharp/Filters/Processors/BackgroundColorProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class BackgroundColorProcessor : ImageFilter
+ public class BackgroundColorProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -79,7 +79,7 @@ namespace ImageSharp.Processors
if (a < 1 && a > 0)
{
- color = Vector4.Lerp(color, backgroundColor, .5F);
+ color = Vector4BlendTransforms.PremultipliedLerp(backgroundColor, color, .5F);
}
if (Math.Abs(a) < Epsilon)
diff --git a/src/ImageSharp/Filters/Processors/BrightnessProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs
similarity index 95%
rename from src/ImageSharp/Filters/Processors/BrightnessProcessor.cs
rename to src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs
index b74759b6b2..84cf0c8fbe 100644
--- a/src/ImageSharp/Filters/Processors/BrightnessProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to change the brightness of an .
+ /// An to change the brightness of an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class BrightnessProcessor : ImageFilter
+ public class BrightnessProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/ContrastProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs
similarity index 95%
rename from src/ImageSharp/Filters/Processors/ContrastProcessor.cs
rename to src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs
index fbcaaa1cdc..6f63264559 100644
--- a/src/ImageSharp/Filters/Processors/ContrastProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to change the contrast of an .
+ /// An to change the contrast of an .
///
/// The pixel format.
/// The packed format. long, float.
- public class ContrastProcessor : ImageFilter
+ public class ContrastProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/InvertProcessor.cs b/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs
similarity index 91%
rename from src/ImageSharp/Filters/Processors/InvertProcessor.cs
rename to src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs
index d010eaf364..94f6716da8 100644
--- a/src/ImageSharp/Filters/Processors/InvertProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to invert the colors of an .
+ /// An to invert the colors of an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class InvertProcessor : ImageFilter
+ public class InvertProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/IImageFilter.cs b/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs
similarity index 90%
rename from src/ImageSharp/Filters/Processors/IImageFilter.cs
rename to src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs
index fc0a7625b0..22707168fa 100644
--- a/src/ImageSharp/Filters/Processors/IImageFilter.cs
+++ b/src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public interface IImageFilter : IImageProcessor
+ public interface IImageFilteringProcessor : IImageProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/ImageFilter.cs b/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs
similarity index 93%
rename from src/ImageSharp/Filters/Processors/ImageFilter.cs
rename to src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs
index 34bfdb1fb1..23a0a3654f 100644
--- a/src/ImageSharp/Filters/Processors/ImageFilter.cs
+++ b/src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class ImageFilter : ImageProcessor, IImageFilter
+ public abstract class ImageFilteringProcessor : ImageProcessor, IImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Filters/Processors/Overlays/BlendProcessor.cs b/src/ImageSharp/Filters/Processors/Overlays/BlendProcessor.cs
new file mode 100644
index 0000000000..e764879763
--- /dev/null
+++ b/src/ImageSharp/Filters/Processors/Overlays/BlendProcessor.cs
@@ -0,0 +1,99 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp.Processors
+{
+ using System;
+ using System.Numerics;
+ using System.Threading.Tasks;
+
+ ///
+ /// Combines two images together by blending the pixels.
+ ///
+ /// The pixel format.
+ /// The packed format. uint, long, float.
+ public class BlendProcessor : ImageFilteringProcessor
+ where TColor : struct, IPackedPixel
+ where TPacked : struct
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The image to blend with the currently processing image.
+ /// The size to draw the blended image.
+ /// The location to draw the blended image.
+ /// The opacity of the image to blend. Between 0 and 100.
+ public BlendProcessor(Image image, Size size, Point location, int alpha = 100)
+ {
+ Guard.MustBeBetweenOrEqualTo(alpha, 0, 100, nameof(alpha));
+ this.Image = image;
+ this.Size = size;
+ this.Alpha = alpha;
+ this.Location = location;
+ }
+
+ ///
+ /// Gets the image to blend.
+ ///
+ public Image Image { get; private set; }
+
+ ///
+ /// Gets the alpha percentage value.
+ ///
+ public int Alpha { get; }
+
+ ///
+ /// Gets the size to draw the blended image.
+ ///
+ public Size Size { get; }
+
+ ///
+ /// Gets the location to draw the blended image.
+ ///
+ public Point Location { get; }
+
+ ///
+ protected override void Apply(ImageBase source, Rectangle sourceRectangle, int startY, int endY)
+ {
+ if (this.Image.Bounds.Size != this.Size)
+ {
+ this.Image = this.Image.Resize(this.Size.Width, this.Size.Height);
+ }
+
+ // Align start/end positions.
+ Rectangle bounds = this.Image.Bounds;
+ int minX = Math.Max(this.Location.X, sourceRectangle.X);
+ int maxX = Math.Min(this.Location.X + bounds.Width, sourceRectangle.Width);
+ int minY = Math.Max(this.Location.Y, startY);
+ int maxY = Math.Min(this.Location.Y + bounds.Height, endY);
+
+ float alpha = this.Alpha / 100F;
+
+ using (PixelAccessor toBlendPixels = this.Image.Lock())
+ using (PixelAccessor sourcePixels = source.Lock())
+ {
+ Parallel.For(
+ minY,
+ maxY,
+ this.ParallelOptions,
+ y =>
+ {
+ for (int x = minX; x < maxX; x++)
+ {
+ Vector4 backgroundVector = sourcePixels[x, y].ToVector4();
+ Vector4 sourceVector = toBlendPixels[x - minX, y - minY].ToVector4();
+
+ // Lerping colors is dependent on the alpha of the blended color
+ backgroundVector = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, alpha);
+
+ TColor packed = default(TColor);
+ packed.PackFromVector4(backgroundVector);
+ sourcePixels[x, y] = packed;
+ }
+ });
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Filters/Processors/GlowProcessor.cs b/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs
similarity index 75%
rename from src/ImageSharp/Filters/Processors/GlowProcessor.cs
rename to src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs
index d671d1d6f0..6b1fe40c2c 100644
--- a/src/ImageSharp/Filters/Processors/GlowProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs
@@ -10,16 +10,16 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An that applies a radial glow effect an .
+ /// An that applies a radial glow effect an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class GlowProcessor : ImageFilter
+ public class GlowProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public GlowProcessor()
{
@@ -77,15 +77,11 @@ namespace ImageSharp.Processors
for (int x = minX; x < maxX; x++)
{
int offsetX = x - startX;
- if (ellipse.Contains(offsetX, offsetY))
- {
- // TODO: Premultiply?
- float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY));
- Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4();
- TColor packed = default(TColor);
- packed.PackFromVector4(Vector4.Lerp(glowColor.ToVector4(), sourceColor, distance / maxDistance));
- sourcePixels[offsetX, offsetY] = packed;
- }
+ float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY));
+ Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4();
+ TColor packed = default(TColor);
+ packed.PackFromVector4(Vector4BlendTransforms.PremultipliedLerp(sourceColor, glowColor.ToVector4(), 1 - (.95F * (distance / maxDistance))));
+ sourcePixels[offsetX, offsetY] = packed;
}
});
}
diff --git a/src/ImageSharp/Filters/Processors/VignetteProcessor.cs b/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs
similarity index 90%
rename from src/ImageSharp/Filters/Processors/VignetteProcessor.cs
rename to src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs
index b60e496476..cdc8019140 100644
--- a/src/ImageSharp/Filters/Processors/VignetteProcessor.cs
+++ b/src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An that applies a radial vignette effect to an .
+ /// An that applies a radial vignette effect to an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class VignetteProcessor : ImageFilter
+ public class VignetteProcessor : ImageFilteringProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -86,7 +86,7 @@ namespace ImageSharp.Processors
float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY));
Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4();
TColor packed = default(TColor);
- packed.PackFromVector4(Vector4.Lerp(vignetteColor.ToVector4(), sourceColor, 1 - (.9F * (distance / maxDistance))));
+ packed.PackFromVector4(Vector4BlendTransforms.PremultipliedLerp(sourceColor, vignetteColor.ToVector4(), .9F * (distance / maxDistance)));
sourcePixels[offsetX, offsetY] = packed;
}
});
diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs
index e4b9ff3fd1..7ebaf8f158 100644
--- a/src/ImageSharp/Image/ImageProcessingExtensions.cs
+++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs
@@ -22,7 +22,7 @@ namespace ImageSharp
/// The image this method extends.
/// The processor to apply to the image.
/// The .
- internal static Image Process(this Image source, IImageFilter processor)
+ internal static Image Process(this Image source, IImageFilteringProcessor processor)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -41,7 +41,7 @@ namespace ImageSharp
///
/// The processors to apply to the image.
/// The .
- internal static Image Process(this Image source, Rectangle sourceRectangle, IImageFilter processor)
+ internal static Image Process(this Image source, Rectangle sourceRectangle, IImageFilteringProcessor processor)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -57,7 +57,7 @@ namespace ImageSharp
/// The image this method extends.
/// The processor to apply to the image.
/// The .
- internal static Image Process(this Image source, IImageSampler processor)
+ internal static Image Process(this Image source, IImageSamplingProcessor processor)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -76,7 +76,7 @@ namespace ImageSharp
///
/// The processors to apply to the image.
/// The .
- internal static Image Process(this Image source, Rectangle sourceRectangle, IImageSampler processor)
+ internal static Image Process(this Image source, Rectangle sourceRectangle, IImageSamplingProcessor processor)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -96,7 +96,7 @@ namespace ImageSharp
/// The target image height.
/// The processor to apply to the image.
/// The .
- internal static Image Process(this Image source, int width, int height, IImageSampler sampler)
+ internal static Image Process(this Image source, int width, int height, IImageSamplingProcessor sampler)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -123,7 +123,7 @@ namespace ImageSharp
///
/// The processor to apply to the image.
/// The .
- internal static Image Process(this Image source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSampler sampler)
+ internal static Image Process(this Image source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSamplingProcessor sampler)
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Numerics/Rectangle.cs b/src/ImageSharp/Numerics/Rectangle.cs
index be457fc5a3..3f6267a468 100644
--- a/src/ImageSharp/Numerics/Rectangle.cs
+++ b/src/ImageSharp/Numerics/Rectangle.cs
@@ -127,6 +127,11 @@ namespace ImageSharp
}
}
+ ///
+ /// Gets the size of this .
+ ///
+ public Size Size => new Size(this.Width, this.Height);
+
///
/// Gets a value indicating whether this is empty.
///
diff --git a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs
index 5e06a721ea..a28c3d32e3 100644
--- a/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs
+++ b/src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs
@@ -9,7 +9,7 @@ namespace ImageSharp.Quantizers
using System.Collections.Generic;
///
- /// Encapsulates methods to calculate the colour palette if an image using an Octree pattern.
+ /// Encapsulates methods to calculate the color palette if an image using an Octree pattern.
///
///
/// The pixel format.
diff --git a/src/ImageSharp/Samplers/BoxBlur.cs b/src/ImageSharp/Samplers/Convolution/BoxBlur.cs
similarity index 100%
rename from src/ImageSharp/Samplers/BoxBlur.cs
rename to src/ImageSharp/Samplers/Convolution/BoxBlur.cs
diff --git a/src/ImageSharp/Samplers/DetectEdges.cs b/src/ImageSharp/Samplers/Convolution/DetectEdges.cs
similarity index 95%
rename from src/ImageSharp/Samplers/DetectEdges.cs
rename to src/ImageSharp/Samplers/Convolution/DetectEdges.cs
index c28bb3c81d..649e0cf649 100644
--- a/src/ImageSharp/Samplers/DetectEdges.cs
+++ b/src/ImageSharp/Samplers/Convolution/DetectEdges.cs
@@ -28,7 +28,7 @@ namespace ImageSharp
}
///
- /// Detects any edges within the image. Uses the filter
+ /// Detects any edges within the image. Uses the filter
/// operating in Grayscale mode.
///
/// The pixel format.
@@ -77,12 +77,12 @@ namespace ImageSharp
where TColor : struct, IPackedPixel
where TPacked : struct
{
- IEdgeDetectorFilter processor;
+ IEdgeDetectorProcessor processor;
switch (filter)
{
case EdgeDetection.Kayyali:
- processor = new KayyaliProcessor { Grayscale = grayscale };
+ processor = new KayyaliSampler { Grayscale = grayscale };
break;
case EdgeDetection.Kirsch:
@@ -133,7 +133,7 @@ namespace ImageSharp
/// The image this method extends.
/// The filter for detecting edges.
/// The .
- public static Image DetectEdges(this Image source, IEdgeDetectorFilter filter)
+ public static Image DetectEdges(this Image source, IEdgeDetectorProcessor filter)
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -151,7 +151,7 @@ namespace ImageSharp
///
/// The filter for detecting edges.
/// The .
- public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorFilter filter)
+ public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorProcessor filter)
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/GuassianBlur.cs b/src/ImageSharp/Samplers/Convolution/GuassianBlur.cs
similarity index 100%
rename from src/ImageSharp/Samplers/GuassianBlur.cs
rename to src/ImageSharp/Samplers/Convolution/GuassianBlur.cs
diff --git a/src/ImageSharp/Samplers/GuassianSharpen.cs b/src/ImageSharp/Samplers/Convolution/GuassianSharpen.cs
similarity index 100%
rename from src/ImageSharp/Samplers/GuassianSharpen.cs
rename to src/ImageSharp/Samplers/Convolution/GuassianSharpen.cs
diff --git a/src/ImageSharp/Filters/Options/EdgeDetection.cs b/src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs
similarity index 100%
rename from src/ImageSharp/Filters/Options/EdgeDetection.cs
rename to src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs
diff --git a/src/ImageSharp/Samplers/OilPainting.cs b/src/ImageSharp/Samplers/Effects/OilPainting.cs
similarity index 84%
rename from src/ImageSharp/Samplers/OilPainting.cs
rename to src/ImageSharp/Samplers/Effects/OilPainting.cs
index a938b2325f..338921d7d8 100644
--- a/src/ImageSharp/Samplers/OilPainting.cs
+++ b/src/ImageSharp/Samplers/Effects/OilPainting.cs
@@ -20,8 +20,8 @@ namespace ImageSharp
/// The pixel format.
/// The packed format. uint, long, float.
/// The image this method extends.
- /// The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.
- /// The number of neighbouring pixels used in calculating each individual pixel value.
+ /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.
+ /// The number of neighboring pixels used in calculating each individual pixel value.
/// The .
public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15)
where TColor : struct, IPackedPixel
@@ -36,8 +36,8 @@ namespace ImageSharp
/// The pixel format.
/// The packed format. uint, long, float.
/// The image this method extends.
- /// The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.
- /// The number of neighbouring pixels used in calculating each individual pixel value.
+ /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.
+ /// The number of neighboring pixels used in calculating each individual pixel value.
///
/// The structure that specifies the portion of the image object to alter.
///
diff --git a/src/ImageSharp/Samplers/Pixelate.cs b/src/ImageSharp/Samplers/Effects/Pixelate.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Pixelate.cs
rename to src/ImageSharp/Samplers/Effects/Pixelate.cs
index e7bd84c317..627ad80bb8 100644
--- a/src/ImageSharp/Samplers/Pixelate.cs
+++ b/src/ImageSharp/Samplers/Effects/Pixelate.cs
@@ -49,7 +49,7 @@ namespace ImageSharp
throw new ArgumentOutOfRangeException(nameof(size));
}
- return source.Process(rectangle, new PixelateProcessor(size));
+ return source.Process(rectangle, new PixelateProcesso(size));
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
index 7b87a3d1b8..a8ff27aafa 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
@@ -6,11 +6,11 @@
namespace ImageSharp.Processors
{
///
- /// Applies a Box blur filter to the image.
+ /// Applies a Box blur sampler to the image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class BoxBlurProcessor : ImageSampler
+ public class BoxBlurProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -20,7 +20,7 @@ namespace ImageSharp.Processors
private readonly int kernelSize;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// The 'radius' value representing the size of the area to sample.
@@ -45,7 +45,7 @@ namespace ImageSharp.Processors
///
public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassFilter(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
similarity index 92%
rename from src/ImageSharp/Samplers/Processors/Convolution/Convolution2DFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
index 1b77e41eb6..61b86c5d1a 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,20 +10,20 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// Defines a filter that uses two one-dimensional matrices to perform convolution against an image.
+ /// Defines a sampler that uses two one-dimensional matrices to perform convolution against an image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class Convolution2DFilter : ImageSampler
+ public class Convolution2DProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The horizontal gradient operator.
/// The vertical gradient operator.
- public Convolution2DFilter(float[][] kernelX, float[][] kernelY)
+ public Convolution2DProcessor(float[][] kernelX, float[][] kernelY)
{
this.KernelX = kernelX;
this.KernelY = kernelY;
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
similarity index 91%
rename from src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
index 4cab6f0b2a..428ef9484b 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -9,20 +9,20 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// Defines a filter that uses two one-dimensional matrices to perform two-pass convolution against an image.
+ /// Defines a sampler that uses two one-dimensional matrices to perform two-pass convolution against an image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class Convolution2PassFilter : ImageSampler
+ public class Convolution2PassProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The horizontal gradient operator.
/// The vertical gradient operator.
- public Convolution2PassFilter(float[][] kernelX, float[][] kernelY)
+ public Convolution2PassProcessor(float[][] kernelX, float[][] kernelY)
{
this.KernelX = kernelX;
this.KernelY = kernelY;
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
similarity index 91%
rename from src/ImageSharp/Samplers/Processors/Convolution/ConvolutionFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
index c94bee764c..d9252a22da 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -9,19 +9,19 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// Defines a filter that uses a 2 dimensional matrix to perform convolution against an image.
+ /// Defines a sampler that uses a 2 dimensional matrix to perform convolution against an image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class ConvolutionFilter : ImageSampler
+ public class ConvolutionProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The 2d gradient operator.
- public ConvolutionFilter(float[][] kernelXY)
+ public ConvolutionProcessor(float[][] kernelXY)
{
this.KernelXY = kernelXY;
}
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
similarity index 72%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
index a689415f6a..c247d9a99f 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -6,12 +6,11 @@
namespace ImageSharp.Processors
{
///
- /// Defines a filter that detects edges within an image using two
- /// one-dimensional matrices.
+ /// Defines a sampler that detects edges within an image using two one-dimensional matrices.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetector2DFilter : ImageSampler, IEdgeDetectorFilter
+ public abstract class EdgeDetector2DProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -31,8 +30,7 @@ namespace ImageSharp.Processors
///
public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
- // TODO: Figure out a way to pass event handlers to child classes.
- new Convolution2DFilter(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2DProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
similarity index 87%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
index 6d50531117..1ae9e48bb8 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// Defines a filter that detects edges within an image using a eight two dimensional matrices.
+ /// Defines a sampler that detects edges within an image using a eight two dimensional matrices.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetectorCompassFilter : ImageSampler, IEdgeDetectorFilter
+ public abstract class EdgeDetectorCompassProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -76,7 +76,7 @@ namespace ImageSharp.Processors
int maxY = Math.Min(source.Height, endY);
// First run.
- new ConvolutionFilter(kernels[0]).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new ConvolutionProcessor(kernels[0]).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
if (kernels.Length == 1)
{
@@ -101,7 +101,7 @@ namespace ImageSharp.Processors
for (int i = 1; i < kernels.Length; i++)
{
ImageBase pass = new Image(source.Width, source.Height);
- new ConvolutionFilter(kernels[i]).Apply(pass, source, sourceRectangle, targetRectangle, startY, endY);
+ new ConvolutionProcessor(kernels[i]).Apply(pass, source, sourceRectangle, targetRectangle, startY, endY);
using (PixelAccessor passPixels = pass.Lock())
using (PixelAccessor targetPixels = target.Lock())
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
similarity index 72%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
index a565dbfc17..734d181146 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -6,11 +6,11 @@
namespace ImageSharp.Processors
{
///
- /// Defines a filter that detects edges within an image using a single two dimensional matrix.
+ /// Defines a sampler that detects edges within an image using a single two dimensional matrix.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class EdgeDetectorFilter : ImageSampler, IEdgeDetectorFilter
+ public abstract class EdgeDetectorProcessor : ImageSamplingProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -25,7 +25,7 @@ namespace ImageSharp.Processors
///
public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
- new ConvolutionFilter(this.KernelXY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new ConvolutionProcessor(this.KernelXY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
similarity index 77%
rename from src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs
rename to src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
index 700201ea4d..ac1c5a6fa0 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public interface IEdgeDetectorFilter : IImageSampler, IEdgeDetectorFilter
+ public interface IEdgeDetectorProcessor : IImageSamplingProcessor, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -19,7 +19,7 @@ namespace ImageSharp.Processors
///
/// Provides properties and methods allowing the detection of edges within an image.
///
- public interface IEdgeDetectorFilter
+ public interface IEdgeDetectorProcessor
{
///
/// Gets or sets a value indicating whether to convert the image to grayscale before performing edge detection.
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
index cbe45f8b62..5fbf54b308 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class KayyaliProcessor : EdgeDetector2DFilter
+ public class KayyaliSampler : EdgeDetector2DProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
index b8ead4192e..77fbfdb6e5 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class KirschProcessor : EdgeDetectorCompassFilter
+ public class KirschProcessor : EdgeDetectorCompassProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
index 9fbf716749..73d5c540bc 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class Laplacian3X3Processor : EdgeDetectorFilter
+ public class Laplacian3X3Processor : EdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
index fdff0ec3af..70ddfb0875 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class Laplacian5X5Processor : EdgeDetectorFilter
+ public class Laplacian5X5Processor : EdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
index 75e0efbd27..78498f69a6 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class LaplacianOfGaussianProcessor : EdgeDetectorFilter
+ public class LaplacianOfGaussianProcessor : EdgeDetectorProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
index 70b763e63f..8cf42c293f 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class PrewittProcessor : EdgeDetector2DFilter
+ public class PrewittProcessor : EdgeDetector2DProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
index 8eb3aac3bf..2789010e29 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class RobertsCrossProcessor : EdgeDetector2DFilter
+ public class RobertsCrossProcessor : EdgeDetector2DProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
index 189215f08f..b888e400d3 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class RobinsonProcessor : EdgeDetectorCompassFilter
+ public class RobinsonProcessor : EdgeDetectorCompassProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
index 22e7d80847..e49b9b528c 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class ScharrProcessor : EdgeDetector2DFilter
+ public class ScharrProcessor : EdgeDetector2DProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs
index 7d9521c691..274cd84701 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// The pixel format.
/// The packed format. uint, long, float.
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
- public class SobelProcessor : EdgeDetector2DFilter
+ public class SobelProcessor : EdgeDetector2DProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs
index 856239385a..e6af445b4b 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs
@@ -8,11 +8,11 @@ namespace ImageSharp.Processors
using System;
///
- /// Applies a Gaussian blur filter to the image.
+ /// Applies a Gaussian blur sampler to the image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class GuassianBlurProcessor : ImageSampler
+ public class GuassianBlurProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -83,7 +83,7 @@ namespace ImageSharp.Processors
///
public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassFilter(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs b/src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs
index 3c86fcfee6..56cf94ea3f 100644
--- a/src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs
@@ -8,11 +8,11 @@ namespace ImageSharp.Processors
using System;
///
- /// Applies a Gaussian sharpening filter to the image.
+ /// Applies a Gaussian sharpening sampler to the image.
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class GuassianSharpenProcessor : ImageSampler
+ public class GuassianSharpenProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -85,7 +85,7 @@ namespace ImageSharp.Processors
///
public override void Apply(ImageBase target, ImageBase source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
- new Convolution2PassFilter(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
+ new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
///
diff --git a/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs b/src/ImageSharp/Samplers/Processors/Effects/OilPaintingProcessor.cs
similarity index 91%
rename from src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Effects/OilPaintingProcessor.cs
index ee0d4121aa..77b7a158fe 100644
--- a/src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Effects/OilPaintingProcessor.cs
@@ -10,20 +10,24 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to apply an oil painting effect to an .
+ /// An to apply an oil painting effect to an .
///
/// Adapted from by Dewald Esterhuizen.
/// The pixel format.
/// The packed format. uint, long, float.
- public class OilPaintingProcessor : ImageSampler
+ public class OilPaintingProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- /// The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.
- /// The number of neighbouring pixels used in calculating each individual pixel value.
+ ///
+ /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.
+ ///
+ ///
+ /// The number of neighboring pixels used in calculating each individual pixel value.
+ ///
public OilPaintingProcessor(int levels, int brushSize)
{
Guard.MustBeGreaterThan(levels, 0, nameof(levels));
diff --git a/src/ImageSharp/Samplers/Processors/PixelateProcessor.cs b/src/ImageSharp/Samplers/Processors/Effects/PixelateProcesso.cs
similarity index 91%
rename from src/ImageSharp/Samplers/Processors/PixelateProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Effects/PixelateProcesso.cs
index 2c18759091..41775ed974 100644
--- a/src/ImageSharp/Samplers/Processors/PixelateProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Effects/PixelateProcesso.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,22 +10,22 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
///
- /// An to pixelate the colors of an .
+ /// An to pixelate the colors of an .
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class PixelateProcessor : ImageSampler
+ public class PixelateProcesso : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The size of the pixels. Must be greater than 0.
///
/// is less than 0 or equal to 0.
///
- public PixelateProcessor(int size)
+ public PixelateProcesso(int size)
{
Guard.MustBeGreaterThan(size, 0, nameof(size));
this.Value = size;
diff --git a/src/ImageSharp/Samplers/Processors/IImageSampler.cs b/src/ImageSharp/Samplers/Processors/IImageSamplingProcessor.cs
similarity index 94%
rename from src/ImageSharp/Samplers/Processors/IImageSampler.cs
rename to src/ImageSharp/Samplers/Processors/IImageSamplingProcessor.cs
index 891a810d14..756c96612c 100644
--- a/src/ImageSharp/Samplers/Processors/IImageSampler.cs
+++ b/src/ImageSharp/Samplers/Processors/IImageSamplingProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -10,7 +10,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public interface IImageSampler : IImageProcessor
+ public interface IImageSamplingProcessor : IImageProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/ImageSampler.cs b/src/ImageSharp/Samplers/Processors/ImageSamplingProcessor.cs
similarity index 96%
rename from src/ImageSharp/Samplers/Processors/ImageSampler.cs
rename to src/ImageSharp/Samplers/Processors/ImageSamplingProcessor.cs
index 98ffe3b881..aa9d583a44 100644
--- a/src/ImageSharp/Samplers/Processors/ImageSampler.cs
+++ b/src/ImageSharp/Samplers/Processors/ImageSamplingProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class ImageSampler : ImageProcessor, IImageSampler
+ public abstract class ImageSamplingProcessor : ImageProcessor, IImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/CompandingResizeProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/CompandingResizeProcessor.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Processors/CompandingResizeProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/CompandingResizeProcessor.cs
index 2e7a8ec9a6..1028622efc 100644
--- a/src/ImageSharp/Samplers/Processors/CompandingResizeProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/CompandingResizeProcessor.cs
@@ -1,4 +1,4 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
@@ -20,7 +20,7 @@ namespace ImageSharp.Processors
where TPacked : struct
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
/// The sampler to perform the resize operation.
diff --git a/src/ImageSharp/Samplers/Processors/CropProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/CropProcessor.cs
similarity index 95%
rename from src/ImageSharp/Samplers/Processors/CropProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/CropProcessor.cs
index 7d64e88683..3a479fa2db 100644
--- a/src/ImageSharp/Samplers/Processors/CropProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/CropProcessor.cs
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class CropProcessor : ImageSampler
+ public class CropProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/EntropyCropProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/EntropyCropProcessor.cs
similarity index 99%
rename from src/ImageSharp/Samplers/Processors/EntropyCropProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/EntropyCropProcessor.cs
index dbb99d1c4b..f9c8b2ae46 100644
--- a/src/ImageSharp/Samplers/Processors/EntropyCropProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/EntropyCropProcessor.cs
@@ -14,7 +14,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class EntropyCropProcessor : ImageSampler
+ public class EntropyCropProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/FlipProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/FlipProcessor.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Processors/FlipProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/FlipProcessor.cs
index d6efccec77..e9464a8ff0 100644
--- a/src/ImageSharp/Samplers/Processors/FlipProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/FlipProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public class FlipProcessor : ImageSampler
+ public class FlipProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/Matrix3x2Processor.cs b/src/ImageSharp/Samplers/Processors/Transforms/Matrix3x2Processor.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Processors/Matrix3x2Processor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/Matrix3x2Processor.cs
index a9b460d43f..1694416489 100644
--- a/src/ImageSharp/Samplers/Processors/Matrix3x2Processor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/Matrix3x2Processor.cs
@@ -12,7 +12,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class Matrix3x2Processor : ImageSampler
+ public abstract class Matrix3x2Processor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
diff --git a/src/ImageSharp/Samplers/Processors/ResamplingWeightedProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/ResamplingWeightedProcessor.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Processors/ResamplingWeightedProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/ResamplingWeightedProcessor.cs
index 1d9d3da352..808440a0fc 100644
--- a/src/ImageSharp/Samplers/Processors/ResamplingWeightedProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/ResamplingWeightedProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
///
/// The pixel format.
/// The packed format. uint, long, float.
- public abstract class ResamplingWeightedProcessor : ImageSampler
+ public abstract class ResamplingWeightedProcessor : ImageSamplingProcessor
where TColor : struct, IPackedPixel
where TPacked : struct
{
@@ -133,10 +133,10 @@ namespace ImageSharp.Processors
///
/// Represents the weight to be added to a scaled pixel.
///
- protected class Weight
+ protected struct Weight
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// The index.
/// The value.
diff --git a/src/ImageSharp/Samplers/Processors/ResizeProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/ResizeProcessor.cs
similarity index 98%
rename from src/ImageSharp/Samplers/Processors/ResizeProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/ResizeProcessor.cs
index 82e9491485..1ec56d6d50 100644
--- a/src/ImageSharp/Samplers/Processors/ResizeProcessor.cs
+++ b/src/ImageSharp/Samplers/Processors/Transforms/ResizeProcessor.cs
@@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// Provides methods that allow the resizing of images using various algorithms.
///
///
- /// This version and the have been separated out to improve performance.
+ /// This version and the have been separated out to improve performance.
///
/// The pixel format.
/// The packed format. uint, long, float.
diff --git a/src/ImageSharp/Samplers/Processors/RotateProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/RotateProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/RotateProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/RotateProcessor.cs
diff --git a/src/ImageSharp/Samplers/Processors/SkewProcessor.cs b/src/ImageSharp/Samplers/Processors/Transforms/SkewProcessor.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Processors/SkewProcessor.cs
rename to src/ImageSharp/Samplers/Processors/Transforms/SkewProcessor.cs
diff --git a/src/ImageSharp/Samplers/AutoOrient.cs b/src/ImageSharp/Samplers/Transforms/AutoOrient.cs
similarity index 100%
rename from src/ImageSharp/Samplers/AutoOrient.cs
rename to src/ImageSharp/Samplers/Transforms/AutoOrient.cs
diff --git a/src/ImageSharp/Samplers/Crop.cs b/src/ImageSharp/Samplers/Transforms/Crop.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Crop.cs
rename to src/ImageSharp/Samplers/Transforms/Crop.cs
diff --git a/src/ImageSharp/Samplers/EntropyCrop.cs b/src/ImageSharp/Samplers/Transforms/EntropyCrop.cs
similarity index 100%
rename from src/ImageSharp/Samplers/EntropyCrop.cs
rename to src/ImageSharp/Samplers/Transforms/EntropyCrop.cs
diff --git a/src/ImageSharp/Samplers/Flip.cs b/src/ImageSharp/Samplers/Transforms/Flip.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Flip.cs
rename to src/ImageSharp/Samplers/Transforms/Flip.cs
diff --git a/src/ImageSharp/Samplers/Options/AnchorPosition.cs b/src/ImageSharp/Samplers/Transforms/Options/AnchorPosition.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/AnchorPosition.cs
rename to src/ImageSharp/Samplers/Transforms/Options/AnchorPosition.cs
diff --git a/src/ImageSharp/Samplers/Options/FlipType.cs b/src/ImageSharp/Samplers/Transforms/Options/FlipType.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/FlipType.cs
rename to src/ImageSharp/Samplers/Transforms/Options/FlipType.cs
diff --git a/src/ImageSharp/Samplers/Options/Orientation.cs b/src/ImageSharp/Samplers/Transforms/Options/Orientation.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/Orientation.cs
rename to src/ImageSharp/Samplers/Transforms/Options/Orientation.cs
diff --git a/src/ImageSharp/Samplers/Options/ResizeHelper.cs b/src/ImageSharp/Samplers/Transforms/Options/ResizeHelper.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/ResizeHelper.cs
rename to src/ImageSharp/Samplers/Transforms/Options/ResizeHelper.cs
diff --git a/src/ImageSharp/Samplers/Options/ResizeMode.cs b/src/ImageSharp/Samplers/Transforms/Options/ResizeMode.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/ResizeMode.cs
rename to src/ImageSharp/Samplers/Transforms/Options/ResizeMode.cs
diff --git a/src/ImageSharp/Samplers/Options/ResizeOptions.cs b/src/ImageSharp/Samplers/Transforms/Options/ResizeOptions.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/ResizeOptions.cs
rename to src/ImageSharp/Samplers/Transforms/Options/ResizeOptions.cs
diff --git a/src/ImageSharp/Samplers/Options/RotateType.cs b/src/ImageSharp/Samplers/Transforms/Options/RotateType.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Options/RotateType.cs
rename to src/ImageSharp/Samplers/Transforms/Options/RotateType.cs
diff --git a/src/ImageSharp/Samplers/Pad.cs b/src/ImageSharp/Samplers/Transforms/Pad.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Pad.cs
rename to src/ImageSharp/Samplers/Transforms/Pad.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/BicubicResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/BicubicResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/BicubicResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/BicubicResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/BoxResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/BoxResampler.cs
similarity index 95%
rename from src/ImageSharp/Samplers/Resamplers/BoxResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/BoxResampler.cs
index adb238a198..70879ec804 100644
--- a/src/ImageSharp/Samplers/Resamplers/BoxResampler.cs
+++ b/src/ImageSharp/Samplers/Transforms/Resamplers/BoxResampler.cs
@@ -6,7 +6,7 @@
namespace ImageSharp
{
///
- /// The function implements the box algorithm. Similar to nearest neighbour when upscaling.
+ /// The function implements the box algorithm. Similar to nearest neighbor when upscaling.
/// When downscaling the pixels will average, merging together.
///
public class BoxResampler : IResampler
diff --git a/src/ImageSharp/Samplers/Resamplers/CatmullRomResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/CatmullRomResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/CatmullRomResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/CatmullRomResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/HermiteResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/HermiteResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/HermiteResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/HermiteResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/IResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/IResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/IResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/IResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/Lanczos2Resampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos2Resampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/Lanczos2Resampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos2Resampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/Lanczos3Resampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos3Resampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/Lanczos3Resampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos3Resampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/Lanczos5Resampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos5Resampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/Lanczos5Resampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos5Resampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/Lanczos8Resampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos8Resampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/Lanczos8Resampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos8Resampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/MitchellNetravaliResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/MitchellNetravaliResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/MitchellNetravaliResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/MitchellNetravaliResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/NearestNeighborResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/NearestNeighborResampler.cs
similarity index 85%
rename from src/ImageSharp/Samplers/Resamplers/NearestNeighborResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/NearestNeighborResampler.cs
index ec2417f9ca..12ba3ae1a3 100644
--- a/src/ImageSharp/Samplers/Resamplers/NearestNeighborResampler.cs
+++ b/src/ImageSharp/Samplers/Transforms/Resamplers/NearestNeighborResampler.cs
@@ -6,7 +6,7 @@
namespace ImageSharp
{
///
- /// The function implements the nearest neighbour algorithm. This uses an unscaled filter
+ /// The function implements the nearest neighbor algorithm. This uses an unscaled filter
/// which will select the closest pixel to the new pixels position.
///
public class NearestNeighborResampler : IResampler
diff --git a/src/ImageSharp/Samplers/Resamplers/RobidouxResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/RobidouxResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/RobidouxResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/RobidouxResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/RobidouxSharpResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/RobidouxSharpResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/RobidouxSharpResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/RobidouxSharpResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/SplineResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/SplineResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/SplineResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/SplineResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/TriangleResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/TriangleResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/TriangleResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/TriangleResampler.cs
diff --git a/src/ImageSharp/Samplers/Resamplers/WelchResampler.cs b/src/ImageSharp/Samplers/Transforms/Resamplers/WelchResampler.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resamplers/WelchResampler.cs
rename to src/ImageSharp/Samplers/Transforms/Resamplers/WelchResampler.cs
diff --git a/src/ImageSharp/Samplers/Resize.cs b/src/ImageSharp/Samplers/Transforms/Resize.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Resize.cs
rename to src/ImageSharp/Samplers/Transforms/Resize.cs
diff --git a/src/ImageSharp/Samplers/Rotate.cs b/src/ImageSharp/Samplers/Transforms/Rotate.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Rotate.cs
rename to src/ImageSharp/Samplers/Transforms/Rotate.cs
diff --git a/src/ImageSharp/Samplers/RotateFlip.cs b/src/ImageSharp/Samplers/Transforms/RotateFlip.cs
similarity index 100%
rename from src/ImageSharp/Samplers/RotateFlip.cs
rename to src/ImageSharp/Samplers/Transforms/RotateFlip.cs
diff --git a/src/ImageSharp/Samplers/Skew.cs b/src/ImageSharp/Samplers/Transforms/Skew.cs
similarity index 100%
rename from src/ImageSharp/Samplers/Skew.cs
rename to src/ImageSharp/Samplers/Transforms/Skew.cs
diff --git a/tests/ImageSharp.Tests/Processors/Filters/BlendTest.cs b/tests/ImageSharp.Tests/Processors/Filters/BlendTest.cs
index 653524e209..8c3bf932fa 100644
--- a/tests/ImageSharp.Tests/Processors/Filters/BlendTest.cs
+++ b/tests/ImageSharp.Tests/Processors/Filters/BlendTest.cs
@@ -6,6 +6,7 @@
namespace ImageSharp.Tests
{
using System.IO;
+ using System.Linq;
using Xunit;
@@ -16,7 +17,9 @@ namespace ImageSharp.Tests
{
string path = CreateOutputDirectory("Blend");
- Image blend;
+ Image blend;// = new Image(400, 400);
+ // blend.BackgroundColor(Color.RebeccaPurple);
+
using (FileStream stream = File.OpenRead(TestImages.Bmp.Car))
{
blend = new Image(stream);
@@ -28,8 +31,8 @@ namespace ImageSharp.Tests
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}"))
{
- image.Blend(blend)
- .Save(output);
+ image.Blend(blend, 75, new Size(image.Width / 2, image.Height / 2), new Point(image.Width / 4, image.Height / 4))
+ .Save(output);
}
}
}