Skip to content

Commit 3bd1efb

Browse files
Normalize parameter order.
1 parent 430ceee commit 3bd1efb

File tree

14 files changed

+113
-132
lines changed

14 files changed

+113
-132
lines changed

src/ImageSharp/Processing/Extensions/Convolution/BokehBlurExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public static IImageProcessingContext BokehBlur(this IImageProcessingContext sou
4444
/// Applies a bokeh blur to the image.
4545
/// </summary>
4646
/// <param name="source">The current image processing context.</param>
47-
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
48-
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
49-
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
5047
/// <param name="rectangle">
5148
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
5249
/// </param>
50+
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
51+
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
52+
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
5353
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
54-
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, Rectangle rectangle)
54+
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, Rectangle rectangle, int radius, int components, float gamma)
5555
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma), rectangle);
5656
}

src/ImageSharp/Processing/Extensions/Convolution/BoxBlurExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public static IImageProcessingContext BoxBlur(this IImageProcessingContext sourc
4444
/// Applies a box blur to the image.
4545
/// </summary>
4646
/// <param name="source">The current image processing context.</param>
47-
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
4847
/// <param name="rectangle">
4948
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
5049
/// </param>
50+
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
5151
/// <param name="borderWrapModeX">
5252
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in X direction.
5353
/// </param>
@@ -57,8 +57,8 @@ public static IImageProcessingContext BoxBlur(this IImageProcessingContext sourc
5757
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
5858
public static IImageProcessingContext BoxBlur(
5959
this IImageProcessingContext source,
60-
int radius,
6160
Rectangle rectangle,
61+
int radius,
6262
BorderWrappingMode borderWrapModeX,
6363
BorderWrappingMode borderWrapModeY)
6464
=> source.ApplyProcessor(new BoxBlurProcessor(radius, borderWrapModeX, borderWrapModeY), rectangle);

src/ImageSharp/Processing/Extensions/Convolution/DetectEdgesExtensions.cs

Lines changed: 46 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public static class DetectEdgesExtensions
1616
/// </summary>
1717
/// <param name="source">The current image processing context.</param>
1818
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
19-
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source) =>
20-
DetectEdges(source, KnownEdgeDetectorKernels.Sobel);
19+
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source)
20+
=> DetectEdges(source, KnownEdgeDetectorKernels.Sobel);
2121

2222
/// <summary>
2323
/// Detects any edges within the image.
@@ -28,21 +28,17 @@ public static IImageProcessingContext DetectEdges(this IImageProcessingContext s
2828
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
2929
/// </param>
3030
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
31-
public static IImageProcessingContext DetectEdges(
32-
this IImageProcessingContext source,
33-
Rectangle rectangle) =>
34-
DetectEdges(source, KnownEdgeDetectorKernels.Sobel, rectangle);
31+
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, Rectangle rectangle)
32+
=> DetectEdges(source, rectangle, KnownEdgeDetectorKernels.Sobel);
3533

3634
/// <summary>
3735
/// Detects any edges within the image operating in grayscale mode.
3836
/// </summary>
3937
/// <param name="source">The current image processing context.</param>
4038
/// <param name="kernel">The 2D edge detector kernel.</param>
4139
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
42-
public static IImageProcessingContext DetectEdges(
43-
this IImageProcessingContext source,
44-
EdgeDetector2DKernel kernel) =>
45-
DetectEdges(source, kernel, true);
40+
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetector2DKernel kernel)
41+
=> DetectEdges(source, kernel, true);
4642

4743
/// <summary>
4844
/// Detects any edges within the image using a <see cref="EdgeDetector2DKernel"/>.
@@ -57,60 +53,50 @@ public static IImageProcessingContext DetectEdges(
5753
this IImageProcessingContext source,
5854
EdgeDetector2DKernel kernel,
5955
bool grayscale)
60-
{
61-
var processor = new EdgeDetector2DProcessor(kernel, grayscale);
62-
source.ApplyProcessor(processor);
63-
return source;
64-
}
56+
=> source.ApplyProcessor(new EdgeDetector2DProcessor(kernel, grayscale));
6557

6658
/// <summary>
6759
/// Detects any edges within the image operating in grayscale mode.
6860
/// </summary>
6961
/// <param name="source">The current image processing context.</param>
70-
/// <param name="kernel">The 2D edge detector kernel.</param>
7162
/// <param name="rectangle">
7263
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
7364
/// </param>
65+
/// <param name="kernel">The 2D edge detector kernel.</param>
7466
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
7567
public static IImageProcessingContext DetectEdges(
7668
this IImageProcessingContext source,
77-
EdgeDetector2DKernel kernel,
78-
Rectangle rectangle) =>
79-
DetectEdges(source, kernel, true, rectangle);
69+
Rectangle rectangle,
70+
EdgeDetector2DKernel kernel)
71+
=> DetectEdges(source, rectangle, kernel, true);
8072

