mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:58:49 +00:00
Add PointF.ToVector2 for .NET < 6
This commit is contained in:
parent
66a85d4f80
commit
d91a3d2a8c
@ -8,6 +8,7 @@
|
||||
- X10D: Added `Point.ToSizeF()`
|
||||
- X10D: Added `Point.ToVector2()`
|
||||
- X10D: Added `PointF.ToSizeF()`
|
||||
- X10D: Added `PointF.ToVector2()` for .NET < 6
|
||||
- X10D: Added `RoundUpToPowerOf2()` for built-in integer types
|
||||
- X10D: Added `Size.ToPoint()`
|
||||
- X10D: Added `Size.ToPointF()`
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace X10D.Drawing;
|
||||
@ -24,4 +25,18 @@ public static class PointFExtensions
|
||||
{
|
||||
return new SizeF(point.X, point.Y);
|
||||
}
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Converts the current <see cref="PointF" /> to a <see cref="Vector2" />.
|
||||
/// </summary>
|
||||
/// <param name="point">The point to convert.</param>
|
||||
/// <returns>The resulting <see cref="Vector2" />.</returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vector2 ToVector2(this PointF point)
|
||||
{
|
||||
return new Vector2(point.X, point.Y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user