Skip to content

Commit

Permalink
Move Clamp back to IMagickImage because it doesn't set return a new i…
Browse files Browse the repository at this point in the history
…nstance.
  • Loading branch information
dlemstra committed Nov 11, 2024
1 parent d2534f1 commit 3addc93
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
17 changes: 17 additions & 0 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,23 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit);

/// <summary>
/// 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.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Clamp();

/// <summary>
/// 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.
/// </summary>
/// <param name="channels">The channel(s) to clamp.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Clamp(Channels channels);

/// <summary>
/// Sets the image clip mask based on any clipping path information if it exists. The clipping
/// path can be removed with <see cref="RemoveWriteMask"/>. This operating takes effect inside
Expand Down
17 changes: 0 additions & 17 deletions src/Magick.NET.Core/IMagickImageCreateOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,23 +328,6 @@ public interface IMagickImageCreateOperations
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void ChopVertical(int offset, uint height);

/// <summary>
/// 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.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Clamp();

/// <summary>
/// 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.
/// </summary>
/// <param name="channels">The channel(s) to clamp.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Clamp(Channels channels);

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
6 changes: 0 additions & 6 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<QuantumType> color, Percentage alpha)
{
Throw.IfNegative(nameof(alpha), alpha);
Expand Down
10 changes: 2 additions & 8 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,10 +1549,7 @@ public void Clahe(uint xTiles, uint yTiles, uint numberBins, double clipLimit)
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Clamp()
{
using var mutator = new Mutator(_nativeInstance);
mutator.Clamp();
}
=> Clamp(ImageMagick.Channels.Undefined);

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

/// <summary>
/// Sets the image clip mask based on any clipping path information if it exists. The clipping
Expand Down
2 changes: 1 addition & 1 deletion src/Magick.NET/Native/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3addc93

Please sign in to comment.