diff --git a/src/Magick.NET.Core/IMagickImage.cs b/src/Magick.NET.Core/IMagickImage.cs index 54af0b5b7f..5c1b591295 100644 --- a/src/Magick.NET.Core/IMagickImage.cs +++ b/src/Magick.NET.Core/IMagickImage.cs @@ -393,6 +393,23 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl /// Thrown when an error is raised by ImageMagick. void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit); + /// + /// Set each pixel whose value is below zero to zero and any the pixel whose value is above + /// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value + /// remains unchanged. + /// + /// Thrown when an error is raised by ImageMagick. + void Clamp(); + + /// + /// Set each pixel whose value is below zero to zero and any the pixel whose value is above + /// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value + /// remains unchanged. + /// + /// The channel(s) to clamp. + /// Thrown when an error is raised by ImageMagick. + void Clamp(Channels channels); + /// /// Sets the image clip mask based on any clipping path information if it exists. The clipping /// path can be removed with . This operating takes effect inside diff --git a/src/Magick.NET.Core/IMagickImageCreateOperations.cs b/src/Magick.NET.Core/IMagickImageCreateOperations.cs index dee5dc3e2e..131d2c247b 100644 --- a/src/Magick.NET.Core/IMagickImageCreateOperations.cs +++ b/src/Magick.NET.Core/IMagickImageCreateOperations.cs @@ -328,23 +328,6 @@ public interface IMagickImageCreateOperations /// Thrown when an error is raised by ImageMagick. void ChopVertical(int offset, uint height); - /// - /// Set each pixel whose value is below zero to zero and any the pixel whose value is above - /// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value - /// remains unchanged. - /// - /// Thrown when an error is raised by ImageMagick. - void Clamp(); - - /// - /// Set each pixel whose value is below zero to zero and any the pixel whose value is above - /// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value - /// remains unchanged. - /// - /// The channel(s) to clamp. - /// Thrown when an error is raised by ImageMagick. - void Clamp(Channels channels); - /// /// Resize image to specified size. /// diff --git a/src/Magick.NET/MagickImage.CloneMutator.cs b/src/Magick.NET/MagickImage.CloneMutator.cs index d672fef77f..d0b9230bdf 100644 --- a/src/Magick.NET/MagickImage.CloneMutator.cs +++ b/src/Magick.NET/MagickImage.CloneMutator.cs @@ -173,12 +173,6 @@ public void ChopHorizontal(int offset, uint width) public void ChopVertical(int offset, uint height) => Chop(new MagickGeometry(0, offset, 0, height)); - public void Clamp() - => Clamp(ImageMagick.Channels.Undefined); - - public void Clamp(Channels channels) - => SetResult(NativeMagickImage.Clamp(channels)); - public void Colorize(IMagickColor color, Percentage alpha) { Throw.IfNegative(nameof(alpha), alpha); diff --git a/src/Magick.NET/MagickImage.cs b/src/Magick.NET/MagickImage.cs index 2f9355ff8b..c5e424c255 100644 --- a/src/Magick.NET/MagickImage.cs +++ b/src/Magick.NET/MagickImage.cs @@ -1549,10 +1549,7 @@ public void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit) /// /// Thrown when an error is raised by ImageMagick. public void Clamp() - { - using var mutator = new Mutator(_nativeInstance); - mutator.Clamp(); - } + => Clamp(ImageMagick.Channels.Undefined); /// /// Set each pixel whose value is below zero to zero and any the pixel whose value is above @@ -1562,10 +1559,7 @@ public void Clamp() /// The channel(s) to clamp. /// Thrown when an error is raised by ImageMagick. public void Clamp(Channels channels) - { - using var mutator = new Mutator(_nativeInstance); - mutator.Clamp(channels); - } + => _nativeInstance.Clamp(channels); /// /// Sets the image clip mask based on any clipping path information if it exists. The clipping diff --git a/src/Magick.NET/Native/MagickImage.cs b/src/Magick.NET/Native/MagickImage.cs index c75c44b0f5..2e22a2bd9b 100644 --- a/src/Magick.NET/Native/MagickImage.cs +++ b/src/Magick.NET/Native/MagickImage.cs @@ -295,7 +295,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM public partial void Clahe(nuint xTiles, nuint yTiles, nuint numberBins, double clipLimit); [Throws] - public partial IntPtr Clamp(Channels channels); + public partial void Clamp(Channels channels); [Throws] public partial void ClipPath(string pathName, bool inside);