Skip to content

Commit

Permalink
Moved Resample to IMagickImageCreateOperations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Dec 27, 2024
1 parent adbc98c commit dec7dd9
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 @@ -1857,21 +1857,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void RemoveWriteMask();

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
/// <param name="resolutionX">The new X resolution.</param>
/// <param name="resolutionY">The new Y resolution.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Resample(double resolutionX, double resolutionY);

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
/// <param name="density">The density to use.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Resample(PointD density);

/// <summary>
/// Resets the page property of this image.
/// </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 @@ -760,6 +760,21 @@ public interface IMagickImageCreateOperations
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void OilPaint(double radius, double sigma);

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
/// <param name="resolutionX">The new X resolution.</param>
/// <param name="resolutionY">The new Y resolution.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Resample(double resolutionX, double resolutionY);

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
/// <param name="density">The density to use.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Resample(PointD density);

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
6 changes: 6 additions & 0 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ public void Resize(IMagickGeometry geometry)
SetResult(NativeMagickImage.Resize(geometry.ToString()));
}

public void Resample(double resolutionX, double resolutionY)
=> SetResult(NativeMagickImage.Resample(resolutionX, resolutionY));

public void Resample(PointD density)
=> Resample(density.X, density.Y);

public void Resize(Percentage percentage)
=> Resize(new MagickGeometry(percentage, percentage));

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 @@ -5399,15 +5399,21 @@ public void RemoveWriteMask()
/// <param name="resolutionY">The new Y resolution.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Resample(double resolutionX, double resolutionY)
=> _nativeInstance.Resample(resolutionX, resolutionY);
{
using var mutator = new Mutator(_nativeInstance);
mutator.Resample(resolutionX, resolutionY);
}

/// <summary>
/// Resize image in terms of its pixel size.
/// </summary>
/// <param name="density">The density to use.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Resample(PointD density)
=> Resample(density.X, density.Y);
{
using var mutator = new Mutator(_nativeInstance);
mutator.Resample(density);
}

/// <summary>
/// Resets the page property of this image.
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 @@ -624,8 +624,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
public partial void ResetProfileIterator();

[Throws]
[SetInstance]
public partial void Resample(double resolutionX, double resolutionY);
public partial IntPtr Resample(double resolutionX, double resolutionY);

[Throws]
public partial IntPtr Resize(string geometry);
Expand Down

0 comments on commit dec7dd9

Please sign in to comment.