Bitmap class
Bitmap is an object used to process images defined by pixel data.
Its Inheritance level: system. Object-> system. externalbyrefobject-> system. Drawing. Image-> system. Drawing. Bitmap
Namespace: system. Drawing
Assembly: system. Drawing (in system. Drawing. dll)
Main attributes of this class
Height: obtains the image height (in pixels );
Width: obtains the image width in pixels );
Palette: gets or sets the image palette;
Pixelformat: Obtain the pixel format of the image.
The primary methods of this class are lockbits and unlockbits, which respectively lock and unlock bitmap pixels in the system memory and are used in pairs. Each time lockbits is called, unlockbits should be called once.
Public bitmapdata lockbits (rectangle rect, imagelockmode flags, pixelformat format); Public void unlockbits (bitmapdata );
Bitmapdata class
The bitmapdata object specifies the bitmap attribute.
Height: the height of the locked bitmap;
Width: the width of the locked bitmap;
Pixelformat: the actual data pixel format;
Scan0: The Byte address of the locked array. If the entire image is locked, it is the first byte address of the image;
Stride: The stride, also called scan width.
As shown in, the array width is not necessarily equal to the width of the image pixel array, and some unused areas exist. To improve efficiency, the number of bytes in each row must be a multiple of 4.