Anton Firszov 10 years ago
parent
commit
ae62653ac1
  1. 2
      Settings.StyleCop
  2. 16
      contributing.md
  3. 49
      src/ImageSharp/Colors/Vector4BlendTransforms.cs
  4. 0
      src/ImageSharp/Filters/Binarization/BinaryThreshold.cs
  5. 0
      src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs
  6. 2
      src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs
  7. 4
      src/ImageSharp/Filters/ColorMatrix/Grayscale.cs
  8. 0
      src/ImageSharp/Filters/ColorMatrix/Hue.cs
  9. 0
      src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs
  10. 0
      src/ImageSharp/Filters/ColorMatrix/Lomograph.cs
  11. 0
      src/ImageSharp/Filters/ColorMatrix/Options/ColorBlindness.cs
  12. 0
      src/ImageSharp/Filters/ColorMatrix/Options/GrayscaleMode.cs
  13. 0
      src/ImageSharp/Filters/ColorMatrix/Polaroid.cs
  14. 0
      src/ImageSharp/Filters/ColorMatrix/Saturation.cs
  15. 0
      src/ImageSharp/Filters/ColorMatrix/Sepia.cs
  16. 0
      src/ImageSharp/Filters/Effects/Alpha.cs
  17. 0
      src/ImageSharp/Filters/Effects/BackgroundColor.cs
  18. 0
      src/ImageSharp/Filters/Effects/Brightness.cs
  19. 0
      src/ImageSharp/Filters/Effects/Contrast.cs
  20. 0
      src/ImageSharp/Filters/Effects/Invert.cs
  21. 23
      src/ImageSharp/Filters/Overlays/Blend.cs
  22. 0
      src/ImageSharp/Filters/Overlays/Glow.cs
  23. 0
      src/ImageSharp/Filters/Overlays/Vignette.cs
  24. 4
      src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs
  25. 106
      src/ImageSharp/Filters/Processors/BlendProcessor.cs
  26. 2
      src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs
  27. 2
      src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs
  28. 4
      src/ImageSharp/Filters/Processors/ColorMatrix/SaturationProcessor.cs
  29. 4
      src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs
  30. 4
      src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs
  31. 4
      src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs
  32. 4
      src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs
  33. 4
      src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs
  34. 4
      src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs
  35. 4
      src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs
  36. 99
      src/ImageSharp/Filters/Processors/Overlays/BlendProcessor.cs
  37. 20
      src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs
  38. 6
      src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs
  39. 12
      src/ImageSharp/Image/ImageProcessingExtensions.cs
  40. 5
      src/ImageSharp/Numerics/Rectangle.cs
  41. 2
      src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs
  42. 0
      src/ImageSharp/Samplers/Convolution/BoxBlur.cs
  43. 10
      src/ImageSharp/Samplers/Convolution/DetectEdges.cs
  44. 0
      src/ImageSharp/Samplers/Convolution/GuassianBlur.cs
  45. 0
      src/ImageSharp/Samplers/Convolution/GuassianSharpen.cs
  46. 0
      src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs
  47. 8
      src/ImageSharp/Samplers/Effects/OilPainting.cs
  48. 2
      src/ImageSharp/Samplers/Effects/Pixelate.cs
  49. 8
      src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs
  50. 10
      src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs
  51. 10
      src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs
  52. 10
      src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs
  53. 10
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs
  54. 10
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs
  55. 8
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs
  56. 6
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs
  57. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs
  58. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs
  59. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs
  60. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs
  61. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs
  62. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs
  63. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs
  64. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs
  65. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs
  66. 2
      src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs
  67. 6
      src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs
  68. 6
      src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs
  69. 14
      src/ImageSharp/Samplers/Processors/Effects/OilPaintingProcessor.cs
  70. 10
      src/ImageSharp/Samplers/Processors/Effects/PixelateProcesso.cs
  71. 4
      src/ImageSharp/Samplers/Processors/IImageSamplingProcessor.cs
  72. 4
      src/ImageSharp/Samplers/Processors/ImageSamplingProcessor.cs
  73. 4
      src/ImageSharp/Samplers/Processors/Transforms/CompandingResizeProcessor.cs
  74. 2
      src/ImageSharp/Samplers/Processors/Transforms/CropProcessor.cs
  75. 2
      src/ImageSharp/Samplers/Processors/Transforms/EntropyCropProcessor.cs
  76. 2
      src/ImageSharp/Samplers/Processors/Transforms/FlipProcessor.cs
  77. 2
      src/ImageSharp/Samplers/Processors/Transforms/Matrix3x2Processor.cs
  78. 6
      src/ImageSharp/Samplers/Processors/Transforms/ResamplingWeightedProcessor.cs
  79. 2
      src/ImageSharp/Samplers/Processors/Transforms/ResizeProcessor.cs
  80. 0
      src/ImageSharp/Samplers/Processors/Transforms/RotateProcessor.cs
  81. 0
      src/ImageSharp/Samplers/Processors/Transforms/SkewProcessor.cs
  82. 0
      src/ImageSharp/Samplers/Transforms/AutoOrient.cs
  83. 0
      src/ImageSharp/Samplers/Transforms/Crop.cs
  84. 0
      src/ImageSharp/Samplers/Transforms/EntropyCrop.cs
  85. 0
      src/ImageSharp/Samplers/Transforms/Flip.cs
  86. 0
      src/ImageSharp/Samplers/Transforms/Options/AnchorPosition.cs
  87. 0
      src/ImageSharp/Samplers/Transforms/Options/FlipType.cs
  88. 0
      src/ImageSharp/Samplers/Transforms/Options/Orientation.cs
  89. 0
      src/ImageSharp/Samplers/Transforms/Options/ResizeHelper.cs
  90. 0
      src/ImageSharp/Samplers/Transforms/Options/ResizeMode.cs
  91. 0
      src/ImageSharp/Samplers/Transforms/Options/ResizeOptions.cs
  92. 0
      src/ImageSharp/Samplers/Transforms/Options/RotateType.cs
  93. 0
      src/ImageSharp/Samplers/Transforms/Pad.cs
  94. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/BicubicResampler.cs
  95. 2
      src/ImageSharp/Samplers/Transforms/Resamplers/BoxResampler.cs
  96. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/CatmullRomResampler.cs
  97. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/HermiteResampler.cs
  98. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/IResampler.cs
  99. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos2Resampler.cs
  100. 0
      src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos3Resampler.cs

