Skip to content

Commit a5920d6

Browse files
committed
Moved AdaptiveThreshold to IMagickImageCreateOperations.
1 parent 0c6df40 commit a5920d6

File tree

5 files changed

+100
-68
lines changed

5 files changed

+100
-68
lines changed

src/Magick.NET.Core/IMagickImage.cs

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -253,67 +253,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
253253
/// </summary>
254254
uint Width { get; }
255255

256-
/// <summary>
257-
/// Local adaptive threshold image.
258-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
259-
/// </summary>
260-
/// <param name="width">The width of the pixel neighborhood.</param>
261-
/// <param name="height">The height of the pixel neighborhood.</param>
262-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
263-
void AdaptiveThreshold(uint width, uint height);
264-
265-
/// <summary>
266-
/// Local adaptive threshold image.
267-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
268-
/// </summary>
269-
/// <param name="width">The width of the pixel neighborhood.</param>
270-
/// <param name="height">The height of the pixel neighborhood.</param>
271-
/// <param name="channels">The channel(s) that should be thresholded.</param>
272-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
273-
void AdaptiveThreshold(uint width, uint height, Channels channels);
274-
275-
/// <summary>
276-
/// Local adaptive threshold image.
277-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
278-
/// </summary>
279-
/// <param name="width">The width of the pixel neighborhood.</param>
280-
/// <param name="height">The height of the pixel neighborhood.</param>
281-
/// <param name="bias">Constant to subtract from pixel neighborhood mean (+/-)(0-QuantumRange).</param>
282-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
283-
void AdaptiveThreshold(uint width, uint height, double bias);
284-
285-
/// <summary>
286-
/// Local adaptive threshold image.
287-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
288-
/// </summary>
289-
/// <param name="width">The width of the pixel neighborhood.</param>
290-
/// <param name="height">The height of the pixel neighborhood.</param>
291-
/// <param name="bias">Constant to subtract from pixel neighborhood mean (+/-)(0-QuantumRange).</param>
292-
/// <param name="channels">The channel(s) that should be thresholded.</param>
293-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
294-
void AdaptiveThreshold(uint width, uint height, double bias, Channels channels);
295-
296-
/// <summary>
297-
/// Local adaptive threshold image.
298-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
299-
/// </summary>
300-
/// <param name="width">The width of the pixel neighborhood.</param>
301-
/// <param name="height">The height of the pixel neighborhood.</param>
302-
/// <param name="biasPercentage">Constant to subtract from pixel neighborhood mean.</param>
303-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
304-
void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage);
305-
306-
/// <summary>
307-
/// Local adaptive threshold image.
308-
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
309-
/// </summary>
310-
/// <param name="width">The width of the pixel neighborhood.</param>
311-
/// <param name="height">The height of the pixel neighborhood.</param>
312-
/// <param name="biasPercentage">Constant to subtract from pixel neighborhood mean.</param>
313-
/// <param name="channels">The channel(s) that should be thresholded.</param>
314-
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
315-
void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage, Channels channels);
316-
317256
/// <summary>
318257
/// Add noise to image with the specified noise type.
319258
/// </summary>

src/Magick.NET.Core/IMagickImageCreateOperations.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,67 @@ public interface IMagickImageCreateOperations
8484
/// <param name="channels">The channel(s) that should be sharpened.</param>
8585
void AdaptiveSharpen(double radius, double sigma, Channels channels);
8686

87+
/// <summary>
88+
/// Local adaptive threshold image.
89+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
90+
/// </summary>
91+
/// <param name="width">The width of the pixel neighborhood.</param>
92+
/// <param name="height">The height of the pixel neighborhood.</param>
93+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
94+
void AdaptiveThreshold(uint width, uint height);
95+
96+
/// <summary>
97+
/// Local adaptive threshold image.
98+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
99+
/// </summary>
100+
/// <param name="width">The width of the pixel neighborhood.</param>
101+
/// <param name="height">The height of the pixel neighborhood.</param>
102+
/// <param name="channels">The channel(s) that should be thresholded.</param>
103+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
104+
void AdaptiveThreshold(uint width, uint height, Channels channels);
105+
106+
/// <summary>
107+
/// Local adaptive threshold image.
108+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
109+
/// </summary>
110+
/// <param name="width">The width of the pixel neighborhood.</param>
111+
/// <param name="height">The height of the pixel neighborhood.</param>
112+
/// <param name="bias">Constant to subtract from pixel neighborhood mean (+/-)(0-QuantumRange).</param>
113+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
114+
void AdaptiveThreshold(uint width, uint height, double bias);
115+
116+
/// <summary>
117+
/// Local adaptive threshold image.
118+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
119+
/// </summary>
120+
/// <param name="width">The width of the pixel neighborhood.</param>
121+
/// <param name="height">The height of the pixel neighborhood.</param>
122+
/// <param name="bias">Constant to subtract from pixel neighborhood mean (+/-)(0-QuantumRange).</param>
123+
/// <param name="channels">The channel(s) that should be thresholded.</param>
124+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
125+
void AdaptiveThreshold(uint width, uint height, double bias, Channels channels);
126+
127+
/// <summary>
128+
/// Local adaptive threshold image.
129+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
130+
/// </summary>
131+
/// <param name="width">The width of the pixel neighborhood.</param>
132+
/// <param name="height">The height of the pixel neighborhood.</param>
133+
/// <param name="biasPercentage">Constant to subtract from pixel neighborhood mean.</param>
134+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
135+
void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage);
136+
137+
/// <summary>
138+
/// Local adaptive threshold image.
139+
/// http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm.
140+
/// </summary>
141+
/// <param name="width">The width of the pixel neighborhood.</param>
142+
/// <param name="height">The height of the pixel neighborhood.</param>
143+
/// <param name="biasPercentage">Constant to subtract from pixel neighborhood mean.</param>
144+
/// <param name="channels">The channel(s) that should be thresholded.</param>
145+
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
146+
void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage, Channels channels);
147+
87148
/// <summary>
88149
/// Resize image to specified size.
89150
/// <para />

