Browse Source

Normalize parameters across all extension methods

pull/2329/head
James Jackson-South 3 years ago
parent
commit
e9a693b99a
  1. 24
      src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs
  2. 16
      src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs
  3. 32
      src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
  4. 16
      src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs
  5. 18
      src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs
  6. 56
      src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs
  7. 18
      src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs
  8. 18
      src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs
  9. 10
      src/ImageSharp/Processing/Extensions/Convolution/MedianBlurExtensions.cs
  10. 40
      src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs
  11. 18
      src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs
  12. 32
      src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs
  13. 12
      src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs
  14. 10
      src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs
  15. 10
      src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs
  16. 10
      src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs
  17. 10
      src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs
  18. 10
      src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs
  19. 16
      src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs
  20. 10
      src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs
  21. 10
      src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs
  22. 10
      src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs
  23. 8
      src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs
  24. 8
      src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs
  25. 10
      src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs
  26. 8
      src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs
  27. 10
      src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs
  28. 18
      src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs
  29. 10
      src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs
  30. 16
      src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs
  31. 48
      src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs
  32. 40
      src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs
  33. 16
      src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs
  34. 6
      src/ImageSharp/Processing/Extensions/Transforms/AutoOrientExtensions.cs
  35. 10
      src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs
  36. 8
      src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs
  37. 6
      src/ImageSharp/Processing/Extensions/Transforms/FlipExtensions.cs
  38. 8
      src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs
  39. 40
      src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs
  40. 14
      src/ImageSharp/Processing/Extensions/Transforms/RotateExtensions.cs
  41. 6
      src/ImageSharp/Processing/Extensions/Transforms/RotateFlipExtensions.cs
  42. 10
      src/ImageSharp/Processing/Extensions/Transforms/SkewExtensions.cs
  43. 4
      src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs
  44. 62
      src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs

24
src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs

@ -13,61 +13,61 @@ public static class AdaptiveThresholdExtensions
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor());
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="thresholdLimit">Threshold limit (0.0-1.0) to consider for binarization.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, float thresholdLimit)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor(thresholdLimit));
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="upper">Upper (white) color for thresholding.</param>
/// <param name="lower">Lower (black) color for thresholding.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower));
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="upper">Upper (white) color for thresholding.</param>
/// <param name="lower">Lower (black) color for thresholding.</param>
/// <param name="thresholdLimit">Threshold limit (0.0-1.0) to consider for binarization.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, float thresholdLimit)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower, thresholdLimit));
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="upper">Upper (white) color for thresholding.</param>
/// <param name="lower">Lower (black) color for thresholding.</param>
/// <param name="rectangle">Rectangle region to apply the processor on.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, Rectangle rectangle)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower), rectangle);
/// <summary>
/// Applies Bradley Adaptive Threshold to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="upper">Upper (white) color for thresholding.</param>
/// <param name="lower">Lower (black) color for thresholding.</param>
/// <param name="thresholdLimit">Threshold limit (0.0-1.0) to consider for binarization.</param>
/// <param name="rectangle">Rectangle region to apply the processor on.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, float thresholdLimit, Rectangle rectangle)
=> source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower, thresholdLimit), rectangle);
}

16
src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs

@ -14,9 +14,9 @@ public static class BinaryDitherExtensions
/// <summary>
/// Dithers the image reducing it to two colors using ordered dithering.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext
BinaryDither(this IImageProcessingContext source, IDither dither) =>
BinaryDither(source, dither, Color.White, Color.Black);
@ -24,11 +24,11 @@ public static class BinaryDitherExtensions
/// <summary>
/// Dithers the image reducing it to two colors using ordered dithering.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryDither(
this IImageProcessingContext source,
IDither dither,
@ -39,12 +39,12 @@ public static class BinaryDitherExtensions
/// <summary>
/// Dithers the image reducing it to two colors using ordered dithering.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryDither(
this IImageProcessingContext source,
IDither dither,
@ -54,14 +54,14 @@ public static class BinaryDitherExtensions
/// <summary>
/// Dithers the image reducing it to two colors using ordered dithering.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryDither(
this IImageProcessingContext source,
IDither dither,

32
src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs

@ -15,19 +15,19 @@ public static class BinaryThresholdExtensions
/// Applies binarization to the image splitting the pixels at the given threshold with
/// Luminance as the color component to be compared to threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdMode.Luminance));
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -38,12 +38,12 @@ public static class BinaryThresholdExtensions
/// Applies binarization to the image splitting the pixels at the given threshold with
/// Luminance as the color component to be compared to threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -53,13 +53,13 @@ public static class BinaryThresholdExtensions
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -71,11 +71,11 @@ public static class BinaryThresholdExtensions
/// Applies binarization to the image splitting the pixels at the given threshold with
/// Luminance as the color component to be compared to threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -86,12 +86,12 @@ public static class BinaryThresholdExtensions
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -104,14 +104,14 @@ public static class BinaryThresholdExtensions
/// Applies binarization to the image splitting the pixels at the given threshold with
/// Luminance as the color component to be compared to threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
@ -123,7 +123,7 @@ public static class BinaryThresholdExtensions
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
@ -131,7 +131,7 @@ public static class BinaryThresholdExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,