2
Settings.StyleCop

@ -34,6 +34,8 @@
<Value>cmyk</Value>
<Value>Paeth</Value>
<Value>th</Value>
<Value>desensitivity</Value>
<Value>premultiplied</Value>
</CollectionProperty>
</GlobalSettings>
<Analyzers>

16
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!

49
src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs → src/ImageSharp/Colors/Vector4BlendTransforms.cs

@ -17,7 +17,7 @@ namespace ImageSharp
/// <summary>
/// The epsilon for comparing floating point numbers.
/// </summary>
private const float Epsilon = 0.001F;
private const float Epsilon = 0.0001F;
/// <summary>
/// The blending formula simply selects the source vector.
@ -186,7 +186,52 @@ namespace ImageSharp
}
/// <summary>
/// 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.
/// </summary>
/// <param name="backdrop">The backdrop vector.</param>
/// <param name="source">The source vector.</param>
/// <param name="amount">
/// 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.
/// </param>
/// <returns>
/// The <see cref="Vector4"/>
/// </returns>
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)));
}
/// <summary>
/// Multiplies or screens the backdrop component, depending on the component value.
/// </summary>
/// <param name="b">The backdrop component.</param>
/// <param name="s">The source component.</param>

0
src/ImageSharp/Filters/BinaryThreshold.cs → src/ImageSharp/Filters/Binarization/BinaryThreshold.cs

0
src/ImageSharp/Filters/BlackWhite.cs → src/ImageSharp/Filters/ColorMatrix/BlackWhite.cs

2
src/ImageSharp/Filters/ColorBlindness.cs → src/ImageSharp/Filters/ColorMatrix/ColorBlindness.cs

@ -42,7 +42,7 @@ namespace ImageSharp
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
IImageFilter<TColor, TPacked> processor;
IImageFilteringProcessor<TColor, TPacked> processor;
switch (colorBlindness)
{

4
src/ImageSharp/Filters/Grayscale.cs → src/ImageSharp/Filters/ColorMatrix/Grayscale.cs

@ -42,8 +42,8 @@ namespace ImageSharp
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
IImageFilter<TColor, TPacked> processor = mode == GrayscaleMode.Bt709
? (IImageFilter<TColor, TPacked>)new GrayscaleBt709Processor<TColor, TPacked>()
IImageFilteringProcessor<TColor, TPacked> processor = mode == GrayscaleMode.Bt709
? (IImageFilteringProcessor<TColor, TPacked>)new GrayscaleBt709Processor<TColor, TPacked>()
: new GrayscaleBt601Processor<TColor, TPacked>();
return source.Process(rectangle, processor);

0
src/ImageSharp/Filters/Hue.cs → src/ImageSharp/Filters/ColorMatrix/Hue.cs

0
src/ImageSharp/Filters/Kodachrome.cs → src/ImageSharp/Filters/ColorMatrix/Kodachrome.cs

0
src/ImageSharp/Filters/Lomograph.cs → src/ImageSharp/Filters/ColorMatrix/Lomograph.cs

0
src/ImageSharp/Filters/Options/ColorBlindness.cs → src/ImageSharp/Filters/ColorMatrix/Options/ColorBlindness.cs

0
src/ImageSharp/Filters/Options/GrayscaleMode.cs → src/ImageSharp/Filters/ColorMatrix/Options/GrayscaleMode.cs

0
src/ImageSharp/Filters/Polaroid.cs → src/ImageSharp/Filters/ColorMatrix/Polaroid.cs

0
src/ImageSharp/Filters/Saturation.cs → src/ImageSharp/Filters/ColorMatrix/Saturation.cs

0
src/ImageSharp/Filters/Sepia.cs → src/ImageSharp/Filters/ColorMatrix/Sepia.cs

0
src/ImageSharp/Filters/Alpha.cs → src/ImageSharp/Filters/Effects/Alpha.cs

0
src/ImageSharp/Filters/BackgroundColor.cs → src/ImageSharp/Filters/Effects/BackgroundColor.cs

0
src/ImageSharp/Filters/Brightness.cs → src/ImageSharp/Filters/Effects/Brightness.cs

0
src/ImageSharp/Filters/Contrast.cs → src/ImageSharp/Filters/Effects/Contrast.cs

0
src/ImageSharp/Filters/Invert.cs → src/ImageSharp/Filters/Effects/Invert.cs

23
src/ImageSharp/Filters/Blend.cs → src/ImageSharp/Filters/Overlays/Blend.cs

@ -21,11 +21,11 @@ namespace ImageSharp
/// <param name="image">The image to blend with the currently processing image.</param>
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, ImageBase<TColor, TPacked> image, int percent = 50)
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, Image<TColor, TPacked> image, int percent = 50)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
return Blend(source, image, percent, source.Bounds);
return Blend(source, image, percent, default(Size), default(Point));
}
/// <summary>
@ -36,15 +36,24 @@ namespace ImageSharp
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="size">The size to draw the blended image.</param>
/// <param name="location">The location to draw the blended image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, ImageBase<TColor, TPacked> image, int percent, Rectangle rectangle)
public static Image<TColor, TPacked> Blend<TColor, TPacked>(this Image<TColor, TPacked> source, Image<TColor, TPacked> image, int percent, Size size, Point location)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
return source.Process(rectangle, new BlendProcessor<TColor, TPacked>(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<TColor, TPacked>(image, size, location, percent));
}
}
}

