Skip to content

Commit cd37fe7

Browse files
committed
Moved Blur to IMagickImageCreateOperations.
1 parent 532cba5 commit cd37fe7

File tree

5 files changed

+59
-36
lines changed

5 files changed

+59
-36
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -348,36 +348,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
348348
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
349349
void BlackThreshold(Percentage threshold, Channels channels);
350350

351-
/// <summary>
352-
/// Blur image with the default blur factor (0x1).
353-
/// </summary>
354-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
355-
void Blur();
356-
357-
/// <summary>
358-
/// Blur the the specified channel(s) of the image with the default blur factor (0x1).
359-
/// </summary>
360-
/// <param name="channels">The channel(s) that should be blurred.</param>
361-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
362-
void Blur(Channels channels);
363-
364-
/// <summary>
365-
/// Blur image with specified blur factor.
366-
/// </summary>
367-
/// <param name="radius">The radius of the Gaussian in pixels, not counting the center pixel.</param>
368-
/// <param name="sigma">The standard deviation of the Laplacian, in pixels.</param>
369-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
370-
void Blur(double radius, double sigma);
371-
372-
/// <summary>
373-
/// Blur the specified channel(s) of the image with the specified blur factor.
374-
/// </summary>
375-
/// <param name="radius">The radius of the Gaussian in pixels, not counting the center pixel.</param>
376-
/// <param name="sigma">The standard deviation of the Laplacian, in pixels.</param>
377-
/// <param name="channels">The channel(s) that should be blurred.</param>
378-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
379-
void Blur(double radius, double sigma, Channels channels);
380-
381351
/// <summary>
382352
/// Add a border to the image.
383353
/// </summary>

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,36 @@ public interface IMagickImageCreateOperations
223223
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
224224
void BlueShift(double factor);
225225

226+
/// <summary>
227+
/// Blur image with the default blur factor (0x1).
228+
/// </summary>
229+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
230+
void Blur();
231+
232+
/// <summary>
233+
/// Blur the the specified channel(s) of the image with the default blur factor (0x1).
234+
/// </summary>
235+
/// <param name="channels">The channel(s) that should be blurred.</param>
236+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
237+
void Blur(Channels channels);
238+
239+
/// <summary>
240+
/// Blur image with specified blur factor.
241+
/// </summary>
242+
/// <param name="radius">The radius of the Gaussian in pixels, not counting the center pixel.</param>
243+
/// <param name="sigma">The standard deviation of the Laplacian, in pixels.</param>
244+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
245+
void Blur(double radius, double sigma);
246+
247+
/// <summary>
248+
/// Blur the specified channel(s) of the image with the specified blur factor.
249+
/// </summary>
250+
/// <param name="radius">The radius of the Gaussian in pixels, not counting the center pixel.</param>
251+
/// <param name="sigma">The standard deviation of the Laplacian, in pixels.</param>
252+
/// <param name="channels">The channel(s) that should be blurred.</param>
253+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
254+
void Blur(double radius, double sigma, Channels channels);
255+
226256
/// <summary>
227257
/// Resize image to specified size.
228258
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ public void BlueShift()
117117
public void BlueShift(double factor)
118118
=> SetResult(NativeMagickImage.BlueShift(factor));
119119

120+
public void Blur()
121+
=> Blur(0.0, 1.0);
122+
123+
public void Blur(Channels channels)
124+
=> Blur(0.0, 1.0, channels);
125+
126+
public void Blur(double radius, double sigma)
127+
=> Blur(radius, sigma, ImageMagick.Channels.Undefined);
128+
129+
public void Blur(double radius, double sigma, Channels channels)
130+
=> SetResult(NativeMagickImage.Blur(radius, sigma, channels));
131+
120132
public void Resize(uint width, uint height)
121133
=> Resize(new MagickGeometry(width, height));
122134

src/Magick.NET/MagickImage.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,15 +1337,21 @@ public void BlueShift(double factor)
13371337
/// </summary>
13381338
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
13391339
public void Blur()
1340-
=> Blur(0.0, 1.0);
1340+
{
1341+
using var mutator = new Mutator(_nativeInstance);
1342+
mutator.Blur();
1343+
}
13411344

13421345
/// <summary>
13431346
/// Blur the specified channel(s) of the image with the default blur factor (0x1).
13441347
/// </summary>
13451348
/// <param name="channels">The channel(s) that should be blurred.</param>
13461349
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
13471350
public void Blur(Channels channels)
1348-
=> Blur(0.0, 1.0, channels);
1351+
{
1352+
using var mutator = new Mutator(_nativeInstance);
1353+
mutator.Blur(channels);
1354+
}
13491355

13501356
/// <summary>
13511357
/// Blur image with specified blur factor.
@@ -1354,7 +1360,10 @@ public void Blur(Channels channels)
13541360
/// <param name="sigma">The standard deviation of the Laplacian, in pixels.</param>
13551361
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
13561362
public void Blur(double radius, double sigma)
1357-
=> Blur(radius, sigma, ImageMagick.Channels.Undefined);
1363+
{
1364+
using var mutator = new Mutator(_nativeInstance);
1365+
mutator.Blur(radius, sigma);
1366+
}
13581367

13591368
/// <summary>
13601369
/// Blur the specified channel(s) of the image with the specified blur factor.
@@ -1364,7 +1373,10 @@ public void Blur(double radius, double sigma)
13641373
/// <param name="channels">The channel(s) that should be blurred.</param>
13651374
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
13661375
public void Blur(double radius, double sigma, Channels channels)
1367-
=> _nativeInstance.Blur(radius, sigma, channels);
1376+
{
1377+
using var mutator = new Mutator(_nativeInstance);
1378+
mutator.Blur(radius, sigma, channels);
1379+
}
13681380

13691381
/// <summary>
13701382
/// Add a border to the image.

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
272272
public partial IntPtr BlueShift(double factor);
273273

274274
[Throws]
275-
[SetInstance]
276-
public partial void Blur(double radius, double sigma, Channels channels);
275+
public partial IntPtr Blur(double radius, double sigma, Channels channels);
277276

278277
[Throws]
279278
[SetInstance]

0 commit comments

Comments
 (0)