16
src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs

@ -13,44 +13,44 @@ public static class BokehBlurExtensions
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source)
=> source.ApplyProcessor(new BokehBlurProcessor());
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma));
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new BokehBlurProcessor(), rectangle);
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, Rectangle rectangle)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma), rectangle);
}

18
src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -14,36 +14,36 @@ public static class BoxBlurExtensions
/// <summary>
/// Applies a box blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BoxBlur(this IImageProcessingContext source)
=> source.ApplyProcessor(new BoxBlurProcessor());
/// <summary>
/// Applies a box blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius)
=> source.ApplyProcessor(new BoxBlurProcessor(radius));
/// <summary>
/// Applies a box blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle)
=> source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle);
/// <summary>
/// Applies a box blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
@ -54,7 +54,7 @@ public static class BoxBlurExtensions
/// <param name="borderWrapModeY">
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in Y direction.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY)
{
var processor = new BoxBlurProcessor(radius, borderWrapModeX, borderWrapModeY);

56
src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs

@ -14,8 +14,8 @@ public static class DetectEdgesExtensions
/// Detects any edges within the image.
/// Uses the <see cref="KnownEdgeDetectorKernels.Sobel"/> kernel operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source) =>
DetectEdges(source, KnownEdgeDetectorKernels.Sobel);
@ -23,11 +23,11 @@ public static class DetectEdgesExtensions
/// Detects any edges within the image.
/// Uses the <see cref="KnownEdgeDetectorKernels.Sobel"/> kernel operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
Rectangle rectangle) =>
@ -36,9 +36,9 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The 2D edge detector kernel.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetector2DKernel kernel) =>
@ -47,12 +47,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetector2DKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The 2D edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetector2DKernel kernel,
@ -66,12 +66,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The 2D edge detector kernel.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetector2DKernel kernel,
@ -81,7 +81,7 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetector2DKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The 2D edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
@ -89,7 +89,7 @@ public static class DetectEdgesExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetector2DKernel kernel,
@ -104,9 +104,9 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The edge detector kernel.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorKernel kernel) =>
@ -115,12 +115,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetectorKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorKernel kernel,
@ -134,12 +134,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The edge detector kernel.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorKernel kernel,
@ -149,7 +149,7 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetectorKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">The edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
@ -157,7 +157,7 @@ public static class DetectEdgesExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorKernel kernel,
@ -172,9 +172,9 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">Thecompass edge detector kernel.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorCompassKernel kernel) =>
@ -183,12 +183,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetectorCompassKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">Thecompass edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorCompassKernel kernel,
@ -202,12 +202,12 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image operating in grayscale mode.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">Thecompass edge detector kernel.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorCompassKernel kernel,
@ -217,7 +217,7 @@ public static class DetectEdgesExtensions
/// <summary>
/// Detects any edges within the image using a <see cref="EdgeDetectorCompassKernel"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="kernel">Thecompass edge detector kernel.</param>
/// <param name="grayscale">
/// Whether to convert the image to grayscale before performing edge detection.
@ -225,7 +225,7 @@ public static class DetectEdgesExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext DetectEdges(
this IImageProcessingContext source,
EdgeDetectorCompassKernel kernel,

18
src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -14,36 +14,36 @@ public static class GaussianBlurExtensions
/// <summary>
/// Applies a Gaussian blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source)
=> source.ApplyProcessor(new GaussianBlurProcessor());
/// <summary>
/// Applies a Gaussian blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma)
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma));
/// <summary>
/// Applies a Gaussian blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle)
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle);
/// <summary>
/// Applies a Gaussian blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
@ -54,7 +54,7 @@ public static class GaussianBlurExtensions
/// <param name="borderWrapModeY">
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in Y direction.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY)
{
var processor = new GaussianBlurProcessor(sigma, borderWrapModeX, borderWrapModeY);

18
src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -14,29 +14,29 @@ public static class GaussianSharpenExtensions
/// <summary>
/// Applies a Gaussian sharpening filter to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source) =>
source.ApplyProcessor(new GaussianSharpenProcessor());
/// <summary>
/// Applies a Gaussian sharpening filter to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma) =>
source.ApplyProcessor(new GaussianSharpenProcessor(sigma));
/// <summary>
/// Applies a Gaussian sharpening filter to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianSharpen(
this IImageProcessingContext source,
float sigma,
@ -46,7 +46,7 @@ public static class GaussianSharpenExtensions
/// <summary>
/// Applies a Gaussian sharpening filter to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
@ -57,7 +57,7 @@ public static class GaussianSharpenExtensions
/// <param name="borderWrapModeY">
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in Y direction.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY)
{
var processor = new GaussianSharpenProcessor(sigma, borderWrapModeX, borderWrapModeY);

10
src/ImageSharp/Processing/Extensions/Convolution/MedianBlurExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Convolution;
@ -14,19 +14,19 @@ public static class MedianBlurExtensions
/// <summary>
/// Applies a median blur on the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The radius of the area to find the median for.</param>
/// <param name="preserveAlpha">
/// Whether the filter is applied to alpha as well as the color channels.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext MedianBlur(this IImageProcessingContext source, int radius, bool preserveAlpha)
=> source.ApplyProcessor(new MedianBlurProcessor(radius, preserveAlpha));
/// <summary>
/// Applies a median blur on the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The radius of the area to find the median for.</param>
/// <param name="preserveAlpha">
/// Whether the filter is applied to alpha as well as the color channels.
@ -34,7 +34,7 @@ public static class MedianBlurExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext MedianBlur(this IImageProcessingContext source, int radius, bool preserveAlpha, Rectangle rectangle)
=> source.ApplyProcessor(new MedianBlurProcessor(radius, preserveAlpha), rectangle);
}

