SetDIBits

Version 3.0

Syntax

int SetDIBits(hDC,hBitmap,nStartScan,nNumScans,lpBits,lpBitsInfo,wUsage)

This function sets the bits of a bitmap to the values given in a device-independent bitmap (DIB) specification.

Parameter Type/Description  

hDC HDC Identifies the device context.  
hBitmap HBITMAP Identifies the bitmap.  
nStartScan WORD Specifies the scan number of the first scan line in the lpBits buffer.  
nNumScans WORD Specifies the number of scan lines in the lpBits buffer and the number of lines to set in the bitmap identified by the hBitmap parameter.  
lpBits LPSTR Points to the device-independent bitmap bits that are stored as an array of bytes. The format of the bitmap values depends on the biBitCount field of the BITMAPINFO structure identified by lpBitsInfo. See the description of the BITMAPINFO data structure in Chapter 7, “Data Types and Structures.”  
lpBitsInfo LPBITMAPINFO Points to a BITMAPINFO data structure that contains information about the device-independent bitmap.  
wUsage WORD Specifies whether the bmiColors[ ] fields of the lpBitsInfo parameter 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 consists of an array of 16-bit indexes into the currently realized logical palette.
  DIB_RGB_COLORS The color table contains literal RGB values.

Return Value

The return value specifies the number of scan lines successfully copied. It is zero if the function fails.

Comments

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 accepts 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.