using Engine.Asset;
using Engine.Graphics.Pixel;

namespace Engine.Graphics.Texture;

public interface ITexture : IConstTexture
{
  public void UploadPixels<T>(int parX, int parY, int parWidth, int parHeight, T[,] parPixels)
    where T : struct, IPixel;
}

public static class TextureExtensions
{
  public static void UploadPixels<T>(this ITexture parTexture, Image<T> parImage) where T : struct, IPixel
  {
    parTexture.UploadPixels(0, 0, parImage);
  }

  public static void UploadPixels<T>(this ITexture parTexture, int parX, int parY, Image<T> parImage)
    where T : struct, IPixel
  {
    parTexture.UploadPixels(parX, parY, parImage.Width, parImage.Height, parImage.Pixels);
  }

  public static void UploadPixels<T>(this ITexture parTexture, T[,] parPixels) where T : struct, IPixel
  {
    parTexture.UploadPixels(0, 0, parTexture.Width, parTexture.Height, parPixels);
  }
}