Skip to content

Commit

Permalink
Modify Sprite processing function as an extension function
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Apr 10, 2020
1 parent b10d03d commit 4a81c46
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion AssetStudioGUI/AssetStudioGUIForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ private void PreviewMesh(Mesh m_Mesh)

private void PreviewSprite(AssetItem assetItem, Sprite m_Sprite)
{
var bitmap = SpriteHelper.GetImageFromSprite(m_Sprite);
var bitmap = m_Sprite.GetImage();
if (bitmap != null)
{
assetItem.InfoText = $"Width: {bitmap.Width}\nHeight: {bitmap.Height}\n";
Expand Down
2 changes: 1 addition & 1 deletion AssetStudioGUI/Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static bool ExportSprite(AssetItem item, string exportPath)
var exportFullName = exportPath + item.Text + "." + type.ToLower();
if (ExportFileExists(exportFullName))
return false;
var bitmap = SpriteHelper.GetImageFromSprite((Sprite)item.Asset);
var bitmap = ((Sprite)item.Asset).GetImage();
if (bitmap != null)
{
if (tga)
Expand Down
2 changes: 1 addition & 1 deletion AssetStudioUtility/SpriteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace AssetStudio
{
public static class SpriteHelper
{
public static Bitmap GetImageFromSprite(Sprite m_Sprite)
public static Bitmap GetImage(this Sprite m_Sprite)
{
if (m_Sprite.m_SpriteAtlas != null && m_Sprite.m_SpriteAtlas.TryGet(out var m_SpriteAtlas))
{
Expand Down

0 comments on commit 4a81c46

Please sign in to comment.