2024-08-18 09:27:44 +00:00
|
|
|
using Godot;
|
2024-09-01 17:36:15 +00:00
|
|
|
using KeepersCompound.Images;
|
2024-08-18 09:27:44 +00:00
|
|
|
|
|
|
|
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-08-18 09:27:44 +00:00
|
|
|
{
|
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;
|
2024-08-18 09:27:44 +00:00
|
|
|
}
|
|
|
|
}
|