/
PointExtensions.cs
45 lines (41 loc) · 1.77 KB
/
PointExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System.Windows;
namespace Splat
{
/// <summary>
/// A set of extension methods which will convert between System.Drawing point's and a native point classes.
/// </summary>
public static class PointExtensions
{
/// <summary>
/// Convert a <see cref="System.Drawing.Point"/> to the android native <see cref="Point"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <returns>A <see cref="Point"/> of the value.</returns>
public static Point ToNative(this System.Drawing.Point value)
{
return new Point(value.X, value.Y);
}
/// <summary>
/// Convert a <see cref="System.Drawing.PointF"/> to the android native <see cref="Point"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <returns>A <see cref="Point"/> of the value.</returns>
public static Point ToNative(this System.Drawing.PointF value)
{
return new Point(value.X, value.Y);
}
/// <summary>
/// Converts a <see cref="Point"/> to a <see cref="System.Drawing.PointF"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <returns>A <see cref="System.Drawing.PointF"/> of the value.</returns>
public static System.Drawing.PointF FromNative(this Point value)
{
return new System.Drawing.PointF((float)value.X, (float)value.Y);
}
}
}