Skip to content

Commit d4f4736

Browse files
committed
Moved Clamp to IMagickImageCreateOperations.
1 parent 619b9d9 commit d4f4736

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -393,23 +393,6 @@ 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-
413396
/// <summary>
414397
/// Sets the image clip mask based on any clipping path information if it exists. The clipping
415398
/// path can be removed with <see cref="RemoveWriteMask"/>. This operating takes effect inside

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,23 @@ 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+
331348
/// <summary>
332349
/// Resize image to specified size.
333350
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

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

175+
public void Clamp()
176+
=> Clamp(ImageMagick.Channels.Undefined);
177+
178+
public void Clamp(Channels channels)
179+
=> SetResult(NativeMagickImage.Clamp(channels));
180+
175181
public void Resize(uint width, uint height)
176182
=> Resize(new MagickGeometry(width, height));
177183

src/Magick.NET/MagickImage.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,10 @@ 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-
=> Clamp(ImageMagick.Channels.Undefined);
1552+
{
1553+
using var mutator = new Mutator(_nativeInstance);
1554+
mutator.Clamp();
1555+
}
15531556

15541557
/// <summary>
15551558
/// Set each pixel whose value is below zero to zero and any the pixel whose value is above
@@ -1559,7 +1562,10 @@ public void Clamp()
15591562
/// <param name="channels">The channel(s) to clamp.</param>
15601563
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
15611564
public void Clamp(Channels channels)
1562-
=> _nativeInstance.Clamp(channels);
1565+
{
1566+
using var mutator = new Mutator(_nativeInstance);
1567+
mutator.Clamp(channels);
1568+
}
15631569

15641570
/// <summary>
15651571
/// 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +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-
[SetInstance]
299-
public partial void Clamp(Channels channels);
298+
public partial IntPtr Clamp(Channels channels);
300299

301300
[Throws]
302301
public partial void ClipPath(string pathName, bool inside);

0 commit comments

Comments
 (0)