public static IWICBitmapLock Lock(this IWICBitmap bitmap, WICBitmapLockFlags flags, WICRect?prcLock = null) { using (var prcLockPtr = CoTaskMemPtr.From(prcLock)) { return(bitmap.Lock(prcLockPtr, flags)); } }
public T WithLock <T>(WICBitmapLockFlags flags, Func <WicBitmapLock, T> func, WICRect?rect = null) { if (func == null) { throw new ArgumentNullException(nameof(func)); } using (var lck = CheckBitmap().Lock(flags, rect)) return(func(new WicBitmapLock(lck))); }
public void WithLock(WICBitmapLockFlags flags, Action <WicBitmapLock> action, WICRect?rect = null) { if (action == null) { throw new ArgumentNullException(nameof(action)); } using (var lck = CheckBitmap().Lock(flags, rect)) action(new WicBitmapLock(lck)); }
public static IComObject <IWICBitmapLock> Lock(this IWICBitmap bitmap, WICBitmapLockFlags flags, WICRect?rect = null) { if (bitmap == null) { throw new ArgumentNullException(nameof(bitmap)); } using (var mem = new ComMemory(rect)) { bitmap.Lock(mem.Pointer, flags, out var value).ThrowOnError(); return(new ComObject <IWICBitmapLock>(value)); } }
public static IComObject <IWICBitmapLock> Lock(this IComObject <IWICBitmap> bitmap, WICBitmapLockFlags flags, WICRect?rect = null) => Lock(bitmap?.Object, flags, rect);