Exemple #1
0
        public bool TryLock(int x, int y, int width, int height, out WICBitmapLock wicImageLock)
        {
            Int32Rect lockRect = new Int32Rect(x, y, width, height);

            object[] args   = new object[] { _wicBitmap, lockRect, LockFlags.Read, null };
            int      result = (int)LockMethod.Invoke(null, args);

            wicImageLock = new WICBitmapLock(args[3]);
            return(result == 0);
        }
Exemple #2
0
        public WICBitmapLock Lock(int x, int y, int width, int height)
        {
            Int32Rect lockRect = new Int32Rect(x, y, width, height);

            object[] args   = new object[] { _wicBitmap, lockRect, LockFlags.Read, null };
            int      result = (int)LockMethod.Invoke(null, args);

            if (result != 0)
            {
                throw new Win32Exception(result, "Failed to lock bytes");
            }
            WICBitmapLock wicImageLock = new WICBitmapLock(args[3]);

            return(wicImageLock);
        }
Exemple #3
0
 public bool TryLock(out WICBitmapLock wicImageLock)
 {
     return(this.TryLock(0, 0, PixelWidth, PixelHeight, out wicImageLock));
 }