mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-14 02:54:16 -04:00
Use ImageSharp to process textures
This commit is contained in:
@ -19,6 +19,7 @@ using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using static AssetStudioGUI.Studio;
|
||||
using Font = AssetStudio.Font;
|
||||
using ImageFormat = AssetStudio.ImageFormat;
|
||||
using PixelFormat = System.Drawing.Imaging.PixelFormat;
|
||||
using Vector3 = OpenTK.Vector3;
|
||||
using Vector4 = OpenTK.Vector4;
|
||||
@ -741,9 +742,10 @@ namespace AssetStudioGUI
|
||||
|
||||
private void PreviewTexture2D(AssetItem assetItem, Texture2D m_Texture2D)
|
||||
{
|
||||
var bitmap = m_Texture2D.ConvertToBitmap(true);
|
||||
if (bitmap != null)
|
||||
var stream = m_Texture2D.ConvertToStream(ImageFormat.Png, true);
|
||||
if (stream != null)
|
||||
{
|
||||
var bitmap = new Bitmap(stream);
|
||||
assetItem.InfoText = $"Width: {m_Texture2D.m_Width}\nHeight: {m_Texture2D.m_Height}\nFormat: {m_Texture2D.m_TextureFormat}";
|
||||
switch (m_Texture2D.m_TextureSettings.m_FilterMode)
|
||||
{
|
||||
@ -1151,11 +1153,11 @@ namespace AssetStudioGUI
|
||||
|
||||
private void PreviewSprite(AssetItem assetItem, Sprite m_Sprite)
|
||||
{
|
||||
var bitmap = m_Sprite.GetImage();
|
||||
if (bitmap != null)
|
||||
var stream = m_Sprite.GetImage(ImageFormat.Png);
|
||||
if (stream != null)
|
||||
{
|
||||
var bitmap = new Bitmap(stream);
|
||||
assetItem.InfoText = $"Width: {bitmap.Width}\nHeight: {bitmap.Height}\n";
|
||||
|
||||
PreviewTexture(bitmap);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user