1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/src/Artemis.UI.Shared/Extensions/SKRectExtensions.cs
Robert 65837e671a Device dialog - Added LEDs tab
General - Resolved lots of compile warnings (XML comments)
2022-06-19 14:19:03 +02:00

30 lines
980 B
C#

using Avalonia;
using SkiaSharp;
namespace Artemis.UI.Shared.Extensions;
/// <summary>
/// Provides utility methods when working with SkiaSharp rectangles.
/// </summary>
public static class SKRectExtensions
{
/// <summary>
/// Converts the rectangle to an Avalonia <see cref="Rect" />.
/// </summary>
/// <param name="rect">The rectangle to convert.</param>
/// <returns>The resulting Avalonia <see cref="Rect" />.</returns>
public static Rect ToRect(this SKRect rect)
{
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
}
/// <summary>
/// Converts the integer rectangle to an Avalonia <see cref="Rect" />.
/// </summary>
/// <param name="rect">The integer rectangle to convert.</param>
/// <returns>The resulting Avalonia <see cref="Rect" />.</returns>
public static Rect ToRect(this SKRectI rect)
{
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
}
}