using System; using Quik.Media; namespace Quik { /// <summary> /// Interface for texture instances. /// </summary> public abstract class QuikTexture : IEquatable<QuikTexture>, IDisposable { /// <summary> /// Width of the texture. /// </summary> public abstract int Width { get; } /// <summary> /// Height of the texture. /// </summary> public abstract int Height { get; } /// <summary> /// True if the texture can have mipmaps. /// </summary> public abstract bool Mipmaps { get; } /// <summary> /// Indicates whether this texture contains a signed distance field. /// </summary> public bool SignedDistanceField { get; set; } /// <summary> /// Indicates whether this texture has premultiplied alpha. /// </summary> public bool PreMultipled { get; set; } /// <summary> /// Upload texture data. /// </summary> /// <param name="data">Pointer to data.</param> /// <param name="format">Color format of the data.</param> /// <param name="size">Size of the texture data.</param> /// <param name="level">Mip level.</param> /// <param name="alignment">Pixel alignment. Expected to be 1, 2, 4, or 8.</param> public abstract void Image(IntPtr data, QImageFormat format, QVec2 size, int level, int alignment = 4); /// <summary> /// Upload texture data. /// </summary> /// <param name="data">Pointer to data.</param> /// <param name="format">Color format for the data.</param> /// <param name="location">Location of the data in the texture.</param> /// <param name="level">Mip level.</param> /// <param name="alignment">Pixel alignment. Expected to be 1, 2, 4, or 8.</param> public abstract void SubImage(IntPtr data, QImageFormat format, QRectangle location, int level, int alignment = 4); /// <summary> /// Generate the mip maps for the texture. /// </summary> public abstract void GenerateMipMaps(); public virtual bool Equals(QuikTexture other) { return base.Equals(other); } public void Dispose() => Dispose(true); protected virtual void Dispose(bool isDisposing) { } } }