40
src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs

@ -14,17 +14,17 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to a web-safe palette using <see cref="KnownDitherings.Bayer8x8"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(this IImageProcessingContext source) =>
Dither(source, KnownDitherings.Bayer8x8);
/// <summary>
/// Dithers the image reducing it to a web-safe palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither) =>
@ -33,10 +33,10 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to a web-safe palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="ditherScale">The dithering scale used to adjust the amount of dither.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -46,10 +46,10 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to the given palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="palette">The palette to select substitute colors from.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -59,11 +59,11 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to the given palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="ditherScale">The dithering scale used to adjust the amount of dither.</param>
/// <param name="palette">The palette to select substitute colors from.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -74,23 +74,23 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to a web-safe palette using <see cref="KnownDitherings.Bayer8x8"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(this IImageProcessingContext source, Rectangle rectangle) =>
Dither(source, KnownDitherings.Bayer8x8, rectangle);
/// <summary>
/// Dithers the image reducing it to a web-safe palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -100,13 +100,13 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to a web-safe palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="ditherScale">The dithering scale used to adjust the amount of dither.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -117,13 +117,13 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to the given palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="palette">The palette to select substitute colors from.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,
@ -134,14 +134,14 @@ public static class DitherExtensions
/// <summary>
/// Dithers the image reducing it to the given palette.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="dither">The ordered ditherer.</param>
/// <param name="ditherScale">The dithering scale used to adjust the amount of dither.</param>
/// <param name="palette">The palette to select substitute colors from.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Dither(
this IImageProcessingContext source,
IDither dither,

18
src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Effects;
@ -15,29 +15,29 @@ public static class OilPaintExtensions
/// Alters the colors of the image recreating an oil painting effect with levels and brushSize
/// set to <value>10</value> and <value>15</value> respectively.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext OilPaint(this IImageProcessingContext source) => OilPaint(source, 10, 15);
/// <summary>
/// Alters the colors of the image recreating an oil painting effect with levels and brushSize
/// set to <value>10</value> and <value>15</value> respectively.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext OilPaint(this IImageProcessingContext source, Rectangle rectangle) =>
OilPaint(source, 10, 15, rectangle);
/// <summary>
/// Alters the colors of the image recreating an oil painting effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</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="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext
OilPaint(this IImageProcessingContext source, int levels, int brushSize) =>
source.ApplyProcessor(new OilPaintingProcessor(levels, brushSize));
@ -45,13 +45,13 @@ public static class OilPaintExtensions
/// <summary>
/// Alters the colors of the image recreating an oil painting effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</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>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext OilPaint(
this IImageProcessingContext source,
int levels,

32
src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs

@ -14,88 +14,88 @@ public static class PixelRowDelegateExtensions
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation)
=> ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None);
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers)
=> source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers));
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle)
=> ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None);
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers)
=> source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers), rectangle);
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation)
=> ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None);
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, PixelConversionModifiers modifiers)
=> source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers));
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, Rectangle rectangle)
=> ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None);
/// <summary>
/// Applies a user defined processing delegate to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rowOperation">The user defined processing delegate to use to modify image rows.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation<Point> rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers)
=> source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers), rectangle);
}

12
src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs

@ -14,28 +14,28 @@ public static class PixelateExtensions
/// <summary>
/// Pixelates an image with the given pixel size.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Pixelate(this IImageProcessingContext source) => Pixelate(source, 4);
/// <summary>
/// Pixelates an image with the given pixel size.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="size">The size of the pixels.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Pixelate(this IImageProcessingContext source, int size) =>
source.ApplyProcessor(new PixelateProcessor(size));
/// <summary>
/// Pixelates an image with the given pixel size.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="size">The size of the pixels.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Pixelate(
this IImageProcessingContext source,
int size,