8173
/// <summary>
8274
/// Detects any edges within the image using a <see cref="EdgeDetector2DKernel"/>.
8375
/// </summary>
8476
/// <param name="source">The current image processing context.</param>
77+
/// <param name="rectangle">
78+
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
79+
/// </param>
8580
/// <param name="kernel">The 2D edge detector kernel.</param>
8681
/// <param name="grayscale">
8782
/// Whether to convert the image to grayscale before performing edge detection.
8883
/// </param>
89-
/// <param name="rectangle">
90-
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
91-
/// </param>
9284
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
9385
public static IImageProcessingContext DetectEdges(
9486
this IImageProcessingContext source,
87+
Rectangle rectangle,
9588
EdgeDetector2DKernel kernel,
96-
bool grayscale,
97-
Rectangle rectangle)
98-
{
99-
var processor = new EdgeDetector2DProcessor(kernel, grayscale);
100-
source.ApplyProcessor(processor, rectangle);
101-
return source;
102-
}
89+
bool grayscale)
90+
=> source.ApplyProcessor(new EdgeDetector2DProcessor(kernel, grayscale), rectangle);
10391

10492
/// <summary>
10593
/// Detects any edges within the image operating in grayscale mode.
10694
/// </summary>
10795
/// <param name="source">The current image processing context.</param>
10896
/// <param name="kernel">The edge detector kernel.</param>
10997
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
110-
public static IImageProcessingContext DetectEdges(
111-
this IImageProcessingContext source,
112-
EdgeDetectorKernel kernel) =>
113-
DetectEdges(source, kernel, true);
98+
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetectorKernel kernel)
99+
=> DetectEdges(source, kernel, true);
114100

115101
/// <summary>
116102
/// Detects any edges within the image using a <see cref="EdgeDetectorKernel"/>.
@@ -125,66 +111,56 @@ public static IImageProcessingContext DetectEdges(
125111
this IImageProcessingContext source,
126112
EdgeDetectorKernel kernel,
127113
bool grayscale)
128-
{
129-
var processor = new EdgeDetectorProcessor(kernel, grayscale);
130-
source.ApplyProcessor(processor);
131-
return source;
132-
}
114+
=> source.ApplyProcessor(new EdgeDetectorProcessor(kernel, grayscale));
133115

134116
/// <summary>
135117
/// Detects any edges within the image operating in grayscale mode.
136118
/// </summary>
137119
/// <param name="source">The current image processing context.</param>
138-
/// <param name="kernel">The edge detector kernel.</param>
139120
/// <param name="rectangle">
140121
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
141122
/// </param>
123+
/// <param name="kernel">The edge detector kernel.</param>
142124
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
143125
public static IImageProcessingContext DetectEdges(
144126
this IImageProcessingContext source,
145-
EdgeDetectorKernel kernel,
146-
Rectangle rectangle) =>
147-
DetectEdges(source, kernel, true, rectangle);
127+
Rectangle rectangle,
128+
EdgeDetectorKernel kernel)
129+
=> DetectEdges(source, rectangle, kernel, true);
148130

149131
/// <summary>
150132
/// Detects any edges within the image using a <see cref="EdgeDetectorKernel"/>.
151133
/// </summary>
152134
/// <param name="source">The current image processing context.</param>
135+
/// <param name="rectangle">
136+
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
137+
/// </param>
153138
/// <param name="kernel">The edge detector kernel.</param>
154139
/// <param name="grayscale">
155140
/// Whether to convert the image to grayscale before performing edge detection.
156141
/// </param>
157-
/// <param name="rectangle">
158-
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
159-
/// </param>
160142
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
161143
public static IImageProcessingContext DetectEdges(
162144
this IImageProcessingContext source,
145+
Rectangle rectangle,
163146
EdgeDetectorKernel kernel,
164-
bool grayscale,
165-
Rectangle rectangle)
166-
{
167-
var processor = new EdgeDetectorProcessor(kernel, grayscale);
168-
source.ApplyProcessor(processor, rectangle);
169-
return source;
170-
}
147+
bool grayscale)
148+
=> source.ApplyProcessor(new EdgeDetectorProcessor(kernel, grayscale), rectangle);
171149

172150
/// <summary>
173151
/// Detects any edges within the image operating in grayscale mode.
174152
/// </summary>
175153
/// <param name="source">The current image processing context.</param>
176-
/// <param name="kernel">Thecompass edge detector kernel.</param>
154+
/// <param name="kernel">The compass edge detector kernel.</param>
177155
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
178-
public static IImageProcessingContext DetectEdges(
179-
this IImageProcessingContext source,
180-
EdgeDetectorCompassKernel kernel) =>
181-
DetectEdges(source, kernel, true);
156+
public static IImageProcessingContext DetectEdges(this IImageProcessingContext source, EdgeDetectorCompassKernel kernel)
157+
=> DetectEdges(source, kernel, true);
182158

