thief-mission-viewer/project/code/TMV/TextureLoader.Gif.cs

18 lines
504 B
C#

using Godot;
using KeepersCompound.Images;
namespace KeepersCompound.TMV;
public partial class TextureLoader
{
// References:
// - https://www.w3.org/Graphics/GIF/spec-gif89a.txt
private static Image LoadGif(string path)
{
var gif = new GifDecoder(path);
var gifImage = gif.GetImage(0);
var bytes = gifImage.GetRgbaBytes();
var image = Image.CreateFromData(gifImage.Width, gifImage.Height, false, Image.Format.Rgba8, bytes);
return image;
}
}