0
src/ImageSharp/Filters/Glow.cs → src/ImageSharp/Filters/Overlays/Glow.cs

0
src/ImageSharp/Filters/Vignette.cs → src/ImageSharp/Filters/Overlays/Vignette.cs

4
src/ImageSharp/Filters/Processors/Binarization/BinaryThresholdProcessor.cs

@ -9,12 +9,12 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> to perform binary threshold filtering against an
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> to perform binary threshold filtering against an
/// <see cref="Image"/>. The image will be converted to grayscale before thresholding occurs.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BinaryThresholdProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class BinaryThresholdProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

106
src/ImageSharp/Filters/Processors/BlendProcessor.cs

@ -1,106 +0,0 @@
// <copyright file="BlendProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Processors
{
using System;
using System.Numerics;
using System.Threading.Tasks;
/// <summary>
/// Combines two images together by blending the pixels.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BlendProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// The image to blend.
/// </summary>
private readonly ImageBase<TColor, TPacked> blend;
/// <summary>
/// Initializes a new instance of the <see cref="BlendProcessor{T,TP}"/> class.
/// </summary>
/// <param name="image">
/// The image to blend with the currently processing image.
/// Disposal of this image is the responsibility of the developer.
/// </param>
/// <param name="alpha">The opacity of the image to blend. Between 0 and 100.</param>
public BlendProcessor(ImageBase<TColor, TPacked> image, int alpha = 100)
{
Guard.MustBeBetweenOrEqualTo(alpha, 0, 100, nameof(alpha));
this.blend = image;
this.Value = alpha;
}
/// <summary>
/// Gets the alpha percentage value.
/// </summary>
public int Value { get; }
/// <inheritdoc/>
protected override void Apply(ImageBase<TColor, TPacked> 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<TColor, TPacked> toBlendPixels = this.blend.Lock())
using (PixelAccessor<TColor, TPacked> 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;
}
});
}
}
}
}

2
src/ImageSharp/Filters/Processors/ColorMatrix/ColorMatrixFilter.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class ColorMatrixFilter<TColor, TPacked> : ImageFilter<TColor, TPacked>, IColorMatrixFilter<TColor, TPacked>
public abstract class ColorMatrixFilter<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>, IColorMatrixFilter<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Filters/Processors/ColorMatrix/IColorMatrixFilter.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IColorMatrixFilter<TColor, TPacked> : IImageFilter<TColor, TPacked>
public interface IColorMatrixFilter<TColor, TPacked> : IImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
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;

4
src/ImageSharp/Filters/Processors/AlphaProcessor.cs → src/ImageSharp/Filters/Processors/Effects/AlphaProcessor.cs

@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor, TPacked}"/> to change the alpha component of an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> to change the alpha component of an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class AlphaProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class AlphaProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Filters/Processors/BackgroundColorProcessor.cs → src/ImageSharp/Filters/Processors/Effects/BackgroundColorProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BackgroundColorProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class BackgroundColorProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
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)

4
src/ImageSharp/Filters/Processors/BrightnessProcessor.cs → src/ImageSharp/Filters/Processors/Effects/BrightnessProcessor.cs

@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> to change the brightness of an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> to change the brightness of an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BrightnessProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class BrightnessProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Filters/Processors/ContrastProcessor.cs → src/ImageSharp/Filters/Processors/Effects/ContrastProcessor.cs

@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> to change the contrast of an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> to change the contrast of an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>long, float.</example></typeparam>
public class ContrastProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class ContrastProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Filters/Processors/InvertProcessor.cs → src/ImageSharp/Filters/Processors/Effects/InvertProcessor.cs

@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> to invert the colors of an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> to invert the colors of an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class InvertProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class InvertProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Filters/Processors/IImageFilter.cs → src/ImageSharp/Filters/Processors/IImageFilteringProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="IImageFilter.cs" company="James Jackson-South">
// <copyright file="IImageFilteringProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,7 +10,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IImageFilter<TColor, TPacked> : IImageProcessor
public interface IImageFilteringProcessor<TColor, TPacked> : IImageProcessor
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Filters/Processors/ImageFilter.cs → src/ImageSharp/Filters/Processors/ImageFilteringProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="ImageFilter.cs" company="James Jackson-South">
// <copyright file="ImageFilteringProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -12,7 +12,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class ImageFilter<TColor, TPacked> : ImageProcessor<TColor, TPacked>, IImageFilter<TColor, TPacked>
public abstract class ImageFilteringProcessor<TColor, TPacked> : ImageProcessor<TColor, TPacked>, IImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

