diff --git a/CHANGELOG.md b/CHANGELOG.md index 372df5b..427732f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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()` diff --git a/X10D/src/Drawing/PointFExtensions.cs b/X10D/src/Drawing/PointFExtensions.cs index a961042..cb9d3ac 100644 --- a/X10D/src/Drawing/PointFExtensions.cs +++ b/X10D/src/Drawing/PointFExtensions.cs @@ -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 + /// + /// Converts the current to a . + /// + /// The point to convert. + /// The resulting . + [Pure] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vector2 ToVector2(this PointF point) + { + return new Vector2(point.X, point.Y); + } +#endif }