Skip to content

Commit 3addc93

Browse files
committed
Move Clamp back to IMagickImage because it doesn't set return a new instance.
1 parent d2534f1 commit 3addc93

File tree

5 files changed

+20
-32
lines changed

5 files changed

+20
-32
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,23 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
393393
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
394394
void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit);
395395

396+
/// <summary>
397+
/// Set each pixel whose value is below zero to zero and any the pixel whose value is above
398+
/// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value
399+
/// remains unchanged.
400+
/// </summary>
401+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
402+
void Clamp();
403+
404+
/// <summary>
405+
/// Set each pixel whose value is below zero to zero and any the pixel whose value is above
406+
/// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value
407+
/// remains unchanged.
408+
/// </summary>
409+
/// <param name="channels">The channel(s) to clamp.</param>
410+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
411+
void Clamp(Channels channels);
412+
396413
/// <summary>
397414
/// Sets the image clip mask based on any clipping path information if it exists. The clipping
398415
/// path can be removed with <see cref="RemoveWriteMask"/>. This operating takes effect inside

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -328,23 +328,6 @@ public interface IMagickImageCreateOperations
328328
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
329329
void ChopVertical(int offset, uint height);
330330

331-
/// <summary>
332-
/// Set each pixel whose value is below zero to zero and any the pixel whose value is above
333-
/// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value
334-
/// remains unchanged.
335-
/// </summary>
336-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
337-
void Clamp();
338-
339-
/// <summary>
340-
/// Set each pixel whose value is below zero to zero and any the pixel whose value is above
341-
/// the quantum range to the quantum range (Quantum.Max) otherwise the pixel value
342-
/// remains unchanged.
343-
/// </summary>
344-
/// <param name="channels">The channel(s) to clamp.</param>
345-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
346-
void Clamp(Channels channels);
347-
348331
/// <summary>
349332
/// Resize image to specified size.
350333
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ public void ChopHorizontal(int offset, uint width)
173173
public void ChopVertical(int offset, uint height)
174174
=> Chop(new MagickGeometry(0, offset, 0, height));
175175

176-
public void Clamp()
177-
=> Clamp(ImageMagick.Channels.Undefined);
178-
179-
public void Clamp(Channels channels)
180-
=> SetResult(NativeMagickImage.Clamp(channels));
181-
182176
public void Colorize(IMagickColor<QuantumType> color, Percentage alpha)
183177
{
184178
Throw.IfNegative(nameof(alpha), alpha);

src/Magick.NET/MagickImage.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,10 +1549,7 @@ public void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit)
15491549
/// </summary>
15501550
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
15511551
public void Clamp()
1552-
{
1553-
using var mutator = new Mutator(_nativeInstance);
1554-
mutator.Clamp();
1555-
}
1552+
=> Clamp(ImageMagick.Channels.Undefined);
15561553

15571554
/// <summary>
15581555
/// 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()
15621559
/// <param name="channels">The channel(s) to clamp.</param>
15631560
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
15641561
public void Clamp(Channels channels)
1565-
{
1566-
using var mutator = new Mutator(_nativeInstance);
1567-
mutator.Clamp(channels);
1568-
}
1562+
=> _nativeInstance.Clamp(channels);
15691563

15701564
/// <summary>
15711565
/// Sets the image clip mask based on any clipping path information if it exists. The clipping

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
295295
public partial void Clahe(nuint xTiles, nuint yTiles, nuint numberBins, double clipLimit);
296296

297297
[Throws]
298-
public partial IntPtr Clamp(Channels channels);
298+
public partial void Clamp(Channels channels);
299299

300300
[Throws]
301301
public partial void ClipPath(string pathName, bool inside);

0 commit comments

Comments
 (0)