Exemple #1
0
 /// <summary>
 /// Lock the bitmap to edit it through memory
 /// </summary>
 public unsafe void Lock()
 {
     if (Data != null)
     {
         return;
     }
     Data = InternalBitmap.LockBits(new Rectangle(0, 0, InternalBitmap.Width, InternalBitmap.Height),
                                    ImageLockMode.ReadWrite,
                                    InternalBitmap.PixelFormat);
     PixelSize   = GetPixelSize();
     DataPointer = (byte *)Data.Scan0;
 }
Exemple #2
0
 /// <summary>
 /// Locks this instance.
 /// </summary>
 /// <returns>This</returns>
 public unsafe SwiftBitmap Lock()
 {
     Contract.Requires <NullReferenceException>(InternalBitmap != null);
     if (Data != null)
     {
         return(this);
     }
     Data = InternalBitmap.LockBits(new Rectangle(0, 0, InternalBitmap.Width, InternalBitmap.Height),
                                    ImageLockMode.ReadWrite,
                                    InternalBitmap.PixelFormat);
     PixelSize   = GetPixelSize();
     DataPointer = (byte *)Data.Scan0;
     return(this);
 }