99
src/ImageSharp/Filters/Processors/Overlays/BlendProcessor.cs

@ -0,0 +1,99 @@
// <copyright file="BlendProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Processors
{
using System;
using System.Numerics;
using System.Threading.Tasks;
/// <summary>
/// Combines two images together by blending the pixels.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BlendProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="BlendProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="image">The image to blend with the currently processing image.</param>
/// <param name="size">The size to draw the blended image.</param>
/// <param name="location">The location to draw the blended image.</param>
/// <param name="alpha">The opacity of the image to blend. Between 0 and 100.</param>
public BlendProcessor(Image<TColor, TPacked> 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;
}
/// <summary>
/// Gets the image to blend.
/// </summary>
public Image<TColor, TPacked> Image { get; private set; }
/// <summary>
/// Gets the alpha percentage value.
/// </summary>
public int Alpha { get; }
/// <summary>
/// Gets the size to draw the blended image.
/// </summary>
public Size Size { get; }
/// <summary>
/// Gets the location to draw the blended image.
/// </summary>
public Point Location { get; }
/// <inheritdoc/>
protected override void Apply(ImageBase<TColor, TPacked> 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<TColor, TPacked> toBlendPixels = this.Image.Lock())
using (PixelAccessor<TColor, TPacked> 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;
}
});
}
}
}
}

20
src/ImageSharp/Filters/Processors/GlowProcessor.cs → src/ImageSharp/Filters/Processors/Overlays/GlowProcessor.cs

@ -10,16 +10,16 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> that applies a radial glow effect an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> that applies a radial glow effect an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GlowProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class GlowProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="GlowProcessor{T,TP}"/> class.
/// Initializes a new instance of the <see cref="GlowProcessor{TColor,TPacked}"/> class.
/// </summary>
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;
}
});
}

6
src/ImageSharp/Filters/Processors/VignetteProcessor.cs → src/ImageSharp/Filters/Processors/Overlays/VignetteProcessor.cs

@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageFilter{TColor,TPacked}"/> that applies a radial vignette effect to an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageFilteringProcessor{TColor,TPacked}"/> that applies a radial vignette effect to an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class VignetteProcessor<TColor, TPacked> : ImageFilter<TColor, TPacked>
public class VignetteProcessor<TColor, TPacked> : ImageFilteringProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
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;
}
});

12
src/ImageSharp/Image/ImageProcessingExtensions.cs

@ -22,7 +22,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <param name="processor">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageFilter<TColor, TPacked> processor)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageFilteringProcessor<TColor, TPacked> processor)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -41,7 +41,7 @@ namespace ImageSharp
/// </param>
/// <param name="processor">The processors to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageFilter<TColor, TPacked> processor)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageFilteringProcessor<TColor, TPacked> processor)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -57,7 +57,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <param name="processor">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageSampler<TColor, TPacked> processor)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, IImageSamplingProcessor<TColor, TPacked> processor)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -76,7 +76,7 @@ namespace ImageSharp
/// </param>
/// <param name="processor">The processors to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageSampler<TColor, TPacked> processor)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle sourceRectangle, IImageSamplingProcessor<TColor, TPacked> processor)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -96,7 +96,7 @@ namespace ImageSharp
/// <param name="height">The target image height.</param>
/// <param name="sampler">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IImageSampler<TColor, TPacked> sampler)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, IImageSamplingProcessor<TColor, TPacked> sampler)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -123,7 +123,7 @@ namespace ImageSharp
/// </param>
/// <param name="sampler">The processor to apply to the image.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSampler<TColor, TPacked> sampler)
internal static Image<TColor, TPacked> Process<TColor, TPacked>(this Image<TColor, TPacked> source, int width, int height, Rectangle sourceRectangle, Rectangle targetRectangle, IImageSamplingProcessor<TColor, TPacked> sampler)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

5
src/ImageSharp/Numerics/Rectangle.cs

@ -127,6 +127,11 @@ namespace ImageSharp
}
}
/// <summary>
/// Gets the size of this <see cref="Rectangle"/>.
/// </summary>
public Size Size => new Size(this.Width, this.Height);
/// <summary>
/// Gets a value indicating whether this <see cref="Rectangle"/> is empty.
/// </summary>

2
src/ImageSharp/Quantizers/Octree/OctreeQuantizer.cs

@ -9,7 +9,7 @@ namespace ImageSharp.Quantizers
using System.Collections.Generic;
/// <summary>
/// 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.
/// <see href="http://msdn.microsoft.com/en-us/library/aa479306.aspx"/>
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>

0
src/ImageSharp/Samplers/BoxBlur.cs → src/ImageSharp/Samplers/Convolution/BoxBlur.cs

10
src/ImageSharp/Samplers/DetectEdges.cs → src/ImageSharp/Samplers/Convolution/DetectEdges.cs

