The CreateDIBitmap function creates a device-dependent bitmap (DDB) from a device-independent bitmap (DIB) and, optionally, sets the bitmap bits.
HBITMAP CreateDIBitmap(
HDC hdc, |
// handle to device context |
CONST BITMAPINFOHEADER *lpbmih, |
// pointer to bitmap size and format data |
DWORD fdwInit, |
// initialization flag |
CONST VOID *lpbInit, |
// pointer to initialization data |
CONST BITMAPINFO *lpbmi, |
// pointer to bitmap color-format data |
UINT fuUsage |
// color-data usage |
); |
If fdwInit is CBM_INIT, the function uses the BITMAPINFOHEADER
structure to obtain the desired width and height of the bitmap as well as
other information. Note that a positive value for the height indicates a
bottom-up DIB while a negative value for the height indicates a top-down DIB.
This scenario is compatible with the CreateDIBitmap function.
The following bit flag constant is defined:
Value |
Meaning |
CBM_INIT |
If this flag is set, the operating system uses the data pointed to by the lpbInit and lpbmi parameters to initialize the bitmap’s bits. If this flag is clear, the data pointed to by those parameters is not used. |
If fdwInit is zero, the operating system does not initialize the
bitmap’s bits.
Value |
Meaning |
DIB_PAL_COLORS |
A color table is provided and consists of an array of 16-bit indices into the logical palette of the device context into which the bitmap is to be selected. |
DIB_RGB_COLORS |
A color table is provided and contains literal RGB values. |
If the function succeeds, the return value is a handle to the bitmap.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
The CBM_CREATDIB flag for the fdwInit parameter is no longer supported.
When you no longer need the bitmap, call the DeleteObject function to delete it.
BITMAPINFOHEADER, BITMAPINFO, DeleteObject, GetDeviceCaps, GetSystemPaletteEntries, SelectObject
See:
file: /Techref/os/win/api/win32/func/src/f08_17.htm, 6KB, , updated: 2001/11/14 09:31, local time: 2024/11/9 08:06,
18.116.62.177:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f08_17.htm"> CreateDIBitmap</A> |
Did you find what you needed? |