The SetDIBits function sets the pixels in a compatible bitmap (DDB) using the color data found in the specified DIB.
int SetDIBits( HDC hdc, HBITMAP hbm, UINT start, UINT cLines, const VOID *lpBits, const BITMAPINFO *lpbmi, UINT ColorUse );
A handle to a device context.
A handle to the compatible bitmap (DDB) that is to be altered using the color data from the specified DIB.
The starting scan line for the device-independent color data in the array pointed to by the lpvBits parameter.
The number of scan lines found in the array containing device-independent color data.
A pointer to the DIB color data, stored as an array of bytes. The format of the bitmap values depends on the biBitCount member of the BITMAPINFO structure pointed to by the lpbmi parameter.
A pointer to a BITMAPINFO structure that contains information about the DIB.
Indicates whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or palette indexes. The fuColorUse parameter must be one of the following values.
||The color table consists of an array of 16-bit indexes into the logical palette of the device context identified by the hdc parameter.|
||The color table is provided and contains literal RGB values.|
If the function succeeds, the return value is the number of scan lines copied.
If the function fails, the return value is zero.
This can be the following value.
||One or more of the input parameters is invalid.|
Optimal bitmap drawing speed is obtained when the bitmap bits are indexes into the system palette.
Applications can retrieve the system palette colors and indexes by calling the GetSystemPaletteEntries function. After the colors and indexes are retrieved, the application can create the DIB. For more information, see System Palette.
The device context identified by the hdc parameter is used only if the DIB_PAL_COLORS constant is set for the fuColorUse parameter; otherwise it is ignored.
The bitmap identified by the hbmp parameter must not be selected into a device context when the application calls this function.
The scan lines must be aligned on a DWORD except for RLE-compressed bitmaps.
The origin for bottom-up DIBs is the lower-left corner of the bitmap; the origin for top-down DIBs is the upper-left corner of the bitmap.
ICM: Color management is performed if color management has been enabled with a call to SetICMMode with the iEnableICM parameter set to ICM_ON. If the bitmap specified by lpbmi has a BITMAPV4HEADER that specifies the gamma and endpoints members, or a BITMAPV5HEADER that specifies either the gamma and endpoints members or the profileData and profileSize members, then the call treats the bitmap's pixels as being expressed in the color space described by those members, rather than in the device context's source color space.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||wingdi.h (include Windows.h)|