10
src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,19 +14,19 @@ public static class BlackWhiteExtensions
/// <summary>
/// Applies black and white toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BlackWhite(this IImageProcessingContext source)
=> source.ApplyProcessor(new BlackWhiteProcessor());
/// <summary>
/// Applies black and white toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BlackWhite(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new BlackWhiteProcessor(), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -18,9 +18,9 @@ public static class BrightnessExtensions
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing brighter results.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Brightness(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new BrightnessProcessor(amount));
@ -31,12 +31,12 @@ public static class BrightnessExtensions
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing brighter results.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Brightness(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new BrightnessProcessor(amount), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors;
@ -15,21 +15,21 @@ public static class ColorBlindnessExtensions
/// <summary>
/// Applies the given colorblindness simulator to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="colorBlindness">The type of color blindness simulator to apply.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindness)
=> source.ApplyProcessor(GetProcessor(colorBlindness));
/// <summary>
/// Applies the given colorblindness simulator to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="colorBlindnessMode">The type of color blindness simulator to apply.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindnessMode, Rectangle rectangle)
=> source.ApplyProcessor(GetProcessor(colorBlindnessMode), rectangle);

10
src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -18,9 +18,9 @@ public static class ContrastExtensions
/// A value of 0 will create an image that is completely gray. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing results with more contrast.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Contrast(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new ContrastProcessor(amount));
@ -31,12 +31,12 @@ public static class ContrastExtensions
/// A value of 0 will create an image that is completely gray. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing results with more contrast.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Contrast(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new ContrastProcessor(amount), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,21 +14,21 @@ public static class FilterExtensions
/// <summary>
/// Filters an image by the given color matrix
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="matrix">The filter color matrix</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Filter(this IImageProcessingContext source, ColorMatrix matrix)
=> source.ApplyProcessor(new FilterProcessor(matrix));
/// <summary>
/// Filters an image by the given color matrix
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="matrix">The filter color matrix</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Filter(this IImageProcessingContext source, ColorMatrix matrix, Rectangle rectangle)
=> source.ApplyProcessor(new FilterProcessor(matrix), rectangle);
}

16
src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs

@ -15,7 +15,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies <see cref="GrayscaleMode.Bt709"/> grayscale toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Grayscale(this IImageProcessingContext source)
=> Grayscale(source, GrayscaleMode.Bt709);
@ -23,7 +23,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies <see cref="GrayscaleMode.Bt709"/> grayscale toning to the image using the given amount.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Grayscale(this IImageProcessingContext source, float amount)
@ -32,7 +32,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies grayscale toning to the image with the given <see cref="GrayscaleMode"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Grayscale(this IImageProcessingContext source, GrayscaleMode mode)
@ -41,7 +41,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies grayscale toning to the image with the given <see cref="GrayscaleMode"/> using the given amount.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
@ -58,7 +58,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies <see cref="GrayscaleMode.Bt709"/> grayscale toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
@ -69,7 +69,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies <see cref="GrayscaleMode.Bt709"/> grayscale toning to the image using the given amount.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
@ -81,7 +81,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies grayscale toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
@ -93,7 +93,7 @@ public static class GrayscaleExtensions
/// <summary>
/// Applies grayscale toning to the image using the given amount.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="mode">The formula to apply to perform the operation.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <param name="rectangle">

10
src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,21 +14,21 @@ public static class HueExtensions
/// <summary>
/// Alters the hue component of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The rotation angle in degrees to adjust the hue.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees)
=> source.ApplyProcessor(new HueProcessor(degrees));
/// <summary>
/// Alters the hue component of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The rotation angle in degrees to adjust the hue.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees, Rectangle rectangle)
=> source.ApplyProcessor(new HueProcessor(degrees), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,19 +14,19 @@ public static class InvertExtensions
/// <summary>
/// Inverts the colors of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Invert(this IImageProcessingContext source)
=> source.ApplyProcessor(new InvertProcessor(1F));
/// <summary>
/// Inverts the colors of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Invert(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new InvertProcessor(1F), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,19 +14,19 @@ public static class KodachromeExtensions
/// <summary>
/// Alters the colors of the image recreating an old Kodachrome camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Kodachrome(this IImageProcessingContext source)
=> source.ApplyProcessor(new KodachromeProcessor());
/// <summary>
/// Alters the colors of the image recreating an old Kodachrome camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Kodachrome(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new KodachromeProcessor(), rectangle);
}

8
src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs

@ -18,9 +18,9 @@ public static class LightnessExtensions
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing lighter results.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new LightnessProcessor(amount));
@ -31,12 +31,12 @@ public static class LightnessExtensions
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing lighter results.
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new LightnessProcessor(amount), rectangle);
}

8
src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs

