using Engine.Asset; using Engine.Renderer.Pixel; namespace Engine.Renderer.Texture; public interface ITexture : IConstTexture where T : struct, IPixel { public void UploadPixels(int x, int y, int width, int height, T[,] pixels); } public static class TextureExtensions { public static void UploadPixels(this ITexture texture, Image image) where T : struct, IPixel => texture.UploadPixels(0, 0, image); public static void UploadPixels(this ITexture texture, int x, int y, Image image) where T : struct, IPixel => texture.UploadPixels(x, y, image.Width, image.Height, image.Pixels); public static void UploadPixels(this ITexture texture, T[,] pixels) where T : struct, IPixel => texture.UploadPixels(0, 0, texture.Width, texture.Height, pixels); }