Esempio n. 1
0
 /// <summary>
 /// Unlocks the image.
 /// </summary>
 public void UnlockImage()
 {
     if (currentState == BitmapExState.Locked)
     {
         workingBitmap.UnlockBits(bitmapData);
         bitmapData   = null;
         pBase        = null;
         currentState = BitmapExState.Unlocked;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Locks the image so manipulation can be done.
        /// </summary>
        public void LockImage()
        {
            if (currentState == BitmapExState.Unlocked)
            {
                Rectangle bounds = new Rectangle(Point.Empty, workingBitmap.Size);
                width = (int)(bounds.Width * sizeof(PixelData));
                if (width % 4 != 0)
                {
                    width = 4 * (width / 4 + 1);
                }

                bitmapData   = workingBitmap.LockBits(bounds, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                pBase        = (Byte *)bitmapData.Scan0.ToPointer();
                currentState = BitmapExState.Locked;
            }
        }