@ -14,19 +14,19 @@ public static class LomographExtensions
/// <summary>
/// Alters the colors of the image recreating an old Lomograph camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Lomograph(this IImageProcessingContext source)
=> source.ApplyProcessor(new LomographProcessor(source.GetGraphicsOptions()));
/// <summary>
/// Alters the colors of the image recreating an old Lomograph camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Lomograph(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new LomographProcessor(source.GetGraphicsOptions()), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,21 +14,21 @@ public static class OpacityExtensions
/// <summary>
/// Multiplies the alpha component of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Opacity(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new OpacityProcessor(amount));
/// <summary>
/// Multiplies the alpha component of the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Opacity(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new OpacityProcessor(amount), rectangle);
}

8
src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs

@ -14,19 +14,19 @@ public static class PolaroidExtensions
/// <summary>
/// Alters the colors of the image recreating an old Polaroid camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Polaroid(this IImageProcessingContext source)
=> source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions()));
/// <summary>
/// Alters the colors of the image recreating an old Polaroid camera effect.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Polaroid(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions()), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -18,9 +18,9 @@ public static class SaturateExtensions
/// A value of 0 is completely un-saturated. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of amount over 1 are allowed, providing super-saturated results
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Saturate(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new SaturateProcessor(amount));
@ -31,12 +31,12 @@ public static class SaturateExtensions
/// A value of 0 is completely un-saturated. A value of 1 leaves the input unchanged.
/// Other values are linear multipliers on the effect. Values of amount over 1 are allowed, providing super-saturated results
/// </remarks>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Saturate(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new SaturateProcessor(amount), rectangle);
}

18
src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Filters;
@ -14,40 +14,40 @@ public static class SepiaExtensions
/// <summary>
/// Applies sepia toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Sepia(this IImageProcessingContext source)
=> Sepia(source, 1F);
/// <summary>
/// Applies sepia toning to the image using the given amount.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Sepia(this IImageProcessingContext source, float amount)
=> source.ApplyProcessor(new SepiaProcessor(amount));
/// <summary>
/// Applies sepia toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Sepia(this IImageProcessingContext source, Rectangle rectangle)
=> Sepia(source, 1F, rectangle);
/// <summary>
/// Applies sepia toning to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="amount">The proportion of the conversion. Must be between 0 and 1.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Sepia(this IImageProcessingContext source, float amount, Rectangle rectangle)
=> source.ApplyProcessor(new SepiaProcessor(amount), rectangle);
}

10
src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Normalization;
@ -13,17 +13,17 @@ public static class HistogramEqualizationExtensions
/// <summary>
/// Equalizes the histogram of an image to increases the contrast.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext HistogramEqualization(this IImageProcessingContext source) =>
HistogramEqualization(source, new HistogramEqualizationOptions());
/// <summary>
/// Equalizes the histogram of an image to increases the contrast.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The histogram equalization options to use.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext HistogramEqualization(
this IImageProcessingContext source,
HistogramEqualizationOptions options) =>

16
src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs

@ -14,21 +14,21 @@ public static class BackgroundColorExtensions
/// <summary>
/// Replaces the background color of image with the given one.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the background.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, Color color) =>
BackgroundColor(source, source.GetGraphicsOptions(), color);
/// <summary>
/// Replaces the background color of image with the given one.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the background.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BackgroundColor(
this IImageProcessingContext source,
Color color,
@ -38,10 +38,10 @@ public static class BackgroundColorExtensions
/// <summary>
/// Replaces the background color of image with the given one.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the background.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BackgroundColor(
this IImageProcessingContext source,
GraphicsOptions options,
@ -51,13 +51,13 @@ public static class BackgroundColorExtensions
/// <summary>
/// Replaces the background color of image with the given one.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the background.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext BackgroundColor(
this IImageProcessingContext source,
GraphicsOptions options,

48
src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs

@ -14,17 +14,17 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(this IImageProcessingContext source) =>
Glow(source, source.GetGraphicsOptions());
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the glow.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(this IImageProcessingContext source, Color color)
{
return Glow(source, source.GetGraphicsOptions(), color);
@ -33,33 +33,33 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius) =>
Glow(source, source.GetGraphicsOptions(), radius);
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle) =>
source.Glow(source.GetGraphicsOptions(), rectangle);
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(
this IImageProcessingContext source,
Color color,
@ -70,19 +70,19 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options) =>
source.Glow(options, Color.Black, ValueSize.PercentageOfWidth(0.5f));
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,
@ -92,10 +92,10 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,
@ -105,12 +105,12 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,
@ -120,14 +120,14 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,
@ -139,14 +139,14 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
private static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,
@ -158,11 +158,11 @@ public static class GlowExtensions
/// <summary>
/// Applies a radial glow effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting things like blending.</param>
/// <param name="color">The color to set as the glow.</param>
/// <param name="radius">The the radius.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
private static IImageProcessingContext Glow(
this IImageProcessingContext source,
GraphicsOptions options,

40
src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs

@ -14,27 +14,27 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(this IImageProcessingContext source) =>
Vignette(source, source.GetGraphicsOptions());
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(this IImageProcessingContext source, Color color) =>
Vignette(source, source.GetGraphicsOptions(), color);
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="radiusX">The the x-radius.</param>
/// <param name="radiusY">The the y-radius.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
float radiusX,
@ -44,25 +44,25 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle) =>
Vignette(source, source.GetGraphicsOptions(), rectangle);
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <param name="radiusX">The the x-radius.</param>
/// <param name="radiusY">The the y-radius.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
Color color,
@ -74,9 +74,9 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options) =>
source.VignetteInternal(
options,
@ -87,10 +87,10 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
GraphicsOptions options,
@ -104,11 +104,11 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="radiusX">The the x-radius.</param>
/// <param name="radiusY">The the y-radius.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
GraphicsOptions options,
@ -119,12 +119,12 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
GraphicsOptions options,
@ -139,7 +139,7 @@ public static class VignetteExtensions
/// <summary>
/// Applies a radial vignette effect to an image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The options effecting pixel blending.</param>
/// <param name="color">The color to set as the vignette.</param>
/// <param name="radiusX">The the x-radius.</param>
@ -147,7 +147,7 @@ public static class VignetteExtensions
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Vignette(
this IImageProcessingContext source,
GraphicsOptions options,

16
src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs

@ -14,40 +14,40 @@ public static class QuantizeExtensions
/// <summary>
/// Applies quantization to the image using the <see cref="OctreeQuantizer"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Quantize(this IImageProcessingContext source) =>
Quantize(source, KnownQuantizers.Octree);
/// <summary>
/// Applies quantization to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="quantizer">The quantizer to apply to perform the operation.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Quantize(this IImageProcessingContext source, IQuantizer quantizer) =>
source.ApplyProcessor(new QuantizeProcessor(quantizer));
/// <summary>
/// Applies quantization to the image using the <see cref="OctreeQuantizer"/>.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Quantize(this IImageProcessingContext source, Rectangle rectangle) =>
Quantize(source, KnownQuantizers.Octree, rectangle);
/// <summary>
/// Applies quantization to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="quantizer">The quantizer to apply to perform the operation.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Quantize(this IImageProcessingContext source, IQuantizer quantizer, Rectangle rectangle) =>
source.ApplyProcessor(new QuantizeProcessor(quantizer), rectangle);
}

6
src/ImageSharp/Processing/Extensions/Transforms/AutoOrientExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
@ -14,8 +14,8 @@ public static class AutoOrientExtensions
/// <summary>
/// Adjusts an image so that its orientation is suitable for viewing. Adjustments are based on EXIF metadata embedded in the image.
/// </summary>
/// <param name="source">The image to auto rotate.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext AutoOrient(this IImageProcessingContext source)
=> source.ApplyProcessor(new AutoOrientProcessor());
}

10
src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
@ -14,21 +14,21 @@ public static class CropExtensions
/// <summary>
/// Crops an image to the given width and height.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Crop(this IImageProcessingContext source, int width, int height) =>
Crop(source, new Rectangle(0, 0, width, height));
/// <summary>
/// Crops an image to the given rectangle.
/// </summary>
/// <param name="source">The image to crop.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="cropRectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to retain.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Crop(this IImageProcessingContext source, Rectangle cropRectangle) =>
source.ApplyProcessor(new CropProcessor(cropRectangle, source.GetCurrentSize()));
}

8
src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs

@ -14,17 +14,17 @@ public static class EntropyCropExtensions
/// <summary>
/// Crops an image to the area of greatest entropy using a threshold for entropic density of <value>.5F</value>.
/// </summary>
/// <param name="source">The image to crop.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <param name="source">The current image processing context.</param>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source) =>
source.ApplyProcessor(new EntropyCropProcessor());
/// <summary>
/// Crops an image to the area of greatest entropy.
/// </summary>
/// <param name="source">The image to crop.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="threshold">The threshold for entropic density.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source, float threshold) =>
source.ApplyProcessor(new EntropyCropProcessor(threshold));
}

6
src/ImageSharp/Processing/Extensions/Transforms/FlipExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
@ -14,9 +14,9 @@ public static class FlipExtensions
/// <summary>
/// Flips an image by the given instructions.
/// </summary>
/// <param name="source">The image to rotate, flip, or both.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="flipMode">The <see cref="FlipMode"/> to perform the flip.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Flip(this IImageProcessingContext source, FlipMode flipMode)
=> source.ApplyProcessor(new FlipProcessor(flipMode));
}

8
src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs

