@@ -5,32 +5,37 @@ namespace Synercoding.Primitives.Extensions;
5
5
/// </summary>
6
6
public static class RectangleExtensions
7
7
{
8
+ /// <summary>
9
+ /// Contract a given <see cref="Rectangle"/> (make smaller).
10
+ /// </summary>
11
+ /// <param name="rectangle">The <see cref="Rectangle"/> to contract.</param>
12
+ /// <param name="value">The amount to contract of each side of the <see cref="Size"/></param>
13
+ /// <returns>A new contracted <see cref="Rectangle"/>.</returns>
14
+ public static Rectangle Contract ( this Rectangle rectangle , Value value )
15
+ => rectangle . Contract ( new Spacing ( value ) ) ;
16
+
17
+ /// <summary>
18
+ /// Expand a given <see cref="Rectangle"/> (make bigger).
19
+ /// </summary>
20
+ /// <param name="rectangle">The <see cref="Rectangle"/> to expand.</param>
21
+ /// <param name="value">The amount to expand to each side of the <see cref="Size"/></param>
22
+ /// <returns>A new expanded <see cref="Rectangle"/>.</returns>
23
+ public static Rectangle Expand ( this Rectangle rectangle , Value value )
24
+ => rectangle . Expand ( new Spacing ( value ) ) ;
25
+
8
26
/// <summary>
9
27
/// Contract a given <see cref="Rectangle"/> (make smaller).
10
28
/// </summary>
11
29
/// <param name="rectangle">The <see cref="Rectangle"/> to contract.</param>
12
30
/// <param name="spacing">The amount of <see cref="Spacing"/> to contract on the sides.</param>
13
- /// <returns>A new contacted <see cref="Rectangle"/>.</returns>
31
+ /// <returns>A new contracted <see cref="Rectangle"/>.</returns>
14
32
public static Rectangle Contract ( this Rectangle rectangle , Spacing spacing )
15
33
=> new Rectangle (
16
34
llx : rectangle . LLX + spacing . Left ,
17
35
lly : rectangle . LLY + spacing . Bottom ,
18
36
urx : rectangle . URX - spacing . Right ,
19
37
ury : rectangle . URY - spacing . Top ) ;
20
38
21
- /// <summary>
22
- /// Contract a given <see cref="Rectangle"/> (make smaller).
23
- /// </summary>
24
- /// <param name="rectangle">The <see cref="Rectangle"/> to contract.</param>
25
- /// <param name="value">The amount of <see cref="Value"/> to contract on all sides.</param>
26
- /// <returns>A new contacted <see cref="Rectangle"/>.</returns>
27
- public static Rectangle Contract ( this Rectangle rectangle , Value value )
28
- => new Rectangle (
29
- llx : rectangle . LLX + value ,
30
- lly : rectangle . LLY + value ,
31
- urx : rectangle . URX - value ,
32
- ury : rectangle . URY - value ) ;
33
-
34
39
/// <summary>
35
40
/// Expand a given <see cref="Rectangle"/> (make bigger).
36
41
/// </summary>
@@ -44,19 +49,6 @@ public static Rectangle Expand(this Rectangle rectangle, Spacing spacing)
44
49
urx : rectangle . URX + spacing . Right ,
45
50
ury : rectangle . URY + spacing . Top ) ;
46
51
47
- /// <summary>
48
- /// Expand a given <see cref="Rectangle"/> (make bigger).
49
- /// </summary>
50
- /// <param name="rectangle">The rectangle to expand</param>
51
- /// <param name="value">The amount of <see cref="Value"/> to expand on all sides.</param>
52
- /// <returns>A new expanded <see cref="Rectangle"/>.</returns>
53
- public static Rectangle Expand ( this Rectangle rectangle , Value value )
54
- => new Rectangle (
55
- llx : rectangle . LLX - value ,
56
- lly : rectangle . LLY - value ,
57
- urx : rectangle . URX + value ,
58
- ury : rectangle . URY + value ) ;
59
-
60
52
/// <summary>
61
53
/// Get the raw values representing this <see cref="Rectangle"/> in a provided unit.
62
54
/// </summary>
0 commit comments