Skip to content

Commit eab0091

Browse files
committed
Make extension methods public
1 parent 7125301 commit eab0091

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

source/MonoGame.Aseprite/Utils/AsepriteDotNetExtensions.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,50 @@
1212

1313
namespace MonoGame.Aseprite.Utils;
1414

15-
internal static class AsepriteDotNetExtensions
15+
/// <summary>
16+
/// Defines extension methods for translating between AsepriteDotNet types to MonoGame types.
17+
/// </summary>
18+
public static class AsepriteDotNetExtensions
1619
{
17-
internal static Texture2D ToTexture2D(this AseTexture texture, GraphicsDevice device)
20+
/// <summary>
21+
/// Converts an AsepriteDotNet Texture to a MonoGame Texture2D object.
22+
/// </summary>
23+
/// <param name="texture">The AsepriteDotNet texture to convert.</param>
24+
/// <param name="device">The graphics device used to create graphical resources.</param>
25+
/// <returns>The converted MonoGame Texture2D object.</returns>
26+
public static Texture2D ToTexture2D(this AseTexture texture, GraphicsDevice device)
1827
{
1928
Texture2D texture2D = new Texture2D(device, texture.Size.Width, texture.Size.Height);
2029
texture2D.Name = texture.Name;
2130
texture2D.SetData(texture.Pixels.ToArray());
2231
return texture2D;
2332
}
2433

25-
internal unsafe static Color ToXnaColor(this AseColor color) => Unsafe.As<AseColor, Color>(ref color);
34+
/// <summary>
35+
/// Converts an AsepriteDotNet color to a MonoGame Color object.
36+
/// </summary>
37+
/// <param name="color">The AsepriteDotNet color to convert.</param>
38+
/// <returns>The converted MonoGame Color object.</returns>
39+
public unsafe static Color ToXnaColor(this AseColor color) => Unsafe.As<AseColor, Color>(ref color);
2640

27-
internal static Point ToXnaPoint(this AsePoint point) => new Point(point.X, point.Y);
41+
/// <summary>
42+
/// Converts an AsepriteDotNet point to a MonoGame Point object.
43+
/// </summary>
44+
/// <param name="point">The AsepriteDotNet point to convert.</param>
45+
/// <returns>The converted MonoGame Point object.</returns>
46+
public static Point ToXnaPoint(this AsePoint point) => new Point(point.X, point.Y);
2847

29-
internal static Vector2 ToXnaVector2(this AsePoint point) => new Vector2(point.X, point.Y);
30-
internal static Rectangle ToXnaRectangle(this AseRectangle rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
48+
/// <summary>
49+
/// Converts an AsepriteDotNet point to a MonoGame Vector2 object.
50+
/// </summary>
51+
/// <param name="point">The AsepriteDotNet point to convert.</param>
52+
/// <returns>The converted MonoGame Vector2 object.</returns>
53+
public static Vector2 ToXnaVector2(this AsePoint point) => new Vector2(point.X, point.Y);
54+
55+
/// <summary>
56+
/// Converts an AsepriteDotNet rectangle to a MonoGame Rectangle object.
57+
/// </summary>
58+
/// <param name="rect">The AsepriteDotNet rectangle to convert.</param>
59+
/// <returns>The converted MonoGame Rectangle object.</returns>
60+
public static Rectangle ToXnaRectangle(this AseRectangle rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
3161
}

0 commit comments

Comments
 (0)