Aurigma Graphics Mill 5.5 for .NET
BitmapData..::.Stride Property
Returns the bitmap data stride (scan line width in bytes).
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Remarks
Since Width property specifies number of pixels in single scan line, this property contains number of bytes in a scan line. As scan line may be aligned on four-bytes boundary, stride may differ from bitmap data width multiplied on number of bytes per pixel. That's why you should use this property to move to the same position on the next row instead of any other methods.
Examples
C#
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);