From e9a693b99aafb03a39e89f860a3ed55e64c18c2b Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 26 Jan 2023 18:08:53 +1000 Subject: [PATCH 1/9] Normalize parameters across all extension methods --- .../Processing/AdaptiveThresholdExtensions.cs | 24 +++---- .../Binarization/BinaryDitherExtensions.cs | 16 ++--- .../Binarization/BinaryThresholdExtensions.cs | 32 +++++----- .../Convolution/BokehBlurExtensions.cs | 16 ++--- .../Convolution/BoxBlurExtensions.cs | 18 +++--- .../Convolution/DetectEdgesExtensions.cs | 56 ++++++++--------- .../Convolution/GaussianBlurExtensions.cs | 18 +++--- .../Convolution/GaussianSharpenExtensions.cs | 18 +++--- .../Convolution/MedianBlurExtensions.cs | 10 +-- .../Extensions/Dithering/DitherExtensions.cs | 40 ++++++------ .../Extensions/Effects/OilPaintExtensions.cs | 18 +++--- .../Effects/PixelRowDelegateExtensions.cs | 32 +++++----- .../Extensions/Effects/PixelateExtensions.cs | 12 ++-- .../Filters/BlackWhiteExtensions.cs | 10 +-- .../Filters/BrightnessExtensions.cs | 10 +-- .../Filters/ColorBlindnessExtensions.cs | 10 +-- .../Extensions/Filters/ContrastExtensions.cs | 10 +-- .../Extensions/Filters/FilterExtensions.cs | 10 +-- .../Extensions/Filters/GrayscaleExtensions.cs | 16 ++--- .../Extensions/Filters/HueExtensions.cs | 10 +-- .../Extensions/Filters/InvertExtensions.cs | 10 +-- .../Filters/KodachromeExtensions.cs | 10 +-- .../Extensions/Filters/LightnessExtensions.cs | 8 +-- .../Extensions/Filters/LomographExtensions.cs | 8 +-- .../Extensions/Filters/OpacityExtensions.cs | 10 +-- .../Extensions/Filters/PolaroidExtensions.cs | 8 +-- .../Extensions/Filters/SaturateExtensions.cs | 10 +-- .../Extensions/Filters/SepiaExtensions.cs | 18 +++--- .../HistogramEqualizationExtensions.cs | 10 +-- .../Overlays/BackgroundColorExtensions.cs | 16 ++--- .../Extensions/Overlays/GlowExtensions.cs | 48 +++++++------- .../Extensions/Overlays/VignetteExtensions.cs | 40 ++++++------ .../Quantization/QuantizeExtensions.cs | 16 ++--- .../Transforms/AutoOrientExtensions.cs | 6 +- .../Extensions/Transforms/CropExtensions.cs | 10 +-- .../Transforms/EntropyCropExtensions.cs | 8 +-- .../Extensions/Transforms/FlipExtensions.cs | 6 +- .../Extensions/Transforms/PadExtensions.cs | 8 +-- .../Extensions/Transforms/ResizeExtensions.cs | 40 ++++++------ .../Extensions/Transforms/RotateExtensions.cs | 14 ++--- .../Transforms/RotateFlipExtensions.cs | 6 +- .../Extensions/Transforms/SkewExtensions.cs | 10 +-- .../Transforms/SwizzleExtensions.cs | 4 +- .../Transforms/TransformExtensions.cs | 62 +++++++++---------- 44 files changed, 384 insertions(+), 388 deletions(-) diff --git a/src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs b/src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs index fce2f574db..d008d1f67e 100644 --- a/src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs +++ b/src/ImageSharp/Processing/AdaptiveThresholdExtensions.cs @@ -13,61 +13,61 @@ public static class AdaptiveThresholdExtensions /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. - /// The . + /// The current image processing context. + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source) => source.ApplyProcessor(new AdaptiveThresholdProcessor()); /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. + /// The current image processing context. /// Threshold limit (0.0-1.0) to consider for binarization. - /// The . + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, float thresholdLimit) => source.ApplyProcessor(new AdaptiveThresholdProcessor(thresholdLimit)); /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. + /// The current image processing context. /// Upper (white) color for thresholding. /// Lower (black) color for thresholding. - /// The . + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower) => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower)); /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. + /// The current image processing context. /// Upper (white) color for thresholding. /// Lower (black) color for thresholding. /// Threshold limit (0.0-1.0) to consider for binarization. - /// The . + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, float thresholdLimit) => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower, thresholdLimit)); /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. + /// The current image processing context. /// Upper (white) color for thresholding. /// Lower (black) color for thresholding. /// Rectangle region to apply the processor on. - /// The . + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, Rectangle rectangle) => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower), rectangle); /// /// Applies Bradley Adaptive Threshold to the image. /// - /// The image this method extends. + /// The current image processing context. /// Upper (white) color for thresholding. /// Lower (black) color for thresholding. /// Threshold limit (0.0-1.0) to consider for binarization. /// Rectangle region to apply the processor on. - /// The . + /// The . public static IImageProcessingContext AdaptiveThreshold(this IImageProcessingContext source, Color upper, Color lower, float thresholdLimit, Rectangle rectangle) => source.ApplyProcessor(new AdaptiveThresholdProcessor(upper, lower, thresholdLimit), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs index 887455b821..e490cdf85f 100644 --- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Binarization/BinaryDitherExtensions.cs @@ -14,9 +14,9 @@ public static class BinaryDitherExtensions /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryDither(this IImageProcessingContext source, IDither dither) => BinaryDither(source, dither, Color.White, Color.Black); @@ -24,11 +24,11 @@ public static class BinaryDitherExtensions /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryDither( this IImageProcessingContext source, IDither dither, @@ -39,12 +39,12 @@ public static class BinaryDitherExtensions /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryDither( this IImageProcessingContext source, IDither dither, @@ -54,14 +54,14 @@ public static class BinaryDitherExtensions /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryDither( this IImageProcessingContext source, IDither dither, diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs index 802ad06d75..815b059cf5 100644 --- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs +++ b/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. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold) => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdMode.Luminance)); /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// Selects the value to be compared to threshold. - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryThreshold( this IImageProcessingContext source, float threshold, @@ -53,13 +53,13 @@ public static class BinaryThresholdExtensions /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// Selects the value to be compared to threshold. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryThreshold( this IImageProcessingContext source, float threshold, @@ -86,12 +86,12 @@ public static class BinaryThresholdExtensions /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold /// Selects the value to be compared to threshold. - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryThreshold( this IImageProcessingContext source, float threshold, @@ -123,7 +123,7 @@ public static class BinaryThresholdExtensions /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The image this method extends. + /// The current image processing context. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// The color to use for pixels that are above the threshold. /// The color to use for pixels that are below the threshold @@ -131,7 +131,7 @@ public static class BinaryThresholdExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BinaryThreshold( this IImageProcessingContext source, float threshold, diff --git a/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs index 1688e5cc76..e3e6f13ed6 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs @@ -13,44 +13,44 @@ public static class BokehBlurExtensions /// /// Applies a bokeh blur to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext BokehBlur(this IImageProcessingContext source) => source.ApplyProcessor(new BokehBlurProcessor()); /// /// Applies a bokeh blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'radius' value representing the size of the area to sample. /// The 'components' value representing the number of kernels to use to approximate the bokeh effect. /// The gamma highlight factor to use to emphasize bright spots in the source image - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma) => source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma)); /// /// Applies a bokeh blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new BokehBlurProcessor(), rectangle); /// /// Applies a bokeh blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'radius' value representing the size of the area to sample. /// The 'components' value representing the number of kernels to use to approximate the bokeh effect. /// The gamma highlight factor to use to emphasize bright spots in the source image /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, Rectangle rectangle) => source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs index 85b4888f0d..6611af742b 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs +++ b/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 /// /// Applies a box blur to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext BoxBlur(this IImageProcessingContext source) => source.ApplyProcessor(new BoxBlurProcessor()); /// /// Applies a box blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'radius' value representing the size of the area to sample. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius) => source.ApplyProcessor(new BoxBlurProcessor(radius)); /// /// Applies a box blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'radius' value representing the size of the area to sample. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle) => source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle); /// /// Applies a box blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'radius' value representing the size of the area to sample. /// /// The structure that specifies the portion of the image object to alter. @@ -54,7 +54,7 @@ public static class BoxBlurExtensions /// /// The to use when mapping the pixels outside of the border, in Y direction. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY) { var processor = new BoxBlurProcessor(radius, borderWrapModeX, borderWrapModeY); diff --git a/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs index 7f57ae9837..b044c3966f 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs @@ -14,8 +14,8 @@ public static class DetectEdgesExtensions /// Detects any edges within the image. /// Uses the kernel operating in grayscale mode. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . 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 kernel operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, Rectangle rectangle) => @@ -36,9 +36,9 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// The 2D edge detector kernel. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetector2DKernel kernel) => @@ -47,12 +47,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// The 2D edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetector2DKernel kernel, @@ -66,12 +66,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// The 2D edge detector kernel. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetector2DKernel kernel, @@ -81,7 +81,7 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// The 2D edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. @@ -89,7 +89,7 @@ public static class DetectEdgesExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetector2DKernel kernel, @@ -104,9 +104,9 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// The edge detector kernel. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorKernel kernel) => @@ -115,12 +115,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// The edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorKernel kernel, @@ -134,12 +134,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// The edge detector kernel. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorKernel kernel, @@ -149,7 +149,7 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// The edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. @@ -157,7 +157,7 @@ public static class DetectEdgesExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorKernel kernel, @@ -172,9 +172,9 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// Thecompass edge detector kernel. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorCompassKernel kernel) => @@ -183,12 +183,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// Thecompass edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorCompassKernel kernel, @@ -202,12 +202,12 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image operating in grayscale mode. /// - /// The image this method extends. + /// The current image processing context. /// Thecompass edge detector kernel. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorCompassKernel kernel, @@ -217,7 +217,7 @@ public static class DetectEdgesExtensions /// /// Detects any edges within the image using a . /// - /// The image this method extends. + /// The current image processing context. /// Thecompass edge detector kernel. /// /// Whether to convert the image to grayscale before performing edge detection. @@ -225,7 +225,7 @@ public static class DetectEdgesExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext DetectEdges( this IImageProcessingContext source, EdgeDetectorCompassKernel kernel, diff --git a/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs index 9ea4e24af4..b851482008 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs +++ b/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 /// /// Applies a Gaussian blur to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source) => source.ApplyProcessor(new GaussianBlurProcessor()); /// /// Applies a Gaussian blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma) => source.ApplyProcessor(new GaussianBlurProcessor(sigma)); /// /// Applies a Gaussian blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle) => source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle); /// /// Applies a Gaussian blur to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. @@ -54,7 +54,7 @@ public static class GaussianBlurExtensions /// /// The to use when mapping the pixels outside of the border, in Y direction. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY) { var processor = new GaussianBlurProcessor(sigma, borderWrapModeX, borderWrapModeY); diff --git a/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs index 70b8e6f439..4a94df0963 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/GaussianSharpenExtensions.cs +++ b/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 /// /// Applies a Gaussian sharpening filter to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source) => source.ApplyProcessor(new GaussianSharpenProcessor()); /// /// Applies a Gaussian sharpening filter to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma) => source.ApplyProcessor(new GaussianSharpenProcessor(sigma)); /// /// Applies a Gaussian sharpening filter to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianSharpen( this IImageProcessingContext source, float sigma, @@ -46,7 +46,7 @@ public static class GaussianSharpenExtensions /// /// Applies a Gaussian sharpening filter to the image. /// - /// The image this method extends. + /// The current image processing context. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. @@ -57,7 +57,7 @@ public static class GaussianSharpenExtensions /// /// The to use when mapping the pixels outside of the border, in Y direction. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext GaussianSharpen(this IImageProcessingContext source, float sigma, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY) { var processor = new GaussianSharpenProcessor(sigma, borderWrapModeX, borderWrapModeY); diff --git a/src/ImageSharp/Processing/Extensions/Convolution/MedianBlurExtensions.cs b/src/ImageSharp/Processing/Extensions/Convolution/MedianBlurExtensions.cs index 60a80d35e5..a08a398b75 100644 --- a/src/ImageSharp/Processing/Extensions/Convolution/MedianBlurExtensions.cs +++ b/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 /// /// Applies a median blur on the image. /// - /// The image this method extends. + /// The current image processing context. /// The radius of the area to find the median for. /// /// Whether the filter is applied to alpha as well as the color channels. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext MedianBlur(this IImageProcessingContext source, int radius, bool preserveAlpha) => source.ApplyProcessor(new MedianBlurProcessor(radius, preserveAlpha)); /// /// Applies a median blur on the image. /// - /// The image this method extends. + /// The current image processing context. /// The radius of the area to find the median for. /// /// Whether the filter is applied to alpha as well as the color channels. @@ -34,7 +34,7 @@ public static class MedianBlurExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext MedianBlur(this IImageProcessingContext source, int radius, bool preserveAlpha, Rectangle rectangle) => source.ApplyProcessor(new MedianBlurProcessor(radius, preserveAlpha), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs b/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs index 3eaeb715d3..fbeddb479d 100644 --- a/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Dithering/DitherExtensions.cs @@ -14,17 +14,17 @@ public static class DitherExtensions /// /// Dithers the image reducing it to a web-safe palette using . /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Dither(this IImageProcessingContext source) => Dither(source, KnownDitherings.Bayer8x8); /// /// Dithers the image reducing it to a web-safe palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither) => @@ -33,10 +33,10 @@ public static class DitherExtensions /// /// Dithers the image reducing it to a web-safe palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The dithering scale used to adjust the amount of dither. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -46,10 +46,10 @@ public static class DitherExtensions /// /// Dithers the image reducing it to the given palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The palette to select substitute colors from. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -59,11 +59,11 @@ public static class DitherExtensions /// /// Dithers the image reducing it to the given palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The dithering scale used to adjust the amount of dither. /// The palette to select substitute colors from. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -74,23 +74,23 @@ public static class DitherExtensions /// /// Dithers the image reducing it to a web-safe palette using . /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither(this IImageProcessingContext source, Rectangle rectangle) => Dither(source, KnownDitherings.Bayer8x8, rectangle); /// /// Dithers the image reducing it to a web-safe palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -100,13 +100,13 @@ public static class DitherExtensions /// /// Dithers the image reducing it to a web-safe palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The dithering scale used to adjust the amount of dither. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -117,13 +117,13 @@ public static class DitherExtensions /// /// Dithers the image reducing it to the given palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The palette to select substitute colors from. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, @@ -134,14 +134,14 @@ public static class DitherExtensions /// /// Dithers the image reducing it to the given palette. /// - /// The image this method extends. + /// The current image processing context. /// The ordered ditherer. /// The dithering scale used to adjust the amount of dither. /// The palette to select substitute colors from. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Dither( this IImageProcessingContext source, IDither dither, diff --git a/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs index e29b39478f..2c8d76c831 100644 --- a/src/ImageSharp/Processing/Extensions/Effects/OilPaintExtensions.cs +++ b/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 10 and 15 respectively. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext OilPaint(this IImageProcessingContext source) => OilPaint(source, 10, 15); /// /// Alters the colors of the image recreating an oil painting effect with levels and brushSize /// set to 10 and 15 respectively. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext OilPaint(this IImageProcessingContext source, Rectangle rectangle) => OilPaint(source, 10, 15, rectangle); /// /// Alters the colors of the image recreating an oil painting effect. /// - /// The image this method extends. + /// The current image processing context. /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. /// The number of neighboring pixels used in calculating each individual pixel value. - /// The to allow chaining of operations. + /// The . 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 /// /// Alters the colors of the image recreating an oil painting effect. /// - /// The image this method extends. + /// The current image processing context. /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. /// The number of neighboring pixels used in calculating each individual pixel value. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext OilPaint( this IImageProcessingContext source, int levels, diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs index e7b5d7623e..703b1b2fbb 100644 --- a/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Effects/PixelRowDelegateExtensions.cs @@ -14,88 +14,88 @@ public static class PixelRowDelegateExtensions /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation) => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// The to apply during the pixel conversions. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers) => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers)); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle) => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// /// The structure that specifies the portion of the image object to alter. /// /// The to apply during the pixel conversions. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers) => source.ApplyProcessor(new PixelRowDelegateProcessor(rowOperation, modifiers), rectangle); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation) => ProcessPixelRowsAsVector4(source, rowOperation, PixelConversionModifiers.None); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// The to apply during the pixel conversions. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, PixelConversionModifiers modifiers) => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers)); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle) => ProcessPixelRowsAsVector4(source, rowOperation, rectangle, PixelConversionModifiers.None); /// /// Applies a user defined processing delegate to the image. /// - /// The image this method extends. + /// The current image processing context. /// The user defined processing delegate to use to modify image rows. /// /// The structure that specifies the portion of the image object to alter. /// /// The to apply during the pixel conversions. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ProcessPixelRowsAsVector4(this IImageProcessingContext source, PixelRowOperation rowOperation, Rectangle rectangle, PixelConversionModifiers modifiers) => source.ApplyProcessor(new PositionAwarePixelRowDelegateProcessor(rowOperation, modifiers), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs b/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs index 17654a2061..584887ea17 100644 --- a/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Effects/PixelateExtensions.cs @@ -14,28 +14,28 @@ public static class PixelateExtensions /// /// Pixelates an image with the given pixel size. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Pixelate(this IImageProcessingContext source) => Pixelate(source, 4); /// /// Pixelates an image with the given pixel size. /// - /// The image this method extends. + /// The current image processing context. /// The size of the pixels. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Pixelate(this IImageProcessingContext source, int size) => source.ApplyProcessor(new PixelateProcessor(size)); /// /// Pixelates an image with the given pixel size. /// - /// The image this method extends. + /// The current image processing context. /// The size of the pixels. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Pixelate( this IImageProcessingContext source, int size, diff --git a/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs index 54f2d2143e..8e44928f9e 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/BlackWhiteExtensions.cs +++ b/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 /// /// Applies black and white toning to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext BlackWhite(this IImageProcessingContext source) => source.ApplyProcessor(new BlackWhiteProcessor()); /// /// Applies black and white toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BlackWhite(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new BlackWhiteProcessor(), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs index e53f22040f..35140c2140 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/BrightnessExtensions.cs +++ b/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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Brightness(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new BrightnessProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs index 73c3c29a91..ed1c07a431 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/ColorBlindnessExtensions.cs +++ b/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 /// /// Applies the given colorblindness simulator to the image. /// - /// The image this method extends. + /// The current image processing context. /// The type of color blindness simulator to apply. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindness) => source.ApplyProcessor(GetProcessor(colorBlindness)); /// /// Applies the given colorblindness simulator to the image. /// - /// The image this method extends. + /// The current image processing context. /// The type of color blindness simulator to apply. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext ColorBlindness(this IImageProcessingContext source, ColorBlindnessMode colorBlindnessMode, Rectangle rectangle) => source.ApplyProcessor(GetProcessor(colorBlindnessMode), rectangle); diff --git a/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs index 5ed5c9a21d..4dd4707bc1 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/ContrastExtensions.cs +++ b/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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Contrast(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new ContrastProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs index 051afebc97..387307b3df 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/FilterExtensions.cs +++ b/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 /// /// Filters an image by the given color matrix /// - /// The image this method extends. + /// The current image processing context. /// The filter color matrix - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Filter(this IImageProcessingContext source, ColorMatrix matrix) => source.ApplyProcessor(new FilterProcessor(matrix)); /// /// Filters an image by the given color matrix /// - /// The image this method extends. + /// The current image processing context. /// The filter color matrix /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Filter(this IImageProcessingContext source, ColorMatrix matrix, Rectangle rectangle) => source.ApplyProcessor(new FilterProcessor(matrix), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs index 88633719a1..86ef74394e 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Filters/GrayscaleExtensions.cs @@ -15,7 +15,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// The . public static IImageProcessingContext Grayscale(this IImageProcessingContext source) => Grayscale(source, GrayscaleMode.Bt709); @@ -23,7 +23,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image using the given amount. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. /// The . public static IImageProcessingContext Grayscale(this IImageProcessingContext source, float amount) @@ -32,7 +32,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image with the given . /// - /// The image this method extends. + /// The current image processing context. /// The formula to apply to perform the operation. /// The . public static IImageProcessingContext Grayscale(this IImageProcessingContext source, GrayscaleMode mode) @@ -41,7 +41,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image with the given using the given amount. /// - /// The image this method extends. + /// The current image processing context. /// The formula to apply to perform the operation. /// The proportion of the conversion. Must be between 0 and 1. /// The . @@ -58,7 +58,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// @@ -69,7 +69,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image using the given amount. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. /// /// The structure that specifies the portion of the image object to alter. @@ -81,7 +81,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// The formula to apply to perform the operation. /// /// The structure that specifies the portion of the image object to alter. @@ -93,7 +93,7 @@ public static class GrayscaleExtensions /// /// Applies grayscale toning to the image using the given amount. /// - /// The image this method extends. + /// The current image processing context. /// The formula to apply to perform the operation. /// The proportion of the conversion. Must be between 0 and 1. /// diff --git a/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs index 3ec339e9c9..a493a6f828 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/HueExtensions.cs +++ b/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 /// /// Alters the hue component of the image. /// - /// The image this method extends. + /// The current image processing context. /// The rotation angle in degrees to adjust the hue. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees) => source.ApplyProcessor(new HueProcessor(degrees)); /// /// Alters the hue component of the image. /// - /// The image this method extends. + /// The current image processing context. /// The rotation angle in degrees to adjust the hue. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Hue(this IImageProcessingContext source, float degrees, Rectangle rectangle) => source.ApplyProcessor(new HueProcessor(degrees), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs index 3c7845ec83..6b42e7da43 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/InvertExtensions.cs +++ b/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 /// /// Inverts the colors of the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Invert(this IImageProcessingContext source) => source.ApplyProcessor(new InvertProcessor(1F)); /// /// Inverts the colors of the image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Invert(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new InvertProcessor(1F), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs index 8aa8260676..5c64e2b785 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/KodachromeExtensions.cs +++ b/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 /// /// Alters the colors of the image recreating an old Kodachrome camera effect. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Kodachrome(this IImageProcessingContext source) => source.ApplyProcessor(new KodachromeProcessor()); /// /// Alters the colors of the image recreating an old Kodachrome camera effect. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Kodachrome(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new KodachromeProcessor(), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs index fb937d9728..8542027702 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/LightnessExtensions.cs +++ b/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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. - /// The to allow chaining of operations. + /// The . 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. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Lightness(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new LightnessProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs index 816647bd42..8942fdde01 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Filters/LomographExtensions.cs @@ -14,19 +14,19 @@ public static class LomographExtensions /// /// Alters the colors of the image recreating an old Lomograph camera effect. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Lomograph(this IImageProcessingContext source) => source.ApplyProcessor(new LomographProcessor(source.GetGraphicsOptions())); /// /// Alters the colors of the image recreating an old Lomograph camera effect. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Lomograph(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new LomographProcessor(source.GetGraphicsOptions()), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs index e704dd763c..467b98d52b 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/OpacityExtensions.cs +++ b/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 /// /// Multiplies the alpha component of the image. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Opacity(this IImageProcessingContext source, float amount) => source.ApplyProcessor(new OpacityProcessor(amount)); /// /// Multiplies the alpha component of the image. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Opacity(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new OpacityProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs index bab05c0365..41678e4313 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Filters/PolaroidExtensions.cs @@ -14,19 +14,19 @@ public static class PolaroidExtensions /// /// Alters the colors of the image recreating an old Polaroid camera effect. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Polaroid(this IImageProcessingContext source) => source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions())); /// /// Alters the colors of the image recreating an old Polaroid camera effect. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Polaroid(this IImageProcessingContext source, Rectangle rectangle) => source.ApplyProcessor(new PolaroidProcessor(source.GetGraphicsOptions()), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs index 03e6ddcba5..5bf9c737ee 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/SaturateExtensions.cs +++ b/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 /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. - /// The to allow chaining of operations. + /// The . 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 /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be greater than or equal to 0. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Saturate(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new SaturateProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs b/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs index 01ddccba0d..af00b9b329 100644 --- a/src/ImageSharp/Processing/Extensions/Filters/SepiaExtensions.cs +++ b/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 /// /// Applies sepia toning to the image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Sepia(this IImageProcessingContext source) => Sepia(source, 1F); /// /// Applies sepia toning to the image using the given amount. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Sepia(this IImageProcessingContext source, float amount) => source.ApplyProcessor(new SepiaProcessor(amount)); /// /// Applies sepia toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Sepia(this IImageProcessingContext source, Rectangle rectangle) => Sepia(source, 1F, rectangle); /// /// Applies sepia toning to the image. /// - /// The image this method extends. + /// The current image processing context. /// The proportion of the conversion. Must be between 0 and 1. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Sepia(this IImageProcessingContext source, float amount, Rectangle rectangle) => source.ApplyProcessor(new SepiaProcessor(amount), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs b/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs index ab5b8e3e1b..d7f4ba3594 100644 --- a/src/ImageSharp/Processing/Extensions/Normalization/HistogramEqualizationExtensions.cs +++ b/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 /// /// Equalizes the histogram of an image to increases the contrast. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext HistogramEqualization(this IImageProcessingContext source) => HistogramEqualization(source, new HistogramEqualizationOptions()); /// /// Equalizes the histogram of an image to increases the contrast. /// - /// The image this method extends. + /// The current image processing context. /// The histogram equalization options to use. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext HistogramEqualization( this IImageProcessingContext source, HistogramEqualizationOptions options) => diff --git a/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs index 4369f45326..938c880f60 100644 --- a/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Overlays/BackgroundColorExtensions.cs @@ -14,21 +14,21 @@ public static class BackgroundColorExtensions /// /// Replaces the background color of image with the given one. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the background. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BackgroundColor(this IImageProcessingContext source, Color color) => BackgroundColor(source, source.GetGraphicsOptions(), color); /// /// Replaces the background color of image with the given one. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the background. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BackgroundColor( this IImageProcessingContext source, Color color, @@ -38,10 +38,10 @@ public static class BackgroundColorExtensions /// /// Replaces the background color of image with the given one. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// The color to set as the background. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BackgroundColor( this IImageProcessingContext source, GraphicsOptions options, @@ -51,13 +51,13 @@ public static class BackgroundColorExtensions /// /// Replaces the background color of image with the given one. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// The color to set as the background. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext BackgroundColor( this IImageProcessingContext source, GraphicsOptions options, diff --git a/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs index c588ae9647..9e00f5b304 100644 --- a/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Overlays/GlowExtensions.cs @@ -14,17 +14,17 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source) => Glow(source, source.GetGraphicsOptions()); /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the glow. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, Color color) { return Glow(source, source.GetGraphicsOptions(), color); @@ -33,33 +33,33 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The the radius. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, float radius) => Glow(source, source.GetGraphicsOptions(), radius); /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, Rectangle rectangle) => source.Glow(source.GetGraphicsOptions(), rectangle); /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow( this IImageProcessingContext source, Color color, @@ -70,19 +70,19 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow(this IImageProcessingContext source, GraphicsOptions options) => source.Glow(options, Color.Black, ValueSize.PercentageOfWidth(0.5f)); /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// The color to set as the glow. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, @@ -92,10 +92,10 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// The the radius. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, @@ -105,12 +105,12 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, @@ -120,14 +120,14 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, @@ -139,14 +139,14 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . private static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, @@ -158,11 +158,11 @@ public static class GlowExtensions /// /// Applies a radial glow effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting things like blending. /// The color to set as the glow. /// The the radius. - /// The to allow chaining of operations. + /// The . private static IImageProcessingContext Glow( this IImageProcessingContext source, GraphicsOptions options, diff --git a/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs b/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs index 379a2f32ab..fb9f79d411 100644 --- a/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Overlays/VignetteExtensions.cs @@ -14,27 +14,27 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source) => Vignette(source, source.GetGraphicsOptions()); /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the vignette. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, Color color) => Vignette(source, source.GetGraphicsOptions(), color); /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The the x-radius. /// The the y-radius. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, float radiusX, @@ -44,25 +44,25 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, Rectangle rectangle) => Vignette(source, source.GetGraphicsOptions(), rectangle); /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The color to set as the vignette. /// The the x-radius. /// The the y-radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, Color color, @@ -74,9 +74,9 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette(this IImageProcessingContext source, GraphicsOptions options) => source.VignetteInternal( options, @@ -87,10 +87,10 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// The color to set as the vignette. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, GraphicsOptions options, @@ -104,11 +104,11 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// The the x-radius. /// The the y-radius. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, GraphicsOptions options, @@ -119,12 +119,12 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, GraphicsOptions options, @@ -139,7 +139,7 @@ public static class VignetteExtensions /// /// Applies a radial vignette effect to an image. /// - /// The image this method extends. + /// The current image processing context. /// The options effecting pixel blending. /// The color to set as the vignette. /// The the x-radius. @@ -147,7 +147,7 @@ public static class VignetteExtensions /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Vignette( this IImageProcessingContext source, GraphicsOptions options, diff --git a/src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs b/src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs index 559477a05e..bf6d2221f4 100644 --- a/src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Quantization/QuantizeExtensions.cs @@ -14,40 +14,40 @@ public static class QuantizeExtensions /// /// Applies quantization to the image using the . /// - /// The image this method extends. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext Quantize(this IImageProcessingContext source) => Quantize(source, KnownQuantizers.Octree); /// /// Applies quantization to the image. /// - /// The image this method extends. + /// The current image processing context. /// The quantizer to apply to perform the operation. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Quantize(this IImageProcessingContext source, IQuantizer quantizer) => source.ApplyProcessor(new QuantizeProcessor(quantizer)); /// /// Applies quantization to the image using the . /// - /// The image this method extends. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Quantize(this IImageProcessingContext source, Rectangle rectangle) => Quantize(source, KnownQuantizers.Octree, rectangle); /// /// Applies quantization to the image. /// - /// The image this method extends. + /// The current image processing context. /// The quantizer to apply to perform the operation. /// /// The structure that specifies the portion of the image object to alter. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Quantize(this IImageProcessingContext source, IQuantizer quantizer, Rectangle rectangle) => source.ApplyProcessor(new QuantizeProcessor(quantizer), rectangle); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/AutoOrientExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/AutoOrientExtensions.cs index a7b8dbf43f..fcd0023e53 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/AutoOrientExtensions.cs +++ b/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 /// /// Adjusts an image so that its orientation is suitable for viewing. Adjustments are based on EXIF metadata embedded in the image. /// - /// The image to auto rotate. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext AutoOrient(this IImageProcessingContext source) => source.ApplyProcessor(new AutoOrientProcessor()); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs index 434aeb6582..3025806d4f 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/CropExtensions.cs +++ b/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 /// /// Crops an image to the given width and height. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Crop(this IImageProcessingContext source, int width, int height) => Crop(source, new Rectangle(0, 0, width, height)); /// /// Crops an image to the given rectangle. /// - /// The image to crop. + /// The current image processing context. /// /// The structure that specifies the portion of the image object to retain. /// - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Crop(this IImageProcessingContext source, Rectangle cropRectangle) => source.ApplyProcessor(new CropProcessor(cropRectangle, source.GetCurrentSize())); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs index 14e7f9f134..6461a4e8aa 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/EntropyCropExtensions.cs @@ -14,17 +14,17 @@ public static class EntropyCropExtensions /// /// Crops an image to the area of greatest entropy using a threshold for entropic density of .5F. /// - /// The image to crop. - /// The to allow chaining of operations. + /// The current image processing context. + /// The . public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source) => source.ApplyProcessor(new EntropyCropProcessor()); /// /// Crops an image to the area of greatest entropy. /// - /// The image to crop. + /// The current image processing context. /// The threshold for entropic density. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext EntropyCrop(this IImageProcessingContext source, float threshold) => source.ApplyProcessor(new EntropyCropProcessor(threshold)); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/FlipExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/FlipExtensions.cs index 243d818b84..3828572a60 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/FlipExtensions.cs +++ b/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 /// /// Flips an image by the given instructions. /// - /// The image to rotate, flip, or both. + /// The current image processing context. /// The to perform the flip. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Flip(this IImageProcessingContext source, FlipMode flipMode) => source.ApplyProcessor(new FlipProcessor(flipMode)); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs index dfade98475..b6db0172dc 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/PadExtensions.cs @@ -12,21 +12,21 @@ public static class PadExtensions /// /// Evenly pads an image to fit the new dimensions. /// - /// The source image to pad. + /// The current image processing context. /// The new width. /// The new height. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Pad(this IImageProcessingContext source, int width, int height) => source.Pad(width, height, default); /// /// Evenly pads an image to fit the new dimensions with the given background color. /// - /// The source image to pad. + /// The current image processing context. /// The new width. /// The new height. /// The background color with which to pad the image. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Pad(this IImageProcessingContext source, int width, int height, Color color) { Size size = source.GetCurrentSize(); diff --git a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs index 7580f64690..01f296d096 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/ResizeExtensions.cs @@ -14,9 +14,9 @@ public static class ResizeExtensions /// /// Resizes an image to the given . /// - /// The image to resize. + /// The current image processing context. /// The target image size. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given . /// - /// The image to resize. + /// The current image processing context. /// The target image size. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given width and height. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given width and height. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given width and height with the given sampler. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given width and height with the given sampler. /// - /// The image to resize. + /// The current image processing context. /// The target image size. /// The to perform the resampling. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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 /// /// Resizes an image to the given width and height with the given sampler. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. /// The to perform the resampling. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. 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. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. /// The to perform the resampling. @@ -107,7 +107,7 @@ public static class ResizeExtensions /// The structure that specifies the portion of the target image object to draw to. /// /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. public static IImageProcessingContext Resize( this IImageProcessingContext source, @@ -133,7 +133,7 @@ public static class ResizeExtensions /// /// Resizes an image to the given width and height with the given sampler and source rectangle. /// - /// The image to resize. + /// The current image processing context. /// The target image width. /// The target image height. /// The to perform the resampling. @@ -141,7 +141,7 @@ public static class ResizeExtensions /// The structure that specifies the portion of the target image object to draw to. /// /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The to allow chaining of operations. + /// The . /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image or the nearest possible ratio. public static IImageProcessingContext Resize( this IImageProcessingContext source, @@ -166,9 +166,9 @@ public static class ResizeExtensions /// /// Resizes an image in accordance with the given . /// - /// The image to resize. + /// The current image processing context. /// The resize options. - /// The to allow chaining of operations. + /// The . /// 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. public static IImageProcessingContext Resize(this IImageProcessingContext source, ResizeOptions options) => source.ApplyProcessor(new ResizeProcessor(options, source.GetCurrentSize())); diff --git a/src/ImageSharp/Processing/Extensions/Transforms/RotateExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/RotateExtensions.cs index ac3c464468..fdf28c595f 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/RotateExtensions.cs +++ b/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 /// /// Rotates and flips an image by the given instructions. /// - /// The image to rotate. + /// The current image processing context. /// The to perform the rotation. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Rotate(this IImageProcessingContext source, RotateMode rotateMode) => Rotate(source, (float)rotateMode); /// /// Rotates an image by the given angle in degrees. /// - /// The image to rotate. + /// The current image processing context. /// The angle in degrees to perform the rotation. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Rotate(this IImageProcessingContext source, float degrees) => Rotate(source, degrees, KnownResamplers.Bicubic); /// /// Rotates an image by the given angle in degrees using the specified sampling algorithm. /// - /// The image to rotate. + /// The current image processing context. /// The angle in degrees to perform the rotation. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Rotate( this IImageProcessingContext source, float degrees, diff --git a/src/ImageSharp/Processing/Extensions/Transforms/RotateFlipExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/RotateFlipExtensions.cs index fe66af6aa6..4dc324b5ba 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/RotateFlipExtensions.cs +++ b/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 /// /// Rotates and flips an image by the given instructions. /// - /// The image to rotate, flip, or both. + /// The current image processing context. /// The to perform the rotation. /// The to perform the flip. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext RotateFlip(this IImageProcessingContext source, RotateMode rotateMode, FlipMode flipMode) => source.Rotate(rotateMode).Flip(flipMode); } diff --git a/src/ImageSharp/Processing/Extensions/Transforms/SkewExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/SkewExtensions.cs index 6b2b8b15f9..09c41b567c 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/SkewExtensions.cs +++ b/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 /// /// Skews an image by the given angles in degrees. /// - /// The image to skew. + /// The current image processing context. /// The angle in degrees to perform the skew along the x-axis. /// The angle in degrees to perform the skew along the y-axis. - /// The to allow chaining of operations. + /// The . 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 /// /// Skews an image by the given angles in degrees using the specified sampling algorithm. /// - /// The image to skew. + /// The current image processing context. /// The angle in degrees to perform the skew along the x-axis. /// The angle in degrees to perform the skew along the y-axis. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Skew( this IImageProcessingContext source, float degreesX, diff --git a/src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs index 73ec111c95..4e107a4f0a 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs +++ b/src/ImageSharp/Processing/Extensions/Transforms/SwizzleExtensions.cs @@ -13,10 +13,10 @@ public static class SwizzleExtensions /// /// Swizzles an image. /// - /// The image to swizzle. + /// The current image processing context. /// The swizzler function. /// The swizzler function type. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Swizzle(this IImageProcessingContext source, TSwizzler swizzler) where TSwizzler : struct, ISwizzler => source.ApplyProcessor(new SwizzleProcessor(swizzler)); diff --git a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs b/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs index fbf3b3a6df..e88f000a7c 100644 --- a/src/ImageSharp/Processing/Extensions/Transforms/TransformExtensions.cs +++ b/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 /// /// Performs an affine transform of an image. /// - /// The image to transform. + /// The current image processing context. /// The affine transform builder. - /// The + /// The . public static IImageProcessingContext Transform( this IImageProcessingContext source, AffineTransformBuilder builder) => @@ -26,62 +26,60 @@ public static class TransformExtensions /// /// Performs an affine transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The affine transform builder. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); /// /// Performs an affine transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The source rectangle /// The affine transform builder. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); } /// /// Performs an affine transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The source rectangle /// The transformation matrix. /// The size of the result image. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); - } /// /// Performs a projective transform of an image. /// - /// The image to transform. + /// The current image processing context. /// The affine transform builder. - /// The to allow chaining of operations. + /// The . public static IImageProcessingContext Transform( this IImageProcessingContext source, ProjectiveTransformBuilder builder) => @@ -90,53 +88,51 @@ public static class TransformExtensions /// /// Performs a projective transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The projective transform builder. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); /// /// Performs a projective transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The source rectangle /// The projective transform builder. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); } /// /// Performs a projective transform of an image using the specified sampling algorithm. /// - /// The . + /// The current image processing context. /// The source rectangle /// The transformation matrix. /// The size of the result image. /// The to perform the resampling. - /// The to allow chaining of operations. + /// The . 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); - } } From 2964becc21c4dd2ed1c18ba679399edc93ec95ba Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 27 Jan 2023 09:13:54 +1000 Subject: [PATCH 2/9] Increase sleep time for slow VMs --- .../Memory/Allocators/MemoryDiagnosticsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs index 1876d26479..44117f9388 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; @@ -94,7 +94,7 @@ public class MemoryDiagnosticsTests if (subscribeLeakHandle) { // Make sure at least some of the leak callbacks have time to complete on the ThreadPool - Thread.Sleep(200); + Thread.Sleep(500); Assert.True(leakCounter > 3, $"leakCounter did not count enough leaks ({leakCounter} only)"); } From 42eb11046e8554f9b01fa430c8f1f683eb1ed49c Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 28 Jan 2023 11:47:56 +1000 Subject: [PATCH 3/9] Update MemoryDiagnosticsTests.cs --- .../Memory/Allocators/MemoryDiagnosticsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs index 44117f9388..b8dd4be8df 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs @@ -94,7 +94,7 @@ public class MemoryDiagnosticsTests if (subscribeLeakHandle) { // Make sure at least some of the leak callbacks have time to complete on the ThreadPool - Thread.Sleep(500); + Thread.Sleep(1000); Assert.True(leakCounter > 3, $"leakCounter did not count enough leaks ({leakCounter} only)"); } From cf4c384cc4b732853d18ba24fedd7f93bb351ae3 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 31 Jan 2023 20:04:04 +1000 Subject: [PATCH 4/9] Add test images --- tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs | 3 +++ tests/ImageSharp.Tests/TestImages.cs | 2 ++ tests/Images/Input/Jpg/issues/issue-2334-a.jpg | 3 +++ tests/Images/Input/Jpg/issues/issue-2334-b.jpg | 3 +++ 4 files changed, 11 insertions(+) create mode 100644 tests/Images/Input/Jpg/issues/issue-2334-a.jpg create mode 100644 tests/Images/Input/Jpg/issues/issue-2334-b.jpg diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 425d12497c..80789178d1 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -302,8 +302,11 @@ public partial class JpegDecoderTests } // https://github.com/SixLabors/ImageSharp/issues/2315 + // https://github.com/SixLabors/ImageSharp/issues/2334 [Theory] [WithFile(TestImages.Jpeg.Issues.Issue2315_NotEnoughBytes, PixelTypes.Rgba32)] + [WithFile(TestImages.Jpeg.Issues.Issue2334_NotEnoughBytesA, PixelTypes.Rgba32)] + [WithFile(TestImages.Jpeg.Issues.Issue2334_NotEnoughBytesB, PixelTypes.Rgba32)] public void Issue2315_DecodeWorks(TestImageProvider provider) where TPixel : unmanaged, IPixel { diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 22a48ebee4..2de508b75c 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -282,6 +282,8 @@ public static class TestImages public const string Issue2133_DeduceColorSpace = "Jpg/issues/Issue2133.jpg"; public const string Issue2136_ScanMarkerExtraneousBytes = "Jpg/issues/Issue2136-scan-segment-extraneous-bytes.jpg"; public const string Issue2315_NotEnoughBytes = "Jpg/issues/issue-2315.jpg"; + public const string Issue2334_NotEnoughBytesA = "Jpg/issues/issue-2334-a.jpg"; + public const string Issue2334_NotEnoughBytesB = "Jpg/issues/issue-2334-b.jpg"; public static class Fuzz { diff --git a/tests/Images/Input/Jpg/issues/issue-2334-a.jpg b/tests/Images/Input/Jpg/issues/issue-2334-a.jpg new file mode 100644 index 0000000000..8f7ac362d8 --- /dev/null +++ b/tests/Images/Input/Jpg/issues/issue-2334-a.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75d7e645cc359340a0a77f13c842551dce8f82773d2eba18bf18b149dcf9a2ff +size 411155 diff --git a/tests/Images/Input/Jpg/issues/issue-2334-b.jpg b/tests/Images/Input/Jpg/issues/issue-2334-b.jpg new file mode 100644 index 0000000000..edfc9637b8 --- /dev/null +++ b/tests/Images/Input/Jpg/issues/issue-2334-b.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad6725bfa405454f6fb524dd632a53367f8853fd4a68705c773f0aeef068f7b3 +size 159229 From 34add6aebfc0c7d4f5117ab7bbbd6cdf87071b5c Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Tue, 31 Jan 2023 18:00:44 +0100 Subject: [PATCH 5/9] Remove nullable disable from pixelimplementations #2231 --- src/ImageSharp/PixelFormats/PixelImplementations/A8.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs | 3 +-- .../PixelFormats/PixelImplementations/Bgra4444.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs | 3 +-- .../PixelFormats/PixelImplementations/HalfSingle.cs | 3 +-- .../PixelFormats/PixelImplementations/HalfVector2.cs | 3 +-- .../PixelFormats/PixelImplementations/HalfVector4.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/L16.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/L8.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/La16.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/La32.cs | 3 +-- .../PixelFormats/PixelImplementations/NormalizedByte2.cs | 3 +-- .../PixelFormats/PixelImplementations/NormalizedByte4.cs | 3 +-- .../PixelFormats/PixelImplementations/NormalizedShort2.cs | 3 +-- .../PixelFormats/PixelImplementations/NormalizedShort4.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs | 3 +-- .../PixelFormats/PixelImplementations/Rgba1010102.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs | 7 +++---- src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs | 3 +-- .../PixelFormats/PixelImplementations/RgbaVector.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs | 3 +-- src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs | 3 +-- 28 files changed, 30 insertions(+), 58 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs index 1da5645835..0256907121 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -140,7 +139,7 @@ public partial struct A8 : IPixel, IPackedVector /// /// The object to compare. /// True if the object is equal to the packed vector. - public override readonly bool Equals(object obj) => obj is A8 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is A8 other && this.Equals(other); /// /// Compares another A8 packed vector with the packed vector. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs index 28b6899b2a..ca68c5aaf9 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -335,7 +334,7 @@ public partial struct Abgr32 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is Abgr32 abgr32 && this.Equals(abgr32); + public override readonly bool Equals(object? obj) => obj is Abgr32 abgr32 && this.Equals(abgr32); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs index 935751afcd..0c99adb52d 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -334,7 +333,7 @@ public partial struct Argb32 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is Argb32 argb32 && this.Equals(argb32); + public override readonly bool Equals(object? obj) => obj is Argb32 argb32 && this.Equals(argb32); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index 751e0bfe86..65b36059b8 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -232,7 +231,7 @@ public partial struct Bgr24 : IPixel public readonly bool Equals(Bgr24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); /// - public override readonly bool Equals(object obj) => obj is Bgr24 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Bgr24 other && this.Equals(other); /// public override readonly string ToString() => $"Bgr24({this.B}, {this.G}, {this.R})"; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs index 21766431cf..ac3b6f8299 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -151,7 +150,7 @@ public partial struct Bgr565 : IPixel, IPackedVector (this.PackedValue & 0x1F) * (1F / 31F)); /// - public override readonly bool Equals(object obj) => obj is Bgr565 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Bgr565 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs index 204919392d..6b859cda64 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -287,7 +286,7 @@ public partial struct Bgra32 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is Bgra32 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Bgra32 other && this.Equals(other); /// public readonly bool Equals(Bgra32 other) => this.Bgra.Equals(other.Bgra); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs index e342d18455..8ba32c8ac2 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -143,7 +142,7 @@ public partial struct Bgra4444 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Bgra4444 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Bgra4444 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs index 9d9b7c87fc..e699e5fe58 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -141,7 +140,7 @@ public partial struct Byte4 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Byte4 byte4 && this.Equals(byte4); + public override readonly bool Equals(object? obj) => obj is Byte4 byte4 && this.Equals(byte4); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs index a99462c8b9..db1e02adc2 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -140,7 +139,7 @@ public partial struct HalfSingle : IPixel, IPackedVector public readonly float ToSingle() => HalfTypeHelper.Unpack(this.PackedValue); /// - public override readonly bool Equals(object obj) => obj is HalfSingle other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is HalfSingle other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs index 2f2117c26f..9caae58c95 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -157,7 +156,7 @@ public partial struct HalfVector2 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is HalfVector2 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is HalfVector2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs index 859ba7e320..609fec3bd7 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -149,7 +148,7 @@ public partial struct HalfVector4 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is HalfVector4 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is HalfVector4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs index 5d2539ce13..c6ee8744d9 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -153,7 +152,7 @@ public partial struct L16 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.PackedValue = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); /// - public override readonly bool Equals(object obj) => obj is L16 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is L16 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs index 25a79e58fc..383e09b270 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -143,7 +142,7 @@ public partial struct L8 : IPixel, IPackedVector ColorNumerics.DownScaleFrom16BitTo8Bit(source.B)); /// - public override readonly bool Equals(object obj) => obj is L8 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is L8 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs index 21e66ed495..7597677a26 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -80,7 +79,7 @@ public partial struct La16 : IPixel, IPackedVector public readonly bool Equals(La16 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly bool Equals(object obj) => obj is La16 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is La16 other && this.Equals(other); /// public override readonly string ToString() => $"La16({this.L}, {this.A})"; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs index cf53d2217b..cb8fad228d 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -82,7 +81,7 @@ public partial struct La32 : IPixel, IPackedVector public readonly bool Equals(La32 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly bool Equals(object obj) => obj is La32 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is La32 other && this.Equals(other); /// public override readonly string ToString() => $"La32({this.L}, {this.A})"; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs index d9d0a53bd8..92b9e6148a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -162,7 +161,7 @@ public partial struct NormalizedByte2 : IPixel, IPackedVector> 8) & 0xFF) / MaxPos); /// - public override readonly bool Equals(object obj) => obj is NormalizedByte2 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is NormalizedByte2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs index 5a18d00a2d..f87bb5a602 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -154,7 +153,7 @@ public partial struct NormalizedByte4 : IPixel, IPackedVector this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is NormalizedByte4 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is NormalizedByte4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs index 84e5e43625..f77dd69b71 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -163,7 +162,7 @@ public partial struct NormalizedShort2 : IPixel, IPackedVector (short)(this.PackedValue >> 0x10) / MaxPos); /// - public override readonly bool Equals(object obj) => obj is NormalizedShort2 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is NormalizedShort2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs index f8139c547b..989edbd2ba 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -155,7 +154,7 @@ public partial struct NormalizedShort4 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is NormalizedShort4 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is NormalizedShort4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs index 69f39c8838..0a13a15eda 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -146,7 +145,7 @@ public partial struct Rg32 : IPixel, IPackedVector public readonly Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFFFF, (this.PackedValue >> 16) & 0xFFFF) / Max; /// - public override readonly bool Equals(object obj) => obj is Rg32 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Rg32 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs index 5f66341571..105618cd96 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -241,7 +240,7 @@ public partial struct Rgb24 : IPixel } /// - public override readonly bool Equals(object obj) => obj is Rgb24 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Rgb24 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs index 16673fca2f..1cf63eb24c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -210,7 +209,7 @@ public partial struct Rgb48 : IPixel public void FromRgb48(Rgb48 source) => this = source; /// - public override readonly bool Equals(object obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); + public override readonly bool Equals(object? obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs index 2c59741bf4..7bac1d9208 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -141,7 +140,7 @@ public partial struct Rgba1010102 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Rgba1010102 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Rgba1010102 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs index 0d18ac3431..a652c2b339 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Buffers.Binary; using System.Globalization; @@ -267,7 +266,7 @@ public partial struct Rgba32 : IPixel, IPackedVector /// The . /// [MethodImpl(InliningOptions.ShortMethod)] - public static bool TryParseHex(string hex, out Rgba32 result) + public static bool TryParseHex(string? hex, out Rgba32 result) { result = default; if (string.IsNullOrWhiteSpace(hex)) @@ -437,7 +436,7 @@ public partial struct Rgba32 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); + public override readonly bool Equals(object? obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -514,7 +513,7 @@ public partial struct Rgba32 : IPixel, IPackedVector /// /// A rrggbbaa hex value. /// - private static string ToRgbaHex(string hex) + private static string? ToRgbaHex(string hex) { if (hex[0] == '#') { diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs index 7560892120..81c9591480 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -444,7 +443,7 @@ public partial struct Rgba64 : IPixel, IPackedVector } /// - public override readonly bool Equals(object obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); + public override readonly bool Equals(object? obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index 3a0426a8e1..899987b712 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Globalization; using System.Numerics; @@ -193,7 +192,7 @@ public partial struct RgbaVector : IPixel } /// - public override readonly bool Equals(object obj) => obj is RgbaVector other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is RgbaVector other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs index 8eb33afd35..832e8c770f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -164,7 +163,7 @@ public partial struct Short2 : IPixel, IPackedVector public readonly Vector2 ToVector2() => new((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10)); /// - public override readonly bool Equals(object obj) => obj is Short2 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Short2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs index b964c9ec50..c4dc324a13 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -164,7 +163,7 @@ public partial struct Short4 : IPixel, IPackedVector public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Short4 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Short4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] From 8504518073a46b8a0fdc1a7c86377c3ef4b80593 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Tue, 31 Jan 2023 18:50:23 +0100 Subject: [PATCH 6/9] Remove nullable disable from Processing.Processors #2231 --- .../DefaultImageProcessorContext{TPixel}.cs | 7 +++-- .../Convolution/KernelSamplingMap.cs | 9 +++---- .../Processors/Drawing/DrawImageProcessor.cs | 5 ++-- .../Quantization/OctreeQuantizer{TPixel}.cs | 26 +++++++++---------- .../Quantization/PaletteQuantizer{TPixel}.cs | 4 +-- .../Quantization/QuantizerOptions.cs | 2 +- .../Quantization/QuantizerUtilities.cs | 2 +- .../Quantization/WuQuantizer{TPixel}.cs | 10 +++---- .../AffineTransformProcessor{TPixel}.cs | 9 +++---- .../ProjectiveTransformProcessor{TPixel}.cs | 9 +++---- .../Resize/ResizeProcessor{TPixel}.cs | 5 ++-- 11 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs b/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs index 208455b902..4d95e060dc 100644 --- a/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs +++ b/src/ImageSharp/Processing/DefaultImageProcessorContext{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Collections.Concurrent; using SixLabors.ImageSharp.PixelFormats; @@ -17,7 +16,7 @@ internal class DefaultImageProcessorContext : IInternalImageProcessingCo { private readonly bool mutate; private readonly Image source; - private Image destination; + private Image? destination; /// /// Initializes a new instance of the class. @@ -54,7 +53,7 @@ internal class DefaultImageProcessorContext : IInternalImageProcessingCo this.destination = this.source.Clone(); } - return this.destination; + return this.destination!; } /// @@ -87,7 +86,7 @@ internal class DefaultImageProcessorContext : IInternalImageProcessingCo } // Standard processing pipeline. - using (IImageProcessor specificProcessor = processor.CreatePixelSpecificProcessor(this.Configuration, this.destination, rectangle)) + using (IImageProcessor specificProcessor = processor.CreatePixelSpecificProcessor(this.Configuration, this.destination!, rectangle)) { specificProcessor.Execute(); } diff --git a/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs b/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs index 4cae2f858e..8128d01196 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Buffers; using System.Runtime.CompilerServices; @@ -16,8 +15,8 @@ internal sealed class KernelSamplingMap : IDisposable { private readonly MemoryAllocator allocator; private bool isDisposed; - private IMemoryOwner yOffsets; - private IMemoryOwner xOffsets; + private IMemoryOwner? yOffsets; + private IMemoryOwner? xOffsets; /// /// Initializes a new instance of the class. @@ -65,10 +64,10 @@ internal sealed class KernelSamplingMap : IDisposable } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Span GetRowOffsetSpan() => this.yOffsets.GetSpan(); + public Span GetRowOffsetSpan() => this.yOffsets!.GetSpan(); [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Span GetColumnOffsetSpan() => this.xOffsets.GetSpan(); + public Span GetColumnOffsetSpan() => this.xOffsets!.GetSpan(); /// public void Dispose() diff --git a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs index 9de4f862b8..88b59b7dc6 100644 --- a/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Drawing/DrawImageProcessor.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; @@ -65,7 +64,7 @@ public class DrawImageProcessor : IImageProcessor { ProcessorFactoryVisitor visitor = new(configuration, this, source, sourceRectangle); this.Image.AcceptVisitor(visitor); - return visitor.Result; + return visitor.Result!; } private class ProcessorFactoryVisitor : IImageVisitor @@ -84,7 +83,7 @@ public class DrawImageProcessor : IImageProcessor this.sourceRectangle = sourceRectangle; } - public IImageProcessor Result { get; private set; } + public IImageProcessor? Result { get; private set; } public void Visit(Image image) where TPixelFg : unmanaged, IPixel diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index 43d11777db..61ffcc6ccd 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Buffers; using System.Diagnostics.CodeAnalysis; @@ -27,9 +26,10 @@ public struct OctreeQuantizer : IQuantizer private readonly int maxColors; private readonly int bitDepth; private readonly Octree octree; - private IMemoryOwner paletteOwner; + [NotNull] + private IMemoryOwner? paletteOwner; private ReadOnlyMemory palette; - private EuclideanPixelMap pixelMap; + private EuclideanPixelMap? pixelMap; private readonly bool isDithering; private bool isDisposed; @@ -143,7 +143,7 @@ public struct OctreeQuantizer : IQuantizer // pixel and a black one. if (this.isDithering || color.Equals(default)) { - return (byte)this.pixelMap.GetClosestColor(color, out match); + return (byte)this.pixelMap!.GetClosestColor(color, out match); } ref TPixel paletteRef = ref MemoryMarshal.GetReference(this.palette.Span); @@ -183,7 +183,7 @@ public struct OctreeQuantizer : IQuantizer /// /// Store the last node quantized /// - private OctreeNode previousNode; + private OctreeNode? previousNode; /// /// Cache the previous color quantized @@ -221,7 +221,7 @@ public struct OctreeQuantizer : IQuantizer /// /// Gets the array of reducible nodes /// - private OctreeNode[] ReducibleNodes + private OctreeNode?[] ReducibleNodes { [MethodImpl(InliningOptions.ShortMethod)] get; @@ -311,7 +311,7 @@ public struct OctreeQuantizer : IQuantizer } // Reduce the node most recently added to the list at level 'index' - OctreeNode node = this.ReducibleNodes[index]; + OctreeNode node = this.ReducibleNodes[index]!; this.ReducibleNodes[index] = node.NextReducible; // Decrement the leaf count after reducing the node @@ -330,7 +330,7 @@ public struct OctreeQuantizer : IQuantizer /// /// Pointers to any child nodes /// - private readonly OctreeNode[] children; + private readonly OctreeNode?[]? children; /// /// Flag indicating that this is a leaf node @@ -395,7 +395,7 @@ public struct OctreeQuantizer : IQuantizer /// /// Gets the next reducible node /// - public OctreeNode NextReducible + public OctreeNode? NextReducible { [MethodImpl(InliningOptions.ShortMethod)] get; @@ -423,7 +423,7 @@ public struct OctreeQuantizer : IQuantizer // Go to the next level down in the tree int index = GetColorIndex(ref color, level); - OctreeNode child = this.children[index]; + OctreeNode? child = this.children![index]; if (child is null) { // Create a new child node and store it in the array @@ -448,7 +448,7 @@ public struct OctreeQuantizer : IQuantizer // Loop through all children and add their information to this node for (int index = 0; index < 8; index++) { - OctreeNode child = this.children[index]; + OctreeNode? child = this.children![index]; if (child != null) { this.red += child.red; @@ -495,7 +495,7 @@ public struct OctreeQuantizer : IQuantizer // Loop through children looking for leaves for (int i = 0; i < 8; i++) { - this.children[i]?.ConstructPalette(palette, ref index); + this.children![i]?.ConstructPalette(palette, ref index); } } } @@ -517,7 +517,7 @@ public struct OctreeQuantizer : IQuantizer } int colorIndex = GetColorIndex(ref pixel, level); - OctreeNode child = this.children[colorIndex]; + OctreeNode? child = this.children![colorIndex]; int index = 0; if (child != null) diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs index 7b351a61f5..f8f9658a85 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -21,7 +20,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization; internal struct PaletteQuantizer : IQuantizer where TPixel : unmanaged, IPixel { - private EuclideanPixelMap pixelMap; + [NotNull] + private EuclideanPixelMap? pixelMap; /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizerOptions.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizerOptions.cs index f52cfd6ea7..b3d03d9338 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/QuantizerOptions.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizerOptions.cs @@ -17,7 +17,7 @@ public class QuantizerOptions /// Gets or sets the algorithm to apply to the output image. /// Defaults to ; set to for no dithering. /// - public IDither Dither { get; set; } = QuantizerConstants.DefaultDither; + public IDither? Dither { get; set; } = QuantizerConstants.DefaultDither; /// /// Gets or sets the dithering scale used to adjust the amount of dither. Range 0..1. diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs index 167cf91282..53203f94a0 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs @@ -146,7 +146,7 @@ public static class QuantizerUtilities where TFrameQuantizer : struct, IQuantizer where TPixel : unmanaged, IPixel { - IDither dither = quantizer.Options.Dither; + IDither? dither = quantizer.Options.Dither; Buffer2D sourceBuffer = source.PixelBuffer; if (dither is null) diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs index e0aede058a..0119558bff 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Buffers; using System.Diagnostics.CodeAnalysis; @@ -76,7 +75,7 @@ internal struct WuQuantizer : IQuantizer private ReadOnlyMemory palette; private int maxColors; private readonly Box[] colorCube; - private EuclideanPixelMap pixelMap; + private EuclideanPixelMap? pixelMap; private readonly bool isDithering; private bool isDisposed; @@ -175,7 +174,7 @@ internal struct WuQuantizer : IQuantizer { if (this.isDithering) { - return (byte)this.pixelMap.GetClosestColor(color, out match); + return (byte)this.pixelMap!.GetClosestColor(color, out match); } Rgba32 rgba = default; @@ -203,9 +202,6 @@ internal struct WuQuantizer : IQuantizer this.momentsOwner?.Dispose(); this.tagsOwner?.Dispose(); this.paletteOwner?.Dispose(); - this.momentsOwner = null; - this.tagsOwner = null; - this.paletteOwner = null; this.pixelMap?.Dispose(); this.pixelMap = null; } @@ -869,7 +865,7 @@ internal struct WuQuantizer : IQuantizer public int Volume; /// - public override readonly bool Equals(object obj) + public override readonly bool Equals(object? obj) => obj is Box box && this.Equals(box); diff --git a/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs index b9ff551691..c5c2a778eb 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Linear/AffineTransformProcessor{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -20,8 +19,8 @@ internal class AffineTransformProcessor : TransformProcessor, IR private readonly Size destinationSize; private readonly Matrix3x2 transformMatrix; private readonly IResampler resampler; - private ImageFrame source; - private ImageFrame destination; + private ImageFrame? source; + private ImageFrame? destination; /// /// Initializes a new instance of the class. @@ -53,8 +52,8 @@ internal class AffineTransformProcessor : TransformProcessor, IR where TResampler : struct, IResampler { Configuration configuration = this.Configuration; - ImageFrame source = this.source; - ImageFrame destination = this.destination; + ImageFrame source = this.source!; + ImageFrame destination = this.destination!; Matrix3x2 matrix = this.transformMatrix; // Handle transforms that result in output identical to the original. diff --git a/src/ImageSharp/Processing/Processors/Transforms/Linear/ProjectiveTransformProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Linear/ProjectiveTransformProcessor{TPixel}.cs index 7d1a10926c..b741dc4ee6 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Linear/ProjectiveTransformProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Linear/ProjectiveTransformProcessor{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Numerics; using System.Runtime.CompilerServices; @@ -20,8 +19,8 @@ internal class ProjectiveTransformProcessor : TransformProcessor private readonly Size destinationSize; private readonly IResampler resampler; private readonly Matrix4x4 transformMatrix; - private ImageFrame source; - private ImageFrame destination; + private ImageFrame? source; + private ImageFrame? destination; /// /// Initializes a new instance of the class. @@ -53,8 +52,8 @@ internal class ProjectiveTransformProcessor : TransformProcessor where TResampler : struct, IResampler { Configuration configuration = this.Configuration; - ImageFrame source = this.source; - ImageFrame destination = this.destination; + ImageFrame source = this.source!; + ImageFrame destination = this.destination!; Matrix4x4 matrix = this.transformMatrix; // Handle transforms that result in output identical to the original. diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs index ba96e76ae0..98c2523fae 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Advanced; @@ -21,7 +20,7 @@ internal class ResizeProcessor : TransformProcessor, IResampling private readonly int destinationHeight; private readonly IResampler resampler; private readonly Rectangle destinationRectangle; - private Image destination; + private Image? destination; public ResizeProcessor(Configuration configuration, ResizeProcessor definition, Image source, Rectangle sourceRectangle) : base(configuration, source, sourceRectangle) @@ -56,7 +55,7 @@ internal class ResizeProcessor : TransformProcessor, IResampling { Configuration configuration = this.Configuration; Image source = this.Source; - Image destination = this.destination; + Image destination = this.destination!; Rectangle sourceRectangle = this.SourceRectangle; Rectangle destinationRectangle = this.destinationRectangle; bool compand = this.options.Compand; From e7bcc5f13270ce8eed50f8df73274f7a67a2c789 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Tue, 31 Jan 2023 18:58:49 +0100 Subject: [PATCH 7/9] Fix build Code analysis in rider did not catch that. only the build failed. --- .../Processors/Quantization/OctreeQuantizer{TPixel}.cs | 5 ++--- .../Processors/Quantization/PaletteQuantizer{TPixel}.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index 61ffcc6ccd..83e0a8b08f 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -26,7 +26,6 @@ public struct OctreeQuantizer : IQuantizer private readonly int maxColors; private readonly int bitDepth; private readonly Octree octree; - [NotNull] private IMemoryOwner? paletteOwner; private ReadOnlyMemory palette; private EuclideanPixelMap? pixelMap; @@ -99,7 +98,7 @@ public struct OctreeQuantizer : IQuantizer } int paletteIndex = 0; - Span paletteSpan = this.paletteOwner.GetSpan(); + Span paletteSpan = this.paletteOwner!.GetSpan(); // On very rare occasions, (blur.png), the quantizer does not preserve a // transparent entry when palletizing the captured colors. @@ -113,7 +112,7 @@ public struct OctreeQuantizer : IQuantizer } this.octree.Palletize(paletteSpan, max, ref paletteIndex); - ReadOnlyMemory result = this.paletteOwner.Memory[..paletteSpan.Length]; + ReadOnlyMemory result = this.paletteOwner!.Memory[..paletteSpan.Length]; // When called multiple times by QuantizerUtilities.BuildPalette // this prevents memory churn caused by reallocation. diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs index f8f9658a85..e73c87896f 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs @@ -20,7 +20,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization; internal struct PaletteQuantizer : IQuantizer where TPixel : unmanaged, IPixel { - [NotNull] private EuclideanPixelMap? pixelMap; /// @@ -47,7 +46,7 @@ internal struct PaletteQuantizer : IQuantizer public QuantizerOptions Options { get; } /// - public ReadOnlyMemory Palette => this.pixelMap.Palette; + public ReadOnlyMemory Palette => this.pixelMap!.Palette; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -63,7 +62,7 @@ internal struct PaletteQuantizer : IQuantizer /// [MethodImpl(InliningOptions.ShortMethod)] public readonly byte GetQuantizedColor(TPixel color, out TPixel match) - => (byte)this.pixelMap.GetClosestColor(color, out match); + => (byte)this.pixelMap!.GetClosestColor(color, out match); /// public void Dispose() From 7847fab011b2608f593d8e51b553824ec3a7e4af Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Wed, 1 Feb 2023 06:57:50 +0100 Subject: [PATCH 8/9] Remove ? for pixelMap and paletteOwner --- .../Processors/Quantization/OctreeQuantizer{TPixel}.cs | 9 ++++----- .../Processors/Quantization/PaletteQuantizer{TPixel}.cs | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index 83e0a8b08f..d66a38d80d 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -26,7 +26,7 @@ public struct OctreeQuantizer : IQuantizer private readonly int maxColors; private readonly int bitDepth; private readonly Octree octree; - private IMemoryOwner? paletteOwner; + private IMemoryOwner paletteOwner; private ReadOnlyMemory palette; private EuclideanPixelMap? pixelMap; private readonly bool isDithering; @@ -98,7 +98,7 @@ public struct OctreeQuantizer : IQuantizer } int paletteIndex = 0; - Span paletteSpan = this.paletteOwner!.GetSpan(); + Span paletteSpan = this.paletteOwner.GetSpan(); // On very rare occasions, (blur.png), the quantizer does not preserve a // transparent entry when palletizing the captured colors. @@ -112,7 +112,7 @@ public struct OctreeQuantizer : IQuantizer } this.octree.Palletize(paletteSpan, max, ref paletteIndex); - ReadOnlyMemory result = this.paletteOwner!.Memory[..paletteSpan.Length]; + ReadOnlyMemory result = this.paletteOwner.Memory[..paletteSpan.Length]; // When called multiple times by QuantizerUtilities.BuildPalette // this prevents memory churn caused by reallocation. @@ -157,8 +157,7 @@ public struct OctreeQuantizer : IQuantizer if (!this.isDisposed) { this.isDisposed = true; - this.paletteOwner?.Dispose(); - this.paletteOwner = null; + this.paletteOwner.Dispose(); this.pixelMap?.Dispose(); this.pixelMap = null; } diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs index e73c87896f..ea7413aab4 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs @@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization; internal struct PaletteQuantizer : IQuantizer where TPixel : unmanaged, IPixel { - private EuclideanPixelMap? pixelMap; + private EuclideanPixelMap pixelMap; /// /// Initializes a new instance of the struct. @@ -46,7 +46,7 @@ internal struct PaletteQuantizer : IQuantizer public QuantizerOptions Options { get; } /// - public ReadOnlyMemory Palette => this.pixelMap!.Palette; + public ReadOnlyMemory Palette => this.pixelMap.Palette; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -62,12 +62,11 @@ internal struct PaletteQuantizer : IQuantizer /// [MethodImpl(InliningOptions.ShortMethod)] public readonly byte GetQuantizedColor(TPixel color, out TPixel match) - => (byte)this.pixelMap!.GetClosestColor(color, out match); + => (byte)this.pixelMap.GetClosestColor(color, out match); /// public void Dispose() { - this.pixelMap?.Dispose(); - this.pixelMap = null; + this.pixelMap.Dispose(); } } From df803cd34de6284835f751419dd9d2be471431df Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Wed, 1 Feb 2023 07:39:36 +0100 Subject: [PATCH 9/9] Fix nullref the quantizier was initialized with default --> all properties are null. So we need to check that --- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 9cc045d45e..eaa6852937 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -171,7 +171,10 @@ internal sealed class GifEncoderCore : IImageEncoderInternals quantized = null; } - paletteQuantizer.Dispose(); + if (hasPaletteQuantizer) + { + paletteQuantizer.Dispose(); + } } private void EncodeFrame(