Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).
Name | Description | |
---|---|---|
LockBits() |
Locks a entire bitmap and returns BitmapData object which provides direct access to pixels (without copying). |
|
LockBits(Rectangle) |
Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying). |
|
LockBits(RectangleF) |
Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying). |
|
LockBits(Int32, Int32, Int32, Int32) |
Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying). |
|
LockBits(Single, Single, Single, Single) |
Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying). |
Each call of this method should be followed with subsequent UnlockBits(BitmapData) method call. You cannot lock bits one more time until you unlock them with UnlockBits(BitmapData). You can check if bits are locked with BitsLocked property.
If the specified rectangular area excides the Bitmap dimensions you will get the BitmapData object with the same dimensions as an initial Bitmap. Therefore, to avoid further errors, you should use the Width and Height properties of this BitmapData object instead of the specified rectangle dimensions.