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

18 lines
504 B
C#
Raw Permalink Normal View History

using Godot;
2024-09-01 17:36:15 +00:00
using KeepersCompound.Images;
namespace KeepersCompound.TMV;
public partial class TextureLoader
{
// References:
// - https://www.w3.org/Graphics/GIF/spec-gif89a.txt
2024-09-17 16:07:07 +00:00
private static Image LoadGif(string path)
{
2024-09-01 17:36:15 +00:00
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);
2024-09-17 16:07:07 +00:00
return image;
}
}