183159
/// <summary>
184160
/// Detects any edges within the image using a <see cref="EdgeDetectorCompassKernel"/>.
185161
/// </summary>
186162
/// <param name="source">The current image processing context.</param>
187-
/// <param name="kernel">Thecompass edge detector kernel.</param>
163+
/// <param name="kernel">The compass edge detector kernel.</param>
188164
/// <param name="grayscale">
189165
/// Whether to convert the image to grayscale before performing edge detection.
190166
/// </param>
@@ -193,47 +169,39 @@ public static IImageProcessingContext DetectEdges(
193169
this IImageProcessingContext source,
194170
EdgeDetectorCompassKernel kernel,
195171
bool grayscale)
196-
{
197-
var processor = new EdgeDetectorCompassProcessor(kernel, grayscale);
198-
source.ApplyProcessor(processor);
199-
return source;
200-
}
172+
=> source.ApplyProcessor(new EdgeDetectorCompassProcessor(kernel, grayscale));
201173

202174
/// <summary>
203175
/// Detects any edges within the image operating in grayscale mode.
204176
/// </summary>
205177
/// <param name="source">The current image processing context.</param>
206-
/// <param name="kernel">Thecompass edge detector kernel.</param>
207178
/// <param name="rectangle">
208179
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
209180
/// </param>
181+
/// <param name="kernel">The compass edge detector kernel.</param>
210182
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
211183
public static IImageProcessingContext DetectEdges(
212184
this IImageProcessingContext source,
213-
EdgeDetectorCompassKernel kernel,
214-
Rectangle rectangle) =>
215-
DetectEdges(source, kernel, true, rectangle);
185+
Rectangle rectangle,
186+
EdgeDetectorCompassKernel kernel)
187+
=> DetectEdges(source, rectangle, kernel, true);
216188

217189
/// <summary>
218190
/// Detects any edges within the image using a <see cref="EdgeDetectorCompassKernel"/>.
219191
/// </summary>
220192
/// <param name="source">The current image processing context.</param>
221-
/// <param name="kernel">Thecompass edge detector kernel.</param>
222-
/// <param name="grayscale">
223-
/// Whether to convert the image to grayscale before performing edge detection.
224-
/// </param>
225193
/// <param name="rectangle">
226194
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
227195
/// </param>
196+
/// <param name="kernel">The compass edge detector kernel.</param>
197+
/// <param name="grayscale">
198+
/// Whether to convert the image to grayscale before performing edge detection.
199+
/// </param>
228200
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
229201
public static IImageProcessingContext DetectEdges(
230202
this IImageProcessingContext source,
203+
Rectangle rectangle,
231204
EdgeDetectorCompassKernel kernel,
232-
bool grayscale,
233-
Rectangle rectangle)
234-
{
235-
var processor = new EdgeDetectorCompassProcessor(kernel, grayscale);
236-
source.ApplyProcessor(processor, rectangle);
237-
return source;
238-
}
205+
bool grayscale)
206+
=> source.ApplyProcessor(new EdgeDetectorCompassProcessor(kernel, grayscale), rectangle);
239207
}

src/ImageSharp/Processing/Extensions/Convolution/GaussianBlurExtensions.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,37 @@ public static IImageProcessingContext GaussianBlur(this IImageProcessingContext
3232
/// Applies a Gaussian blur to the image.
3333
/// </summary>
3434
/// <param name="source">The current image processing context.</param>
35-
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
3635
/// <param name="rectangle">
3736
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
3837
/// </param>
38+
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
3939
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
40-
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle)
40+
public static IImageProcessingContext GaussianBlur(
41+
this IImageProcessingContext source,
42+
Rectangle rectangle,
43+
float sigma)
4144
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle);
4245

4346
/// <summary>
4447
/// Applies a Gaussian blur to the image.
4548
/// </summary>
4649
/// <param name="source">The current image processing context.</param>
47-
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
4850
/// <param name="rectangle">
4951
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
5052
/// </param>
53+
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
5154
/// <param name="borderWrapModeX">
5255
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in X direction.
5356
/// </param>
5457
/// <param name="borderWrapModeY">
5558
/// The <see cref="BorderWrappingMode"/> to use when mapping the pixels outside of the border, in Y direction.
5659
/// </param>
5760
/// <returns>The <see cref="IImageProcessingContext"/>.</returns>
58-
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle, BorderWrappingMode borderWrapModeX, BorderWrappingMode borderWrapModeY)
59-
{
60-
GaussianBlurProcessor processor = new(sigma, borderWrapModeX, borderWrapModeY);
61-
return source.ApplyProcessor(processor, rectangle);
62-
}
61+
public static IImageProcessingContext GaussianBlur(
62+
this IImageProcessingContext source,
63+
Rectangle rectangle,
64+
float sigma,
65+
BorderWrappingMode borderWrapModeX,
66+
BorderWrappingMode borderWrapModeY)
67+
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma, borderWrapModeX, borderWrapModeY), rectangle);
6368
}

0 commit comments

Comments
 (0)