Skip to content

Commit 4f72fcc

Browse files
committed
Moved BilateralBlur to IMagickImageCreateOperations.
1 parent fda09a0 commit 4f72fcc

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,24 +331,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
331331
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
332332
void AutoThreshold(AutoThresholdMethod method);
333333

334-
/// <summary>
335-
/// Applies a non-linear, edge-preserving, and noise-reducing smoothing filter.
336-
/// </summary>
337-
/// <param name="width">The width of the neighborhood in pixels.</param>
338-
/// <param name="height">The height of the neighborhood in pixels.</param>
339-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
340-
void BilateralBlur(uint width, uint height);
341-
342-
/// <summary>
343-
/// Applies a non-linear, edge-preserving, and noise-reducing smoothing filter.
344-
/// </summary>
345-
/// <param name="width">The width of the neighborhood in pixels.</param>
346-
/// <param name="height">The height of the neighborhood in pixels.</param>
347-
/// <param name="intensitySigma">The sigma in the intensity space.</param>
348-
/// <param name="spatialSigma">The sigma in the coordinate space.</param>
349-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
350-
void BilateralBlur(uint width, uint height, double intensitySigma, double spatialSigma);
351-
352334
/// <summary>
353335
/// Forces all pixels below the threshold into black while leaving all pixels at or above
354336
/// the threshold unchanged.

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ public interface IMagickImageCreateOperations
192192
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
193193
void AutoOrient();
194194

195+
/// <summary>
196+
/// Applies a non-linear, edge-preserving, and noise-reducing smoothing filter.
197+
/// </summary>
198+
/// <param name="width">The width of the neighborhood in pixels.</param>
199+
/// <param name="height">The height of the neighborhood in pixels.</param>
200+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
201+
void BilateralBlur(uint width, uint height);
202+
203+
/// <summary>
204+
/// Applies a non-linear, edge-preserving, and noise-reducing smoothing filter.
205+
/// </summary>
206+
/// <param name="width">The width of the neighborhood in pixels.</param>
207+
/// <param name="height">The height of the neighborhood in pixels.</param>
208+
/// <param name="intensitySigma">The sigma in the intensity space.</param>
209+
/// <param name="spatialSigma">The sigma in the coordinate space.</param>
210+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
211+
void BilateralBlur(uint width, uint height, double intensitySigma, double spatialSigma);
212+
195213
/// <summary>
196214
/// Resize image to specified size.
197215
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ public void AffineTransform(IDrawableAffine affineMatrix)
102102
public void AutoOrient()
103103
=> SetResult(NativeMagickImage.AutoOrient());
104104

105+
public void BilateralBlur(uint width, uint height)
106+
{
107+
var intensitySigma = Math.Sqrt((width * width) + (height * height));
108+
BilateralBlur(width, height, intensitySigma, intensitySigma * 0.25);
109+
}
110+
111+
public void BilateralBlur(uint width, uint height, double intensitySigma, double spatialSigma)
112+
=> SetResult(NativeMagickImage.BilateralBlur(width, height, intensitySigma, spatialSigma));
113+
105114
public void Resize(uint width, uint height)
106115
=> Resize(new MagickGeometry(width, height));
107116

src/Magick.NET/MagickImage.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,8 @@ public void AutoThreshold(AutoThresholdMethod method)
12701270
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
12711271
public void BilateralBlur(uint width, uint height)
12721272
{
1273-
var intensitySigma = Math.Sqrt((width * width) + (height * height));
1274-
BilateralBlur(width, height, intensitySigma, intensitySigma * 0.25);
1273+
using var mutator = new Mutator(_nativeInstance);
1274+
mutator.BilateralBlur(width, height);
12751275
}
12761276

12771277
/// <summary>
@@ -1283,7 +1283,10 @@ public void BilateralBlur(uint width, uint height)
12831283
/// <param name="spatialSigma">The sigma in the coordinate space.</param>
12841284
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
12851285
public void BilateralBlur(uint width, uint height, double intensitySigma, double spatialSigma)
1286-
=> _nativeInstance.BilateralBlur(width, height, intensitySigma, spatialSigma);
1286+
{
1287+
using var mutator = new Mutator(_nativeInstance);
1288+
mutator.BilateralBlur(width, height, intensitySigma, spatialSigma);
1289+
}
12871290

12881291
/// <summary>
12891292
/// Forces all pixels below the threshold into black while leaving all pixels at or above

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
263263
public partial void AutoThreshold(AutoThresholdMethod method);
264264

265265
[Throws]
266-
[SetInstance]
267-
public partial void BilateralBlur(nuint width, nuint height, double intensitySigma, double spatialSigma);
266+
public partial IntPtr BilateralBlur(nuint width, nuint height, double intensitySigma, double spatialSigma);
268267

269268
[Throws]
270269
public partial void BlackThreshold(string threshold, Channels channels);

0 commit comments

Comments
 (0)