mirror of
https://github.com/riperiperi/FreeSO
synced 2026-08-13 20:26:13 -04:00
MPL per-file was used in older project files, but should apply to the whole project, so having it there was redundant.
35 lines
869 B
C#
35 lines
869 B
C#
using FSO.Content.Model;
|
|
using SixLabors.ImageSharp;
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace FSO.Server.Utils
|
|
{
|
|
public class CoreImageLoader
|
|
{
|
|
public static TexBitmap SoftImageFetch(Stream stream, AbstractTextureRef texRef)
|
|
{
|
|
Image<Rgba32> result = null;
|
|
try
|
|
{
|
|
result = Image.Load(stream);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return new TexBitmap() { Data = new byte[0] };
|
|
}
|
|
stream.Close();
|
|
|
|
if (result == null) return null;
|
|
|
|
return new TexBitmap
|
|
{
|
|
Data = result.SavePixelData(),
|
|
Width = result.Width,
|
|
Height = result.Height,
|
|
PixelSize = 4
|
|
};
|
|
}
|
|
}
|
|
}
|