src/Magick.NET/MagickImage.CloneMutator.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@ public void AdaptiveSharpen(double radius, double sigma)
6161
public void AdaptiveSharpen(double radius, double sigma, Channels channels)
6262
=> SetResult(NativeMagickImage.AdaptiveSharpen(radius, sigma, channels));
6363

64+
public void AdaptiveThreshold(uint width, uint height)
65+
=> AdaptiveThreshold(width, height, 0.0, ImageMagick.Channels.Undefined);
66+
67+
public void AdaptiveThreshold(uint width, uint height, Channels channels)
68+
=> AdaptiveThreshold(width, height, 0.0, channels);
69+
70+
public void AdaptiveThreshold(uint width, uint height, double bias)
71+
=> AdaptiveThreshold(width, height, bias, ImageMagick.Channels.Undefined);
72+
73+
public void AdaptiveThreshold(uint width, uint height, double bias, Channels channels)
74+
=> SetResult(NativeMagickImage.AdaptiveThreshold(width, height, bias, channels));
75+
76+
public void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage)
77+
=> AdaptiveThreshold(width, height, biasPercentage, ImageMagick.Channels.Undefined);
78+
79+
public void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage, Channels channels)
80+
=> AdaptiveThreshold(width, height, PercentageHelper.ToQuantum(nameof(biasPercentage), biasPercentage), channels);
81+
6482
public void Resize(uint width, uint height)
6583
=> Resize(new MagickGeometry(width, height));
6684

src/Magick.NET/MagickImage.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,10 @@ public void AdaptiveSharpen(double radius, double sigma, Channels channels)
10191019
/// <param name="height">The height of the pixel neighborhood.</param>
10201020
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
10211021
public void AdaptiveThreshold(uint width, uint height)
1022-
=> AdaptiveThreshold(width, height, 0.0, ImageMagick.Channels.Undefined);
1022+
{
1023+
using var mutator = new Mutator(_nativeInstance);
1024+
mutator.AdaptiveThreshold(width, height);
1025+
}
10231026

10241027
/// <summary>
10251028
/// Local adaptive threshold image.
@@ -1030,7 +1033,10 @@ public void AdaptiveThreshold(uint width, uint height)
10301033
/// <param name="channels">The channel(s) that should be thresholded.</param>
10311034
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
10321035
public void AdaptiveThreshold(uint width, uint height, Channels channels)
1033-
=> AdaptiveThreshold(width, height, 0.0, channels);
1036+
{
1037+
using var mutator = new Mutator(_nativeInstance);
1038+
mutator.AdaptiveThreshold(width, height, channels);
1039+
}
10341040

10351041
/// <summary>
10361042
/// Local adaptive threshold image.
@@ -1041,7 +1047,10 @@ public void AdaptiveThreshold(uint width, uint height, Channels channels)
10411047
/// <param name="bias">Constant to subtract from pixel neighborhood mean (+/-)(0-QuantumRange).</param>
10421048
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
10431049
public void AdaptiveThreshold(uint width, uint height, double bias)
1044-
=> AdaptiveThreshold(width, height, bias, ImageMagick.Channels.Undefined);
1050+
{
1051+
using var mutator = new Mutator(_nativeInstance);
1052+
mutator.AdaptiveThreshold(width, height, bias);
1053+
}
10451054

10461055
/// <summary>
10471056
/// Local adaptive threshold image.
@@ -1053,7 +1062,10 @@ public void AdaptiveThreshold(uint width, uint height, double bias)
10531062
/// <param name="channels">The channel(s) that should be thresholded.</param>
10541063
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
10551064
public void AdaptiveThreshold(uint width, uint height, double bias, Channels channels)
1056-
=> _nativeInstance.AdaptiveThreshold(width, height, bias, channels);
1065+
{
1066+
using var mutator = new Mutator(_nativeInstance);
1067+
mutator.AdaptiveThreshold(width, height, bias, channels);
1068+
}
10571069

10581070
/// <summary>
10591071
/// Local adaptive threshold image.
@@ -1064,7 +1076,10 @@ public void AdaptiveThreshold(uint width, uint height, double bias, Channels cha
10641076
/// <param name="biasPercentage">Constant to subtract from pixel neighborhood mean.</param>
10651077
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
10661078
public void AdaptiveThreshold(uint width, uint height, Percentage biasPercentage)
1067-
=> AdaptiveThreshold(width, height, biasPercentage, ImageMagick.Channels.Undefined);
1079+
{
1080+
using var mutator = new Mutator(_nativeInstance);
1081+
mutator.AdaptiveThreshold(width, height, biasPercentage);
1082+
}
10681083

10691084
/// <summary>
10701085
/// Local adaptive threshold image.

src/Magick.NET/Native/MagickImage.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
236236
public partial IntPtr AdaptiveSharpen(double radius, double sigma, Channels channels);
237237

238238
[Throws]
239-
[SetInstance]
240-
public partial void AdaptiveThreshold(nuint width, nuint height, double bias, Channels channels);
239+
public partial IntPtr AdaptiveThreshold(nuint width, nuint height, double bias, Channels channels);
241240

242241
[Throws]
243242
[SetInstance]

0 commit comments

Comments
 (0)