using System; namespace Quik.Media { public abstract class QImage : IDisposable { public abstract int Width { get; } public abstract int Height { get; } public abstract int Depth { get; } public virtual int MipMapLevels => 0; public virtual bool Premultiplied => false; public abstract IntPtr LockBits2d(QImageFormat format, int level = 0); public abstract IntPtr LockBits3d(QImageFormat format, int level = 0); public abstract IntPtr LockBits3d(QImageFormat format, int depth, int level = 0); public abstract void UnlockBits(); // IDisposable private bool isDisposed = false; private void DisposePrivate(bool disposing) { if (isDisposed) return; Dispose(disposing); isDisposed = true; } protected virtual void Dispose(bool disposing) { } public void Dispose() => DisposePrivate(true); } }