@ -28,7 +28,7 @@ namespace ImageSharp
}
/// <summary>
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{T,TP}"/> filter
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{TColor,TPacked}"/> filter
/// operating in Grayscale mode.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
@ -77,12 +77,12 @@ namespace ImageSharp
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
IEdgeDetectorFilter<TColor, TPacked> processor;
IEdgeDetectorProcessor<TColor, TPacked> processor;
switch (filter)
{
case EdgeDetection.Kayyali:
processor = new KayyaliProcessor<TColor, TPacked> { Grayscale = grayscale };
processor = new KayyaliSampler<TColor, TPacked> { Grayscale = grayscale };
break;
case EdgeDetection.Kirsch:
@ -133,7 +133,7 @@ namespace ImageSharp
/// <param name="source">The image this method extends.</param>
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, IEdgeDetectorFilter<TColor, TPacked> filter)
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, IEdgeDetectorProcessor<TColor, TPacked> filter)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -151,7 +151,7 @@ namespace ImageSharp
/// </param>
/// <param name="filter">The filter for detecting edges.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle, IEdgeDetectorFilter<TColor, TPacked> filter)
public static Image<TColor, TPacked> DetectEdges<TColor, TPacked>(this Image<TColor, TPacked> source, Rectangle rectangle, IEdgeDetectorProcessor<TColor, TPacked> filter)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

0
src/ImageSharp/Samplers/GuassianBlur.cs → src/ImageSharp/Samplers/Convolution/GuassianBlur.cs

0
src/ImageSharp/Samplers/GuassianSharpen.cs → src/ImageSharp/Samplers/Convolution/GuassianSharpen.cs

0
src/ImageSharp/Filters/Options/EdgeDetection.cs → src/ImageSharp/Samplers/Convolution/Options/EdgeDetection.cs

8
src/ImageSharp/Samplers/OilPainting.cs → src/ImageSharp/Samplers/Effects/OilPainting.cs

@ -20,8 +20,8 @@ namespace ImageSharp
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="levels">The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.</param>
/// <param name="brushSize">The number of neighbouring pixels used in calculating each individual pixel value.</param>
/// <param name="levels">The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.</param>
/// <param name="brushSize">The number of neighboring pixels used in calculating each individual pixel value.</param>
/// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
public static Image<TColor, TPacked> OilPaint<TColor, TPacked>(this Image<TColor, TPacked> source, int levels = 10, int brushSize = 15)
where TColor : struct, IPackedPixel<TPacked>
@ -36,8 +36,8 @@ namespace ImageSharp
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="levels">The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.</param>
/// <param name="brushSize">The number of neighbouring pixels used in calculating each individual pixel value.</param>
/// <param name="levels">The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.</param>
/// <param name="brushSize">The number of neighboring pixels used in calculating each individual pixel value.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>

2
src/ImageSharp/Samplers/Pixelate.cs → src/ImageSharp/Samplers/Effects/Pixelate.cs

@ -49,7 +49,7 @@ namespace ImageSharp
throw new ArgumentOutOfRangeException(nameof(size));
}
return source.Process(rectangle, new PixelateProcessor<TColor, TPacked>(size));
return source.Process(rectangle, new PixelateProcesso<TColor, TPacked>(size));
}
}
}

8
src/ImageSharp/Samplers/Processors/Convolution/BoxBlurProcessor.cs

