forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3142de
commit 3063947
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This class is a counterpart of VectorExtensions class in microsoft.windows.sdk.net.ref\WinRT.Runtime.dll | ||
// Please do not remove it as third-parties may depend on it. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Numerics; | ||
using System.Text; | ||
using Windows.Foundation; | ||
|
||
namespace System.Numerics; | ||
|
||
public static class VectorExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a <see cref="Vector2"/> to <see cref="Point"/> | ||
/// </summary> | ||
/// <param name="vector">The <see cref="Vector2"/> to convert</param> | ||
/// <returns>A <see cref="Point"/></returns> | ||
public static Point ToPoint(this Vector2 vector) => new Point(vector.X, vector.Y); | ||
|
||
/// <summary> | ||
/// Converts a <see cref="Vector2"/> to <see cref="Size"/> | ||
/// </summary> | ||
/// <param name="vector">The <see cref="Vector2"/> to convert</param> | ||
/// <returns>A <see cref="Size"/></returns> | ||
public static Size ToSize(this Vector2 vector) => new Size(vector.X, vector.Y); | ||
|
||
/// <summary> | ||
/// Converts a <see cref="Point"/> to <see cref="Vector2"/> | ||
/// </summary> | ||
/// <param name="point">The <see cref="Point"/> to Convert</param> | ||
/// <returns>A <see cref="Vector2"/></returns> | ||
public static Vector2 ToVector2(this Point point) => new Vector2((float)point.X, (float)point.Y); | ||
|
||
/// <summary> | ||
/// Converts a <see cref="Size"/> to <see cref="Vector2"/> | ||
/// </summary> | ||
/// <param name="point">The <see cref="Size"/> to Convert</param> | ||
/// <returns>A <see cref="Vector2"/></returns> | ||
public static Vector2 ToVector2(this Size size) => new Vector2((float)size.Width, (float)size.Height); | ||
} |