Locks a rectangular area of the bitmap and returns BitmapData object which provides direct access to pixels (without copying).
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Public Function LockBits ( _ left As Integer, _ top As Integer, _ width As Integer, _ height As Integer _ ) As BitmapData
public BitmapData LockBits( int left, int top, int width, int height )
Type: System.Int32
X-coordinate of the top left corner of the rectangular area to lock.Type: System.Int32
Y-coordinate of the top left corner of the rectangular area to lock.Type: System.Int32
Width of the rectangular area to lock.Type: System.Int32
Height of the rectangular area to lock.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.
Rectangle parameters are measured in units specified with Unit property of the source bitmap.
If you want to load all pixels of the bitmap, you can use overloaded version without arguments.
Console.WriteLine("Bitmap") Console.WriteLine(" PixelFormat: " & bitmap.PixelFormat.ToString()) Console.WriteLine(" CMYK: " & bitmap.IsCmyk) Console.WriteLine(" GrayScale: " & bitmap.IsGrayScale) Console.WriteLine(" RGB: " & bitmap.IsRgb) Console.WriteLine(" Indexed: " & bitmap.IsIndexed) Console.WriteLine(" Extended: " & bitmap.IsExtended) Dim bitmapData As Aurigma.GraphicsMill.BitmapData = bitmap.LockBits(20, 20, 150, 100) Console.WriteLine("BitmapData") Console.WriteLine(" PixelFormat: " & bitmapData.PixelFormat.ToString()) bitmap.UnlockBits(bitmapData)
Console.WriteLine("Bitmap"); Console.WriteLine(" PixelFormat: " + bitmap.PixelFormat.ToString()); Console.WriteLine(" CMYK: " + bitmap.IsCmyk); Console.WriteLine(" GrayScale: " + bitmap.IsGrayScale); Console.WriteLine(" RGB: " + bitmap.IsRgb); Console.WriteLine(" Indexed: " + bitmap.IsIndexed); Console.WriteLine(" Extended: " + bitmap.IsExtended); Aurigma.GraphicsMill.BitmapData bitmapData = bitmap.LockBits(20, 20, 150, 100); Console.WriteLine("BitmapData"); Console.WriteLine(" PixelFormat: " + bitmapData.PixelFormat.ToString()); bitmap.UnlockBits(bitmapData);