using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Veldrid.Common { /// /// A wrapper with interface. /// public struct TextureWrapper : ITexture2D, IEquatable { /// /// Creates a new instance of . /// /// The texture. /// public TextureWrapper(Texture texture) { if (texture is null) throw new ArgumentNullException(nameof(texture)); Texture = texture; } /// /// Texture /// public Texture Texture { get; } /// /// Size of texture /// public Size Size => new Size((int)Texture.Width, (int)Texture.Height); /// public bool IsDisposed => Texture.IsDisposed; /// public override int GetHashCode() => Texture.GetHashCode(); /// public bool Equals(TextureWrapper other) => Texture == other.Texture; /// public override bool Equals([NotNullWhen(true)] object? obj) => obj is TextureWrapper tw && Equals(tw); /// public override string? ToString() => Texture.ToString(); /// public void Dispose() => Texture.Dispose(); /// public static implicit operator TextureWrapper(Texture t) => new TextureWrapper(t); /// public static implicit operator Texture(TextureWrapper t) => t.Texture; } }