diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs index df18baf839..411dbe50cb 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessorHelpers.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable namespace SixLabors.ImageSharp.Processing.Processors.Convolution; @@ -99,7 +98,7 @@ internal static class ConvolutionProcessorHelpers /// The resulting 1D row vector, if possible. /// The resulting 1D column vector, if possible. /// Whether or not was linearly separable. - public static bool TryGetLinearlySeparableComponents(this DenseMatrix matrix, out float[] row, out float[] column) + public static bool TryGetLinearlySeparableComponents(this DenseMatrix matrix, out float[]? row, out float[]? column) { int height = matrix.Rows; int width = matrix.Columns; diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs index f03555bbaa..d900b2746a 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetector2DKernel.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable namespace SixLabors.ImageSharp.Processing.Processors.Convolution; @@ -88,7 +87,7 @@ public readonly struct EdgeDetector2DKernel : IEquatable => !(left == right); /// - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is EdgeDetector2DKernel kernel && this.Equals(kernel); /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs index d476ed9231..0c456eb88e 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorCompassKernel.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable namespace SixLabors.ImageSharp.Processing.Processors.Convolution; @@ -135,7 +134,7 @@ public readonly struct EdgeDetectorCompassKernel : IEquatable !(left == right); /// - public override bool Equals(object obj) => obj is EdgeDetectorCompassKernel kernel && this.Equals(kernel); + public override bool Equals(object? obj) => obj is EdgeDetectorCompassKernel kernel && this.Equals(kernel); /// public bool Equals(EdgeDetectorCompassKernel other) => this.North.Equals(other.North) && this.NorthWest.Equals(other.NorthWest) && this.West.Equals(other.West) && this.SouthWest.Equals(other.SouthWest) && this.South.Equals(other.South) && this.SouthEast.Equals(other.SouthEast) && this.East.Equals(other.East) && this.NorthEast.Equals(other.NorthEast); diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs index 9022dd044a..42a0c1cfe8 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Kernels/EdgeDetectorKernel.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable namespace SixLabors.ImageSharp.Processing.Processors.Convolution; @@ -64,7 +63,7 @@ public readonly struct EdgeDetectorKernel : IEquatable => !(left == right); /// - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is EdgeDetectorKernel kernel && this.Equals(kernel); /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs index 15ff8560e1..cb92dce4a7 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurParameters.cs @@ -1,6 +1,5 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -#nullable disable namespace SixLabors.ImageSharp.Processing.Processors.Convolution.Parameters; @@ -37,7 +36,7 @@ internal readonly struct BokehBlurParameters : IEquatable } /// - public override bool Equals(object obj) => obj is BokehBlurParameters other && this.Equals(other); + public override bool Equals(object? obj) => obj is BokehBlurParameters other && this.Equals(other); /// public override int GetHashCode() diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs index 5706f2d992..3a869a0a28 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.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; @@ -212,7 +211,7 @@ public readonly partial struct ErrorDither : IDither, IEquatable, I } /// - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is ErrorDither dither && this.Equals(dither); /// @@ -220,8 +219,8 @@ public readonly partial struct ErrorDither : IDither, IEquatable, I => this.offset == other.offset && this.matrix.Equals(other.matrix); /// - public bool Equals(IDither other) - => this.Equals((object)other); + public bool Equals(IDither? other) + => this.Equals((object?)other); /// public override int GetHashCode() diff --git a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs index b96427934d..1a02e7a221 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.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.Memory; @@ -200,7 +199,7 @@ public readonly partial struct OrderedDither : IDither, IEquatable - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is OrderedDither dither && this.Equals(dither); /// @@ -209,8 +208,8 @@ public readonly partial struct OrderedDither : IDither, IEquatable this.thresholdMatrix.Equals(other.thresholdMatrix) && this.modulusX == other.modulusX && this.modulusY == other.modulusY; /// - public bool Equals(IDither other) - => this.Equals((object)other); + public bool Equals(IDither? other) + => this.Equals((object?)other); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs index b95bbe3793..abf283e6c1 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessor{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; @@ -19,7 +18,7 @@ internal sealed class PaletteDitherProcessor : ImageProcessor { private readonly DitherProcessor ditherProcessor; private readonly IDither dither; - private IMemoryOwner paletteOwner; + private IMemoryOwner? paletteOwner; private bool isDisposed; /// @@ -62,7 +61,7 @@ internal sealed class PaletteDitherProcessor : ImageProcessor this.isDisposed = true; if (disposing) { - this.paletteOwner.Dispose(); + this.paletteOwner?.Dispose(); this.ditherProcessor.Dispose(); }