Skip to content

Commit 0a31f09

Browse files
committed
Moved Despeckle to IMagickImageCreateOperations.
1 parent 8c3f237 commit 0a31f09

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
867867
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
868868
void Decipher(string passphrase);
869869

870-
/// <summary>
871-
/// Despeckle image (reduce speckle noise).
872-
/// </summary>
873-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
874-
void Despeckle();
875-
876870
/// <summary>
877871
/// Determines the bit depth (bits allocated to red/green/blue components). Use the Depth
878872
/// property to get the current value.

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ public interface IMagickImageCreateOperations
400400
/// <returns>The angle that was used.</returns>
401401
double DeskewAndCrop(Percentage threshold);
402402

403+
/// <summary>
404+
/// Despeckle image (reduce speckle noise).
405+
/// </summary>
406+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
407+
void Despeckle();
408+
403409
/// <summary>
404410
/// Resize image to specified size.
405411
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,22 @@ public void Crop(uint width, uint height, Gravity gravity)
215215
public void Crop(IMagickGeometry geometry)
216216
=> Crop(geometry, Gravity.Undefined);
217217

218-
public double Deskew(Percentage threshold)
219-
=> Deskew(threshold, autoCrop: false);
220-
221-
public double DeskewAndCrop(Percentage threshold)
222-
=> Deskew(threshold, autoCrop: true);
223-
224218
public void Crop(IMagickGeometry geometry, Gravity gravity)
225219
{
226220
Throw.IfNull(nameof(geometry), geometry);
227221

228222
SetResult(NativeMagickImage.Crop(geometry.ToString(), gravity));
229223
}
230224

225+
public double Deskew(Percentage threshold)
226+
=> Deskew(threshold, autoCrop: false);
227+
228+
public double DeskewAndCrop(Percentage threshold)
229+
=> Deskew(threshold, autoCrop: true);
230+
231+
public void Despeckle()
232+
=> SetResult(NativeMagickImage.Despeckle());
233+
231234
public void Resize(uint width, uint height)
232235
=> Resize(new MagickGeometry(width, height));
233236

src/Magick.NET/MagickImage.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2545,7 +2545,10 @@ public double DeskewAndCrop(Percentage threshold)
25452545
/// </summary>
25462546
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
25472547
public void Despeckle()
2548-
=> _nativeInstance.Despeckle();
2548+
{
2549+
using var mutator = new Mutator(_nativeInstance);
2550+
mutator.Despeckle();
2551+
}
25492552

25502553
/// <summary>
25512554
/// Determines the bit depth (bits allocated to red/green/blue components). Use the Depth

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
368368
public partial IntPtr Deskew(double threshold);
369369

370370
[Throws]
371-
[SetInstance]
372-
public partial void Despeckle();
371+
public partial IntPtr Despeckle();
373372

374373
[Throws]
375374
public partial nuint DetermineBitDepth(Channels channels);

0 commit comments

Comments
 (0)