diff --git a/SpineViewer/Extensions/SFMLExtension.cs b/Spine/Exporters/Extension.cs similarity index 69% rename from SpineViewer/Extensions/SFMLExtension.cs rename to Spine/Exporters/Extension.cs index 6882a3a..f6295a0 100644 --- a/SpineViewer/Extensions/SFMLExtension.cs +++ b/Spine/Exporters/Extension.cs @@ -1,18 +1,14 @@ using SFML.Graphics; using SFML.System; -using SkiaSharp; using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -using System.Windows; -namespace SpineViewer.Extensions +namespace Spine.Exporters { - public static class SFMLExtension + public static class Extension { /// /// 获取适合指定画布参数下能够覆盖包围盒的画布视区包围盒 @@ -53,31 +49,11 @@ namespace SpineViewer.Extensions public static FloatRect GetBounds(this View self) { return new( - self.Center.X - self.Size.X / 2, - self.Center.Y - self.Size.Y / 2, - self.Size.X, + self.Center.X - self.Size.X / 2, + self.Center.Y - self.Size.Y / 2, + self.Size.X, 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); - } } } diff --git a/SpineViewer/Extensions/WpfExtension.cs b/SpineViewer/Extensions/WpfExtension.cs index d5cd487..9ce86e0 100644 --- a/SpineViewer/Extensions/WpfExtension.cs +++ b/SpineViewer/Extensions/WpfExtension.cs @@ -1,19 +1,41 @@ -using SkiaSharp; +using SFML.Graphics; +using SFML.System; +using SkiaSharp; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -using System.Windows.Media; using System.Windows; +using System.Windows.Media; using System.Windows.Media.Imaging; -using System.Runtime.InteropServices; namespace SpineViewer.Extensions { 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); + } + /// /// 从本地 WebP 文件读取,并保留透明度,返回一个可以直接用于 WPF Image.Source 的 BitmapSource。 ///