DekGenius.com
[ Team LiB ] Previous Section Next Section

BitmapData

System.Drawing.Imaging (system.drawing.dll)sealed class

This class encapsulates the raw data of a System.Drawing.Bitmap. It is returned by LockBits(), and the Bitmap.UnlockBits() method releases the data.

You can retrieve the Width, Height, PixelFormat, and Stride (the number of bytes per line including padding, as opposed to the number of pixels). The sign of the Stride can also be used to determine whether this is a top-down or bottom-up bitmap.

The pixel data itself can be retrieved through the Scan0 member, which returns an IntPtr to the start of the image. This can be handed off to either managed or (more commonly) unmanaged image processing code.

public sealed class BitmapData {
// Public Constructors
   public BitmapData();
// Public Instance Properties
   public int Height{set; get; }
   public PixelFormat PixelFormat{set; get; }
   public int Reserved{set; get; }
   public IntPtr Scan0{set; get; }
   public int Stride{set; get; }
   public int Width{set; get; }
}

Returned By

System.Drawing.Bitmap.LockBits()

Passed To

System.Drawing.Bitmap.UnlockBits()

    [ Team LiB ] Previous Section Next Section