using Godot; using KeepersCompound.Images; using SixLabors.ImageSharp.PixelFormats; namespace KeepersCompound.TMV; public partial class TextureLoader { // TODO: Replace this with my own implementation lol // TODO: Alpha!? // References: // - https://www.w3.org/Graphics/GIF/spec-gif89a.txt private static ImageTexture 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 ImageTexture.CreateFromImage(image); // using var gifImage = SixLabors.ImageSharp.Image.Load(path); // var width = gifImage.Width; // var height = gifImage.Height; // var bytes = new byte[width * height * 4]; // gifImage.CopyPixelDataTo(bytes); // var image = Image.CreateFromData(width, height, false, Image.Format.Rgba8, bytes); // return ImageTexture.CreateFromImage(image); } }