This commit is contained in:
ww-rm
2025-10-26 13:26:47 +08:00
parent 7ca431b214
commit c4956b9c16
2 changed files with 30 additions and 32 deletions

View File

@@ -1,18 +1,14 @@
using SFML.Graphics; using SFML.Graphics;
using SFML.System; using SFML.System;
using SkiaSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
namespace SpineViewer.Extensions namespace Spine.Exporters
{ {
public static class SFMLExtension public static class Extension
{ {
/// <summary> /// <summary>
/// 获取适合指定画布参数下能够覆盖包围盒的画布视区包围盒 /// 获取适合指定画布参数下能够覆盖包围盒的画布视区包围盒
@@ -59,25 +55,5 @@ namespace SpineViewer.Extensions
self.Size.Y self.Size.Y
); );
} }
public static FloatRect ToFloatRect(this Rect self)
{
return new((float)self.X, (float)self.Y, (float)self.Width, (float)self.Height);
}
public static Vector2f ToVector2f(this Size self)
{
return new((float)self.Width, (float)self.Height);
}
public static Vector2u ToVector2u(this Size self)
{
return new((uint)self.Width, (uint)self.Height);
}
public static Vector2i ToVector2i(this Size self)
{
return new((int)self.Width, (int)self.Height);
}
} }
} }

View File

@@ -1,19 +1,41 @@
using SkiaSharp; using SFML.Graphics;
using SFML.System;
using SkiaSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows; using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Runtime.InteropServices;
namespace SpineViewer.Extensions namespace SpineViewer.Extensions
{ {
public static class WpfExtension public static class WpfExtension
{ {
public static FloatRect ToFloatRect(this Rect self)
{
return new((float)self.X, (float)self.Y, (float)self.Width, (float)self.Height);
}
public static Vector2f ToVector2f(this Size self)
{
return new((float)self.Width, (float)self.Height);
}
public static Vector2u ToVector2u(this Size self)
{
return new((uint)self.Width, (uint)self.Height);
}
public static Vector2i ToVector2i(this Size self)
{
return new((int)self.Width, (int)self.Height);
}
/// <summary> /// <summary>
/// 从本地 WebP 文件读取,并保留透明度,返回一个可以直接用于 WPF Image.Source 的 BitmapSource。 /// 从本地 WebP 文件读取,并保留透明度,返回一个可以直接用于 WPF Image.Source 的 BitmapSource。
/// </summary> /// </summary>