Skip to content

Commit

Permalink
Moved Wave to IMagickImageCreateOperations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Jan 2, 2025
1 parent 785cdc7 commit 843abfc
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
15 changes: 0 additions & 15 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2220,21 +2220,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Trim(Percentage percentBackground);

/// <summary>
/// Map image pixels to a sine wave.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Wave();

/// <summary>
/// Map image pixels to a sine wave.
/// </summary>
/// <param name="method">The pixel interpolate method.</param>
/// <param name="amplitude">The amplitude.</param>
/// <param name="length">The length of the wave.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Wave(PixelInterpolateMethod method, double amplitude, double length);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions src/Magick.NET.Core/IMagickImageCreateOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,4 +1263,19 @@ public interface IMagickImageCreateOperations
/// <param name="y">the y ellipse offset.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Vignette(double radius, double sigma, int x, int y);

/// <summary>
/// Map image pixels to a sine wave.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Wave();

/// <summary>
/// Map image pixels to a sine wave.
/// </summary>
/// <param name="method">The pixel interpolate method.</param>
/// <param name="amplitude">The amplitude.</param>
/// <param name="length">The length of the wave.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Wave(PixelInterpolateMethod method, double amplitude, double length);
}
6 changes: 6 additions & 0 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ public void Vignette()
public void Vignette(double radius, double sigma, int x, int y)
=> SetResult(NativeMagickImage.Vignette(radius, sigma, x, y));

public void Wave()
=> Wave(NativeMagickImage.Interpolate_Get(), 25.0, 150.0);

public void Wave(PixelInterpolateMethod method, double amplitude, double length)
=> SetResult(NativeMagickImage.Wave(method, amplitude, length));

protected virtual void SetResult(IntPtr result)
{
if (_result != IntPtr.Zero)
Expand Down
10 changes: 8 additions & 2 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6942,7 +6942,10 @@ public void Vignette(double radius, double sigma, int x, int y)
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Wave()
=> Wave(Interpolate, 25.0, 150.0);
{
using var mutator = new Mutator(_nativeInstance);
mutator.Wave();
}

/// <summary>
/// Map image pixels to a sine wave.
Expand All @@ -6952,7 +6955,10 @@ public void Wave()
/// <param name="length">The length of the wave.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Wave(PixelInterpolateMethod method, double amplitude, double length)
=> _nativeInstance.Wave(method, amplitude, length);
{
using var mutator = new Mutator(_nativeInstance);
mutator.Wave(method, amplitude, length);
}

/// <summary>
/// Removes noise from the image using a wavelet transform.
Expand Down
3 changes: 1 addition & 2 deletions src/Magick.NET/Native/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
public partial IntPtr Vignette(double radius, double sigma, nint x, nint y);

[Throws]
[SetInstance]
public partial void Wave(PixelInterpolateMethod method, double amplitude, double length);
public partial IntPtr Wave(PixelInterpolateMethod method, double amplitude, double length);

[Throws]
public partial void WhiteBalance();
Expand Down

0 comments on commit 843abfc

Please sign in to comment.