@ -12,21 +12,21 @@ public static class PadExtensions
/// <summary>
/// Evenly pads an image to fit the new dimensions.
/// </summary>
/// <param name="source">The source image to pad.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The new width.</param>
/// <param name="height">The new height.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Pad(this IImageProcessingContext source, int width, int height)
=> source.Pad(width, height, default);
/// <summary>
/// Evenly pads an image to fit the new dimensions with the given background color.
/// </summary>
/// <param name="source">The source image to pad.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The new width.</param>
/// <param name="height">The new height.</param>
/// <param name="color">The background color with which to pad the image.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Pad(this IImageProcessingContext source, int width, int height, Color color)
{
Size size = source.GetCurrentSize();

40
src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs

@ -14,9 +14,9 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given <see cref="Size"/>.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="size">The target image size.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size)
=> Resize(source, size.Width, size.Height, KnownResamplers.Bicubic, false);
@ -24,10 +24,10 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given <see cref="Size"/>.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="size">The target image size.</param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, bool compand)
=> Resize(source, size.Width, size.Height, KnownResamplers.Bicubic, compand);
@ -35,10 +35,10 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height)
=> Resize(source, width, height, KnownResamplers.Bicubic, false);
@ -46,11 +46,11 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, bool compand)
=> Resize(source, width, height, KnownResamplers.Bicubic, compand);
@ -58,11 +58,11 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler)
=> Resize(source, width, height, sampler, false);
@ -70,11 +70,11 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="size">The target image size.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, Size size, IResampler sampler, bool compand)
=> Resize(source, size.Width, size.Height, sampler, new Rectangle(0, 0, size.Width, size.Height), compand);
@ -82,12 +82,12 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height with the given sampler.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, int width, int height, IResampler sampler, bool compand)
=> Resize(source, width, height, sampler, new Rectangle(0, 0, width, height), compand);
@ -96,7 +96,7 @@ public static class ResizeExtensions
/// Resizes an image to the given width and height with the given sampler and
/// source rectangle.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
@ -107,7 +107,7 @@ public static class ResizeExtensions
/// The <see cref="Rectangle"/> structure that specifies the portion of the target image object to draw to.
/// </param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(
this IImageProcessingContext source,
@ -133,7 +133,7 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image to the given width and height with the given sampler and source rectangle.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="width">The target image width.</param>
/// <param name="height">The target image height.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
@ -141,7 +141,7 @@ public static class ResizeExtensions
/// The <see cref="Rectangle"/> structure that specifies the portion of the target image object to draw to.
/// </param>
/// <param name="compand">Whether to compress and expand the image color-space to gamma correct the image during processing.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(
this IImageProcessingContext source,
@ -166,9 +166,9 @@ public static class ResizeExtensions
/// <summary>
/// Resizes an image in accordance with the given <see cref="ResizeOptions"/>.
/// </summary>
/// <param name="source">The image to resize.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="options">The resize options.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
/// <remarks>Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image or the nearest possible ratio.</remarks>
public static IImageProcessingContext Resize(this IImageProcessingContext source, ResizeOptions options)
=> source.ApplyProcessor(new ResizeProcessor(options, source.GetCurrentSize()));

14
src/ImageSharp/Processing/Extensions/Transforms/RotateExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
@ -14,28 +14,28 @@ public static class RotateExtensions
/// <summary>
/// Rotates and flips an image by the given instructions.
/// </summary>
/// <param name="source">The image to rotate.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rotateMode">The <see cref="RotateMode"/> to perform the rotation.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Rotate(this IImageProcessingContext source, RotateMode rotateMode) =>
Rotate(source, (float)rotateMode);
/// <summary>
/// Rotates an image by the given angle in degrees.
/// </summary>
/// <param name="source">The image to rotate.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The angle in degrees to perform the rotation.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Rotate(this IImageProcessingContext source, float degrees) =>
Rotate(source, degrees, KnownResamplers.Bicubic);
/// <summary>
/// Rotates an image by the given angle in degrees using the specified sampling algorithm.
/// </summary>
/// <param name="source">The image to rotate.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degrees">The angle in degrees to perform the rotation.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Rotate(
this IImageProcessingContext source,
float degrees,

6
src/ImageSharp/Processing/Extensions/Transforms/RotateFlipExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Processing;
@ -12,10 +12,10 @@ public static class RotateFlipExtensions
/// <summary>
/// Rotates and flips an image by the given instructions.
/// </summary>
/// <param name="source">The image to rotate, flip, or both.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="rotateMode">The <see cref="RotateMode"/> to perform the rotation.</param>
/// <param name="flipMode">The <see cref="FlipMode"/> to perform the flip.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext RotateFlip(this IImageProcessingContext source, RotateMode rotateMode, FlipMode flipMode)
=> source.Rotate(rotateMode).Flip(flipMode);
}

