Locks a entire 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 As BitmapData
public BitmapData LockBits()
Aurigma.GraphicsMill.BitmapData bitmapData = bitmap.LockBits();
unsafe
{
byte* pos;
byte* scan0 = (byte*)(bitmapData.Scan0.ToPointer());
int stride = bitmapData.Stride;
int widthInBytes = bitmapData.Width * bitmapData.BitsPerPixel / 8;
int height = bitmapData.Height;
for (int j = 0; j < height; j++)
{
pos = scan0 + stride * j;
for (int i = 0; i < widthInBytes; i++)
{
*pos = (byte)(255 - *pos);
pos++;
}
}
}
bitmap.UnlockBits(bitmapData);