Skip to content

Commit

Permalink
Moved Minify to IMagickImageCreateOperations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Dec 20, 2024
1 parent d4a8944 commit fb84acd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
6 changes: 0 additions & 6 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,12 +1322,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void MedianFilter(uint radius);

/// <summary>
/// Reduce image by integral size.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Minify();

/// <summary>
/// Returns the points that form the minimum bounding box around the image foreground objects with
/// the "Rotating Calipers" algorithm. he method also returns these properties: minimum-bounding-box:area,
Expand Down
6 changes: 6 additions & 0 deletions src/Magick.NET.Core/IMagickImageCreateOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,12 @@ public interface IMagickImageCreateOperations
/// <param name="colorDistance">The color distance.</param>
void MeanShift(uint width, uint height, Percentage colorDistance);

/// <summary>
/// Reduce image by integral size.
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Minify();

/// <summary>
/// Resize image to specified size.
/// <para />
Expand Down
3 changes: 3 additions & 0 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ public void MeanShift(uint width, uint height)
public void MeanShift(uint width, uint height, Percentage colorDistance)
=> SetResult(NativeMagickImage.MeanShift(width, height, PercentageHelper.ToQuantum(nameof(colorDistance), colorDistance)));

public void Minify()
=> SetResult(NativeMagickImage.Minify());

public void LiquidRescale(Percentage percentageWidth, Percentage percentageHeight, double deltaX, double rigidity)
{
var geometry = new MagickGeometry(percentageWidth, percentageHeight);
Expand Down
5 changes: 4 additions & 1 deletion src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4126,7 +4126,10 @@ public void MedianFilter(uint radius)
/// </summary>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
public void Minify()
=> _nativeInstance.Minify();
{
using var mutator = new Mutator(_nativeInstance);
mutator.Minify();
}

/// <summary>
/// Returns the points that form the minimum bounding box around the image foreground objects with
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 @@ -523,8 +523,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
public partial IntPtr MeanShift(nuint width, nuint height, double colorDistance);

[Throws]
[SetInstance]
public partial void Minify();
public partial IntPtr Minify();

[Throws]
[Cleanup(Name = "ImageMagick.Moments.DisposeList")]
Expand Down

0 comments on commit fb84acd

Please sign in to comment.