HBITMAP CreateDIBSection(hdc, lpInfo, fInit, iUsage, lppBits) | |||||
HDC hdc; | /* handle of device context | */ | |||
LPBITMAPINFO lpInfo; | /* address of bitmap data | */ | |||
DWORD fInit; | /* scanline-ordering flag | */ | |||
DWORD iUsage; | /* color-format flag | */ | |||
LPBYTE *lppBits; | /* address of buffer that receives bitmap data | */ |
The CreateDIBSection function copies color data for a number of scanlines into the given buffer.
hdc
Identifies a device context that contains the logical palette that was used to initialize the bitmap's colors.
lpInfo
Points to a BITMAPINFO structure that describes the desired size and format of the bitmap, in addition, this structure contains a logical palette. The BITMAPINFO structure has the following form:
typedef struct tagBITMAPINFO { /* bmi */
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
fInit
Specifies whether the ordering of scanlines in the bitmap. This argument can be either one of the following constants:
Constant | Meaning |
BMF_TOPDOWN | The first scanline in the buffer at which lppBits points is the top scanline. |
BMF_DIB | The first scanline in the buffer at which lppBits points is the bottom scanline. |
iUsage
Specifies whether the bmiColors field of BITMAPINFO structure contains explicit RGB values or indices into the currently realized logical palette. This argument can be one of the following constants:
Constant | Meaning |
DIB_PAL_COLORS | The BITMAPINFO structure contains an array of 16-bit indices into a logical palette. |
DIB_RGB_COLORS | The BITMAPINFO structure contains an array of literal RGB values. |
lppBits
Points to a buffer that receives the bitmap bits.
The return value is a handle that identifies the bitmap if the function is successful. Otherwise, it is NULL.
The bitmap bits which are stored in the buffer at which lppBits points will be aligned on DWORD boundaries.
BITMAPINFO