Skip to content

Commit d4a8944

Browse files
committed
Moved MeanShift to IMagickImageCreateOperations.
1 parent fc39901 commit d4a8944

File tree

5 files changed

+58
-35
lines changed

5 files changed

+58
-35
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,34 +1309,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
13091309
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
13101310
void Lower(uint size);
13111311

1312-
/// <summary>
1313-
/// Delineate arbitrarily shaped clusters in the image.
1314-
/// </summary>
1315-
/// <param name="size">The width and height of the pixels neighborhood.</param>
1316-
void MeanShift(uint size);
1317-
1318-
/// <summary>
1319-
/// Delineate arbitrarily shaped clusters in the image.
1320-
/// </summary>
1321-
/// <param name="size">The width and height of the pixels neighborhood.</param>
1322-
/// <param name="colorDistance">The color distance.</param>
1323-
void MeanShift(uint size, Percentage colorDistance);
1324-
1325-
/// <summary>
1326-
/// Delineate arbitrarily shaped clusters in the image.
1327-
/// </summary>
1328-
/// <param name="width">The width of the pixels neighborhood.</param>
1329-
/// <param name="height">The height of the pixels neighborhood.</param>
1330-
void MeanShift(uint width, uint height);
1331-
1332-
/// <summary>
1333-
/// Delineate arbitrarily shaped clusters in the image.
1334-
/// </summary>
1335-
/// <param name="width">The width of the pixels neighborhood.</param>
1336-
/// <param name="height">The height of the pixels neighborhood.</param>
1337-
/// <param name="colorDistance">The color distance.</param>
1338-
void MeanShift(uint width, uint height, Percentage colorDistance);
1339-
13401312
/// <summary>
13411313
/// Filter image by replacing each pixel component with the median color in a circular neighborhood.
13421314
/// </summary>

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,34 @@ public interface IMagickImageCreateOperations
696696
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
697697
void Magnify();
698698

699+
/// <summary>
700+
/// Delineate arbitrarily shaped clusters in the image.
701+
/// </summary>
702+
/// <param name="size">The width and height of the pixels neighborhood.</param>
703+
void MeanShift(uint size);
704+
705+
/// <summary>
706+
/// Delineate arbitrarily shaped clusters in the image.
707+
/// </summary>
708+
/// <param name="size">The width and height of the pixels neighborhood.</param>
709+
/// <param name="colorDistance">The color distance.</param>
710+
void MeanShift(uint size, Percentage colorDistance);
711+
712+
/// <summary>
713+
/// Delineate arbitrarily shaped clusters in the image.
714+
/// </summary>
715+
/// <param name="width">The width of the pixels neighborhood.</param>
716+
/// <param name="height">The height of the pixels neighborhood.</param>
717+
void MeanShift(uint width, uint height);
718+
719+
/// <summary>
720+
/// Delineate arbitrarily shaped clusters in the image.
721+
/// </summary>
722+
/// <param name="width">The width of the pixels neighborhood.</param>
723+
/// <param name="height">The height of the pixels neighborhood.</param>
724+
/// <param name="colorDistance">The color distance.</param>
725+
void MeanShift(uint width, uint height, Percentage colorDistance);
726+
699727
/// <summary>
700728
/// Resize image to specified size.
701729
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,18 @@ public void LiquidRescale(Percentage percentageWidth, Percentage percentageHeigh
386386
public void Magnify()
387387
=> SetResult(NativeMagickImage.Magnify());
388388

389+
public void MeanShift(uint size)
390+
=> MeanShift(size, size);
391+
392+
public void MeanShift(uint size, Percentage colorDistance)
393+
=> MeanShift(size, size, colorDistance);
394+
395+
public void MeanShift(uint width, uint height)
396+
=> MeanShift(width, height, new Percentage(10));
397+
398+
public void MeanShift(uint width, uint height, Percentage colorDistance)
399+
=> SetResult(NativeMagickImage.MeanShift(width, height, PercentageHelper.ToQuantum(nameof(colorDistance), colorDistance)));
400+
389401
public void LiquidRescale(Percentage percentageWidth, Percentage percentageHeight, double deltaX, double rigidity)
390402
{
391403
var geometry = new MagickGeometry(percentageWidth, percentageHeight);

src/Magick.NET/MagickImage.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,7 +4057,7 @@ public void Lower(uint size)
40574057
/// </summary>
40584058
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
40594059
public void Magnify()
4060-
{
4060+
{
40614061
using var mutator = new Mutator(_nativeInstance);
40624062
mutator.Magnify();
40634063
}
@@ -4067,23 +4067,32 @@ public void Magnify()
40674067
/// </summary>
40684068
/// <param name="size">The width and height of the pixels neighborhood.</param>
40694069
public void MeanShift(uint size)
4070-
=> MeanShift(size, size);
4070+
{
4071+
using var mutator = new Mutator(_nativeInstance);
4072+
mutator.MeanShift(size);
4073+
}
40714074

40724075
/// <summary>
40734076
/// Delineate arbitrarily shaped clusters in the image.
40744077
/// </summary>
40754078
/// <param name="size">The width and height of the pixels neighborhood.</param>
40764079
/// <param name="colorDistance">The color distance.</param>
40774080
public void MeanShift(uint size, Percentage colorDistance)
4078-
=> MeanShift(size, size, colorDistance);
4081+
{
4082+
using var mutator = new Mutator(_nativeInstance);
4083+
mutator.MeanShift(size, colorDistance);
4084+
}
40794085

40804086
/// <summary>
40814087
/// Delineate arbitrarily shaped clusters in the image.
40824088
/// </summary>
40834089
/// <param name="width">The width of the pixels neighborhood.</param>
40844090
/// <param name="height">The height of the pixels neighborhood.</param>
40854091
public void MeanShift(uint width, uint height)
4086-
=> MeanShift(width, height, new Percentage(10));
4092+
{
4093+
using var mutator = new Mutator(_nativeInstance);
4094+
mutator.MeanShift(width, height);
4095+
}
40874096

40884097
/// <summary>
40894098
/// Delineate arbitrarily shaped clusters in the image.
@@ -4092,7 +4101,10 @@ public void MeanShift(uint width, uint height)
40924101
/// <param name="height">The height of the pixels neighborhood.</param>
40934102
/// <param name="colorDistance">The color distance.</param>
40944103
public void MeanShift(uint width, uint height, Percentage colorDistance)
4095-
=> _nativeInstance.MeanShift(width, height, PercentageHelper.ToQuantum(nameof(colorDistance), colorDistance));
4104+
{
4105+
using var mutator = new Mutator(_nativeInstance);
4106+
mutator.MeanShift(width, height, colorDistance);
4107+
}
40964108

40974109
/// <summary>
40984110
/// Filter image by replacing each pixel component with the median color in a circular neighborhood.

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
520520
public partial IntPtr Magnify();
521521

522522
[Throws]
523-
[SetInstance]
524-
public partial void MeanShift(nuint width, nuint height, double colorDistance);
523+
public partial IntPtr MeanShift(nuint width, nuint height, double colorDistance);
525524

526525
[Throws]
527526
[SetInstance]

0 commit comments

Comments
 (0)