int GetDIBits(hDC,hBitmap,nStartScan,nNumScans,lpBits,lpBitsInfo,wUsage)
This function retrieves the bits of the specified bitmap and copies them, in device-independent format, into the buffer that is pointed to by the lpBits parameter. The lpBitsInfo parameter retrieves the color format for the device-independent bits.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | ||
hBitmap | HBITMAP Identifies the bitmap. | ||
nStartScan | WORD Specifies the first scan line in the destination bitmap to set in lpBits. | ||
nNumScans | WORD Specifies the number of lines to be copied. | ||
lpBits | LPSTR Points to a buffer that will receive the bitmap bits in device-independent format. | ||
lpBitsInfo | LPBITMAPINFO Points to a BITMAPINFO data structure that specifies the color format and dimension for the device-independent bitmap. | ||
wUsage | WORD Specifies whether the bmiColors[ ] fields of the lpBitsInfo parameter are to contain explicit RGB values or indexes into the currently realized logical palette. The wUsage parameter must be one of the following values: | ||
, | |||
Value | Meaning | ||
DIB_PAL_COLORS | The color table is to consist of an array of 16-bit indexes into the currently realized logical palette. | ||
DIB_RGB_COLORS | The color table is to contain literal RGB values. |
The return value specifies the number of scan lines copied from the bitmap. It is zero if there was an error.
If the lpBits parameter is NULL, GetDIBits fills in the BITMAPINFO data structure to which the lpBitsInfo parameter points, but does not retrieve bits from the bitmap.
The bitmap identified by the hBitmap parameter must not be selected into a device
context when the application calls this function.
The origin for device-independent bitmaps is the bottom-left corner of the bitmap, not the top-left corner, which is the origin when the mapping mode is MM_TEXT.
This function also retrieves a bitmap specification formatted for Microsoft OS/2
Presentation Manager versions 1.1 and 1.2 if the lpBitsInfo parameter points to a
BITMAPCOREINFO data structure.