利用API函数: 1.先加载位图:LoadBitmap
The LoadBitmap function loads the specified bitmap resource from a module's executable file. This function has been superseded by theLoadImage function.
HBITMAP LoadBitmap(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpBitmapName // address of bitmap resource name
);
2.GetDIBits
The GetDIBits function retrieves the bits of the specified bitmap and copies them into a buffer using the specified format.
int GetDIBits(
HDC hdc, // handle to device context
HBITMAP hbmp, // handle to bitmap
UINT uStartScan, // first scan line to set in destination bitmap
UINT cScanLines, // number of scan lines to copy
LPVOID lpvBits, // address of array for bitmap bits
LPBITMAPINFO lpbi, // address of structure with bitmap data
UINT uUsage // RGB or palette index
);
[color=#FF0000]3.BITMAPINFO
The BITMAPINFO structure defines the dimensions and color information for a Win32 device-independent bitmap (DIB).