@ -6,11 +6,11 @@
namespace ImageSharp.Processors
{
/// <summary>
/// Applies a Box blur filter to the image.
/// Applies a Box blur sampler to the image.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class BoxBlurProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class BoxBlurProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -20,7 +20,7 @@ namespace ImageSharp.Processors
private readonly int kernelSize;
/// <summary>
/// Initializes a new instance of the <see cref="BoxBlurProcessor{TColor, TPacked}"/> class.
/// Initializes a new instance of the <see cref="BoxBlurProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="radius">
/// The 'radius' value representing the size of the area to sample.
@ -45,7 +45,7 @@ namespace ImageSharp.Processors
/// <inheritdoc/>
public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor, TPacked> source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
new Convolution2PassFilter<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new Convolution2PassProcessor<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
/// <summary>

10
src/ImageSharp/Samplers/Processors/Convolution/Convolution2DFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/Convolution2DProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="Convolution2DFilter.cs" company="James Jackson-South">
// <copyright file="Convolution2DProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,20 +10,20 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class Convolution2DFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class Convolution2DProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="Convolution2DFilter{TColor,TPacked}"/> class.
/// Initializes a new instance of the <see cref="Convolution2DProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="kernelX">The horizontal gradient operator.</param>
/// <param name="kernelY">The vertical gradient operator.</param>
public Convolution2DFilter(float[][] kernelX, float[][] kernelY)
public Convolution2DProcessor(float[][] kernelX, float[][] kernelY)
{
this.KernelX = kernelX;
this.KernelY = kernelY;

10
src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/Convolution2PassProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="Convolution2PassFilter.cs" company="James Jackson-South">
// <copyright file="Convolution2PassProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -9,20 +9,20 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class Convolution2PassFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class Convolution2PassProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="Convolution2PassFilter{TColor,TPacked}"/> class.
/// Initializes a new instance of the <see cref="Convolution2PassProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="kernelX">The horizontal gradient operator.</param>
/// <param name="kernelY">The vertical gradient operator.</param>
public Convolution2PassFilter(float[][] kernelX, float[][] kernelY)
public Convolution2PassProcessor(float[][] kernelX, float[][] kernelY)
{
this.KernelX = kernelX;
this.KernelY = kernelY;

10
src/ImageSharp/Samplers/Processors/Convolution/ConvolutionFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/ConvolutionProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="ConvolutionFilter.cs" company="James Jackson-South">
// <copyright file="ConvolutionProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -9,19 +9,19 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class ConvolutionFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class ConvolutionProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="ConvolutionFilter{TColor,TPacked}"/> class.
/// Initializes a new instance of the <see cref="ConvolutionProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="kernelXY">The 2d gradient operator.</param>
public ConvolutionFilter(float[][] kernelXY)
public ConvolutionProcessor(float[][] kernelXY)
{
this.KernelXY = kernelXY;
}

10
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="EdgeDetector2DFilter.cs" company="James Jackson-South">
// <copyright file="EdgeDetector2DProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -6,12 +6,11 @@
namespace ImageSharp.Processors
{
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class EdgeDetector2DFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>, IEdgeDetectorFilter<TColor, TPacked>
public abstract class EdgeDetector2DProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>, IEdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -31,8 +30,7 @@ namespace ImageSharp.Processors
/// <inheritdoc />
public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor, TPacked> source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
// TODO: Figure out a way to pass event handlers to child classes.
new Convolution2DFilter<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new Convolution2DProcessor<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
/// <inheritdoc/>

10
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="EdgeDetectorCompassFilter.cs" company="James Jackson-South">
// <copyright file="EdgeDetectorCompassProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,11 +10,11 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class EdgeDetectorCompassFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>, IEdgeDetectorFilter<TColor, TPacked>
public abstract class EdgeDetectorCompassProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>, IEdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -76,7 +76,7 @@ namespace ImageSharp.Processors
int maxY = Math.Min(source.Height, endY);
// First run.
new ConvolutionFilter<TColor, TPacked>(kernels[0]).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new ConvolutionProcessor<TColor, TPacked>(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<TColor, TPacked> pass = new Image<TColor, TPacked>(source.Width, source.Height);
new ConvolutionFilter<TColor, TPacked>(kernels[i]).Apply(pass, source, sourceRectangle, targetRectangle, startY, endY);
new ConvolutionProcessor<TColor, TPacked>(kernels[i]).Apply(pass, source, sourceRectangle, targetRectangle, startY, endY);
using (PixelAccessor<TColor, TPacked> passPixels = pass.Lock())
using (PixelAccessor<TColor, TPacked> targetPixels = target.Lock())

8
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="EdgeDetectorFilter.cs" company="James Jackson-South">
// <copyright file="EdgeDetectorProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -6,11 +6,11 @@
namespace ImageSharp.Processors
{
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class EdgeDetectorFilter<TColor, TPacked> : ImageSampler<TColor, TPacked>, IEdgeDetectorFilter<TColor, TPacked>
public abstract class EdgeDetectorProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>, IEdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -25,7 +25,7 @@ namespace ImageSharp.Processors
/// <inheritdoc/>
public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor, TPacked> source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
new ConvolutionFilter<TColor, TPacked>(this.KernelXY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new ConvolutionProcessor<TColor, TPacked>(this.KernelXY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
/// <inheritdoc/>

6
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorFilter.cs → src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/IEdgeDetectorSampler.cs

@ -1,4 +1,4 @@
// <copyright file="IEdgeDetectorFilter.cs" company="James Jackson-South">
// <copyright file="IEdgeDetectorProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,7 +10,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IEdgeDetectorFilter<TColor, TPacked> : IImageSampler<TColor, TPacked>, IEdgeDetectorFilter
public interface IEdgeDetectorProcessor<TColor, TPacked> : IImageSamplingProcessor<TColor, TPacked>, IEdgeDetectorProcessor
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -19,7 +19,7 @@ namespace ImageSharp.Processors
/// <summary>
/// Provides properties and methods allowing the detection of edges within an image.
/// </summary>
public interface IEdgeDetectorFilter
public interface IEdgeDetectorProcessor
{
/// <summary>
/// Gets or sets a value indicating whether to convert the image to grayscale before performing edge detection.

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class KayyaliProcessor<TColor, TPacked> : EdgeDetector2DFilter<TColor, TPacked>
public class KayyaliSampler<TColor, TPacked> : EdgeDetector2DProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/KirschProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class KirschProcessor<TColor, TPacked> : EdgeDetectorCompassFilter<TColor, TPacked>
public class KirschProcessor<TColor, TPacked> : EdgeDetectorCompassProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class Laplacian3X3Processor<TColor, TPacked> : EdgeDetectorFilter<TColor, TPacked>
public class Laplacian3X3Processor<TColor, TPacked> : EdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class Laplacian5X5Processor<TColor, TPacked> : EdgeDetectorFilter<TColor, TPacked>
public class Laplacian5X5Processor<TColor, TPacked> : EdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class LaplacianOfGaussianProcessor<TColor, TPacked> : EdgeDetectorFilter<TColor, TPacked>
public class LaplacianOfGaussianProcessor<TColor, TPacked> : EdgeDetectorProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/PrewittProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class PrewittProcessor<TColor, TPacked> : EdgeDetector2DFilter<TColor, TPacked>
public class PrewittProcessor<TColor, TPacked> : EdgeDetector2DProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class RobertsCrossProcessor<TColor, TPacked> : EdgeDetector2DFilter<TColor, TPacked>
public class RobertsCrossProcessor<TColor, TPacked> : EdgeDetector2DProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class RobinsonProcessor<TColor, TPacked> : EdgeDetectorCompassFilter<TColor, TPacked>
public class RobinsonProcessor<TColor, TPacked> : EdgeDetectorCompassProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/ScharrProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class ScharrProcessor<TColor, TPacked> : EdgeDetector2DFilter<TColor, TPacked>
public class ScharrProcessor<TColor, TPacked> : EdgeDetector2DProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Convolution/EdgeDetection/SobelProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
[SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
public class SobelProcessor<TColor, TPacked> : EdgeDetector2DFilter<TColor, TPacked>
public class SobelProcessor<TColor, TPacked> : EdgeDetector2DProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

6
src/ImageSharp/Samplers/Processors/Convolution/GuassianBlurProcessor.cs

@ -8,11 +8,11 @@ namespace ImageSharp.Processors
using System;
/// <summary>
/// Applies a Gaussian blur filter to the image.
/// Applies a Gaussian blur sampler to the image.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GuassianBlurProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class GuassianBlurProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -83,7 +83,7 @@ namespace ImageSharp.Processors
/// <inheritdoc/>
public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor, TPacked> source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
new Convolution2PassFilter<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new Convolution2PassProcessor<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
/// <summary>

6
src/ImageSharp/Samplers/Processors/Convolution/GuassianSharpenProcessor.cs

@ -8,11 +8,11 @@ namespace ImageSharp.Processors
using System;
/// <summary>
/// Applies a Gaussian sharpening filter to the image.
/// Applies a Gaussian sharpening sampler to the image.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GuassianSharpenProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class GuassianSharpenProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -85,7 +85,7 @@ namespace ImageSharp.Processors
/// <inheritdoc/>
public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor, TPacked> source, Rectangle targetRectangle, Rectangle sourceRectangle, int startY, int endY)
{
new Convolution2PassFilter<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
new Convolution2PassProcessor<TColor, TPacked>(this.KernelX, this.KernelY).Apply(target, source, targetRectangle, sourceRectangle, startY, endY);
}
/// <summary>

14
src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs → src/ImageSharp/Samplers/Processors/Effects/OilPaintingProcessor.cs

@ -10,20 +10,24 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageSampler{TColor,TPacked}"/> to apply an oil painting effect to an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="IImageSamplingProcessor{TColor,TPacked}"/> to apply an oil painting effect to an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <remarks>Adapted from <see href="https://softwarebydefault.com/2013/06/29/oil-painting-cartoon-filter/"/> by Dewald Esterhuizen.</remarks>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class OilPaintingProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class OilPaintingProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="OilPaintingProcessor{T,TP}"/> class.
/// Initializes a new instance of the <see cref="OilPaintingProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="levels">The number of intensity levels. Higher values result in a broader range of colour intensities forming part of the result image.</param>
/// <param name="brushSize">The number of neighbouring pixels used in calculating each individual pixel value.</param>
/// <param name="levels">
/// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image.
/// </param>
/// <param name="brushSize">
/// The number of neighboring pixels used in calculating each individual pixel value.
/// </param>
public OilPaintingProcessor(int levels, int brushSize)
{
Guard.MustBeGreaterThan(levels, 0, nameof(levels));

10
src/ImageSharp/Samplers/Processors/PixelateProcessor.cs → src/ImageSharp/Samplers/Processors/Effects/PixelateProcesso.cs

@ -1,4 +1,4 @@
// <copyright file="PixelateProcessor.cs" company="James Jackson-South">
// <copyright file="PixelateProcesso.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,22 +10,22 @@ namespace ImageSharp.Processors
using System.Threading.Tasks;
/// <summary>
/// An <see cref="IImageSampler{TColor,TPacked}"/> to pixelate the colors of an <see cref="Image{TColor, TPacked}"/>.
/// An <see cref="ImageSamplingProcessor{TColor,TPacked}"/> to pixelate the colors of an <see cref="Image{TColor, TPacked}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class PixelateProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class PixelateProcesso<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="PixelateProcessor{T,TP}"/> class.
/// Initializes a new instance of the <see cref="PixelateProcesso{TColor,TPacked}"/> class.
/// </summary>
/// <param name="size">The size of the pixels. Must be greater than 0.</param>
/// <exception cref="System.ArgumentException">
/// <paramref name="size"/> is less than 0 or equal to 0.
/// </exception>
public PixelateProcessor(int size)
public PixelateProcesso(int size)
{
Guard.MustBeGreaterThan(size, 0, nameof(size));
this.Value = size;

4
src/ImageSharp/Samplers/Processors/IImageSampler.cs → src/ImageSharp/Samplers/Processors/IImageSamplingProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="IImageSampler.cs" company="James Jackson-South">
// <copyright file="IImageSamplingProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -10,7 +10,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public interface IImageSampler<TColor, TPacked> : IImageProcessor
public interface IImageSamplingProcessor<TColor, TPacked> : IImageProcessor
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Samplers/Processors/ImageSampler.cs → src/ImageSharp/Samplers/Processors/ImageSamplingProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="ImageSampler.cs" company="James Jackson-South">
// <copyright file="ImageSamplingProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -12,7 +12,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class ImageSampler<TColor, TPacked> : ImageProcessor<TColor, TPacked>, IImageSampler<TColor, TPacked>
public abstract class ImageSamplingProcessor<TColor, TPacked> : ImageProcessor<TColor, TPacked>, IImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

4
src/ImageSharp/Samplers/Processors/CompandingResizeProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/CompandingResizeProcessor.cs

@ -1,4 +1,4 @@
// <copyright file="CompandingResizeProcessor.cs" company="James Jackson-South">
// <copyright file="CompandingResizeProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
@ -20,7 +20,7 @@ namespace ImageSharp.Processors
where TPacked : struct
{
/// <summary>
/// Initializes a new instance of the <see cref="CompandingResizeProcessor{TColor, TPacked}"/> class.
/// Initializes a new instance of the <see cref="CompandingResizeProcessor{TColor,TPacked}"/> class.
/// </summary>
/// <param name="sampler">
/// The sampler to perform the resize operation.

2
src/ImageSharp/Samplers/Processors/CropProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/CropProcessor.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class CropProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class CropProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/EntropyCropProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/EntropyCropProcessor.cs

@ -14,7 +14,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class EntropyCropProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class EntropyCropProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/FlipProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/FlipProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class FlipProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public class FlipProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

2
src/ImageSharp/Samplers/Processors/Matrix3x2Processor.cs → src/ImageSharp/Samplers/Processors/Transforms/Matrix3x2Processor.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class Matrix3x2Processor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public abstract class Matrix3x2Processor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{

6
src/ImageSharp/Samplers/Processors/ResamplingWeightedProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/ResamplingWeightedProcessor.cs

@ -13,7 +13,7 @@ namespace ImageSharp.Processors
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public abstract class ResamplingWeightedProcessor<TColor, TPacked> : ImageSampler<TColor, TPacked>
public abstract class ResamplingWeightedProcessor<TColor, TPacked> : ImageSamplingProcessor<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
@ -133,10 +133,10 @@ namespace ImageSharp.Processors
/// <summary>
/// Represents the weight to be added to a scaled pixel.
/// </summary>
protected class Weight
protected struct Weight
{
/// <summary>
/// Initializes a new instance of the <see cref="Weight"/> class.
/// Initializes a new instance of the <see cref="Weight"/> struct.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="value">The value.</param>

2
src/ImageSharp/Samplers/Processors/ResizeProcessor.cs → 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.
/// </summary>
/// <remarks>
/// This version and the <see cref="CompandingResizeProcessor{TColor, TPacked}"/> have been separated out to improve performance.
/// This version and the <see cref="CompandingResizeProcessor{TColor,TPacked}"/> have been separated out to improve performance.
/// </remarks>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>

0
src/ImageSharp/Samplers/Processors/RotateProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/RotateProcessor.cs

0
src/ImageSharp/Samplers/Processors/SkewProcessor.cs → src/ImageSharp/Samplers/Processors/Transforms/SkewProcessor.cs

0
src/ImageSharp/Samplers/AutoOrient.cs → src/ImageSharp/Samplers/Transforms/AutoOrient.cs

0
src/ImageSharp/Samplers/Crop.cs → src/ImageSharp/Samplers/Transforms/Crop.cs

0
src/ImageSharp/Samplers/EntropyCrop.cs → src/ImageSharp/Samplers/Transforms/EntropyCrop.cs

0
src/ImageSharp/Samplers/Flip.cs → src/ImageSharp/Samplers/Transforms/Flip.cs

0
src/ImageSharp/Samplers/Options/AnchorPosition.cs → src/ImageSharp/Samplers/Transforms/Options/AnchorPosition.cs

0
src/ImageSharp/Samplers/Options/FlipType.cs → src/ImageSharp/Samplers/Transforms/Options/FlipType.cs

0
src/ImageSharp/Samplers/Options/Orientation.cs → src/ImageSharp/Samplers/Transforms/Options/Orientation.cs

0
src/ImageSharp/Samplers/Options/ResizeHelper.cs → src/ImageSharp/Samplers/Transforms/Options/ResizeHelper.cs

0
src/ImageSharp/Samplers/Options/ResizeMode.cs → src/ImageSharp/Samplers/Transforms/Options/ResizeMode.cs

0
src/ImageSharp/Samplers/Options/ResizeOptions.cs → src/ImageSharp/Samplers/Transforms/Options/ResizeOptions.cs

0
src/ImageSharp/Samplers/Options/RotateType.cs → src/ImageSharp/Samplers/Transforms/Options/RotateType.cs

0
src/ImageSharp/Samplers/Pad.cs → src/ImageSharp/Samplers/Transforms/Pad.cs

0
src/ImageSharp/Samplers/Resamplers/BicubicResampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/BicubicResampler.cs

2
src/ImageSharp/Samplers/Resamplers/BoxResampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/BoxResampler.cs

@ -6,7 +6,7 @@
namespace ImageSharp
{
/// <summary>
/// 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.
/// </summary>
public class BoxResampler : IResampler

0
src/ImageSharp/Samplers/Resamplers/CatmullRomResampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/CatmullRomResampler.cs

0
src/ImageSharp/Samplers/Resamplers/HermiteResampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/HermiteResampler.cs

0
src/ImageSharp/Samplers/Resamplers/IResampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/IResampler.cs

0
src/ImageSharp/Samplers/Resamplers/Lanczos2Resampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos2Resampler.cs

0
src/ImageSharp/Samplers/Resamplers/Lanczos3Resampler.cs → src/ImageSharp/Samplers/Transforms/Resamplers/Lanczos3Resampler.cs

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save