Skip to content

Commit ad9a34f

Browse files
committed
Added more AsRaw extensions
1 parent 82af9d1 commit ad9a34f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Synercoding.Primitives.Extensions
2+
{
3+
/// <summary>
4+
/// Extensions methods for <see cref="Point"/>
5+
/// </summary>
6+
public static class PointExtensions
7+
{
8+
/// <summary>
9+
/// Get the raw values representing this Point in a provided unit
10+
/// </summary>
11+
/// <param name="point">The point to get in raw format</param>
12+
/// <param name="unit">The unit to get the result in.</param>
13+
/// <returns>A tuple representing the raw values.</returns>
14+
public static (double X, double Y) AsRaw(this Point point, Unit unit)
15+
=> (point.X.AsRaw(unit), point.Y.AsRaw(unit));
16+
}
17+
}

src/Synercoding.Primitives/Extensions/SizeExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ public static Rectangle AsRectangle(this Size size)
4242
/// <returns>A new size with width and height switched</returns>
4343
public static Size Rotate(this Size size)
4444
=> new Size(size.Height, size.Width);
45+
46+
/// <summary>
47+
/// Get the raw values representing this Size in a provided unit
48+
/// </summary>
49+
/// <param name="size">The size to get in raw format</param>
50+
/// <param name="unit">The unit to get the result in.</param>
51+
/// <returns>A tuple representing the raw values.</returns>
52+
public static (double Width, double Height) AsRaw(this Size size, Unit unit)
53+
=> (size.Width.AsRaw(unit), size.Height.AsRaw(unit));
4554
}
4655
}

0 commit comments

Comments
 (0)