10
src/ImageSharp/Processing/Extensions/Transforms/SkewExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing.Processors.Transforms;
@ -14,10 +14,10 @@ public static class SkewExtensions
/// <summary>
/// Skews an image by the given angles in degrees.
/// </summary>
/// <param name="source">The image to skew.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degreesX">The angle in degrees to perform the skew along the x-axis.</param>
/// <param name="degreesY">The angle in degrees to perform the skew along the y-axis.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext
Skew(this IImageProcessingContext source, float degreesX, float degreesY) =>
Skew(source, degreesX, degreesY, KnownResamplers.Bicubic);
@ -25,11 +25,11 @@ public static class SkewExtensions
/// <summary>
/// Skews an image by the given angles in degrees using the specified sampling algorithm.
/// </summary>
/// <param name="source">The image to skew.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="degreesX">The angle in degrees to perform the skew along the x-axis.</param>
/// <param name="degreesY">The angle in degrees to perform the skew along the y-axis.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Skew(
this IImageProcessingContext source,
float degreesX,

4
src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs

@ -13,10 +13,10 @@ public static class SwizzleExtensions
/// <summary>
/// Swizzles an image.
/// </summary>
/// <param name="source">The image to swizzle.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="swizzler">The swizzler function.</param>
/// <typeparam name="TSwizzler">The swizzler function type.</typeparam>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Swizzle<TSwizzler>(this IImageProcessingContext source, TSwizzler swizzler)
where TSwizzler : struct, ISwizzler
=> source.ApplyProcessor(new SwizzleProcessor<TSwizzler>(swizzler));

62
src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Numerics;
@ -15,9 +15,9 @@ public static class TransformExtensions
/// <summary>
/// Performs an affine transform of an image.
/// </summary>
/// <param name="source">The image to transform.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="builder">The affine transform builder.</param>
/// <returns>The <see cref="Image{TPixel}"/></returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext source,
AffineTransformBuilder builder) =>
@ -26,62 +26,60 @@ public static class TransformExtensions
/// <summary>
/// Performs an affine transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="builder">The affine transform builder.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
AffineTransformBuilder builder,
IResampler sampler) =>
ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);
source.Transform(new Rectangle(Point.Empty, source.GetCurrentSize()), builder, sampler);
/// <summary>
/// Performs an affine transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sourceRectangle">The source rectangle</param>
/// <param name="builder">The affine transform builder.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
Rectangle sourceRectangle,
AffineTransformBuilder builder,
IResampler sampler)
{
Matrix3x2 transform = builder.BuildMatrix(sourceRectangle);
Size targetDimensions = TransformUtils.GetTransformedSize(sourceRectangle.Size, transform);
return ctx.Transform(sourceRectangle, transform, targetDimensions, sampler);
return source.Transform(sourceRectangle, transform, targetDimensions, sampler);
}
/// <summary>
/// Performs an affine transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sourceRectangle">The source rectangle</param>
/// <param name="transform">The transformation matrix.</param>
/// <param name="targetDimensions">The size of the result image.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
Rectangle sourceRectangle,
Matrix3x2 transform,
Size targetDimensions,
IResampler sampler)
{
return ctx.ApplyProcessor(
=> source.ApplyProcessor(
new AffineTransformProcessor(transform, sampler, targetDimensions),
sourceRectangle);
}
/// <summary>
/// Performs a projective transform of an image.
/// </summary>
/// <param name="source">The image to transform.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="builder">The affine transform builder.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext source,
ProjectiveTransformBuilder builder) =>
@ -90,53 +88,51 @@ public static class TransformExtensions
/// <summary>
/// Performs a projective transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="builder">The projective transform builder.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
ProjectiveTransformBuilder builder,
IResampler sampler) =>
ctx.Transform(new Rectangle(Point.Empty, ctx.GetCurrentSize()), builder, sampler);
source.Transform(new Rectangle(Point.Empty, source.GetCurrentSize()), builder, sampler);
/// <summary>
/// Performs a projective transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sourceRectangle">The source rectangle</param>
/// <param name="builder">The projective transform builder.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
Rectangle sourceRectangle,
ProjectiveTransformBuilder builder,
IResampler sampler)
{
Matrix4x4 transform = builder.BuildMatrix(sourceRectangle);
Size targetDimensions = TransformUtils.GetTransformedSize(sourceRectangle.Size, transform);
return ctx.Transform(sourceRectangle, transform, targetDimensions, sampler);
return source.Transform(sourceRectangle, transform, targetDimensions, sampler);
}
/// <summary>
/// Performs a projective transform of an image using the specified sampling algorithm.
/// </summary>
/// <param name="ctx">The <see cref="IImageProcessingContext"/>.</param>
/// <param name="source">The current image processing context.</param>
/// <param name="sourceRectangle">The source rectangle</param>
/// <param name="transform">The transformation matrix.</param>
/// <param name="targetDimensions">The size of the result image.</param>
/// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
public static IImageProcessingContext Transform(
this IImageProcessingContext ctx,
this IImageProcessingContext source,
Rectangle sourceRectangle,
Matrix4x4 transform,
Size targetDimensions,
IResampler sampler)
{
return ctx.ApplyProcessor(
=> source.ApplyProcessor(
new ProjectiveTransformProcessor(transform, sampler, targetDimensions),
sourceRectangle);
}
}

Loading…
Cancel
Save