SetDIBitsToDevice

Version 3.0

Syntax

WORD SetDIBitsToDevice(hDC,DestX,DestY,nWidth,nHeight,SrcX,SrcY,nStartScan,nNumScans,lpBits,lpBitsInfo,wUsage)

This function sets bits from a device-independent bitmap (DIB) directly on a device surface. The SrcX, SrcY, nWidth, and nHeight parameters define a rectangle within the total DIB. SetDIBitsToDevice sets the bits in this rectangle directly on the display surface of the output device identified by the hDC parameter, at the location described by the DestX and DestY parameters.

To reduce the amount of memory required to set bits from a large DIB on a device surface, an application can band the output by repeatedly calling SetDIBitsToDevice, placing a different portion of the entire DIB into the lpBits buffer each time. The values of the nStartScan and nNumScans parameters identify the portion of the entire DIB which is contained in the lpBits buffer.

Parameter Type/Description  

hDC HDC Identifies the device context.  
DestX WORD Specifies the x-coordinate of the origin of the destination rectangle.  
DestY WORD Specifies the y-coordinate of the origin of the destination rectangle.  
nWidth WORD Specifies the x-extent of the rectangle in the DIB.  
nHeight WORD Specifies the y-extent of the rectangle in the DIB.  
SrcX WORD Specifies the x-coordinate of the source in the DIB.  
SrcY WORD Specifies the y-coordinate of the source in the DIB.  
nStartScan WORD Specifies the scan-line number of the DIB which is contained in the first scan line of the lpBits buffer.  
nNumScans WORD Specifies the number of scan lines of the DIB which are contained in the lpBits buffer.  
lpBits LPSTR Points to the DIB bits that are stored as an array of bytes.  
lpBitsInfo LPBITMAPINFO Points to a BITMAPINFO data structure that contains information about the DIB.  
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 is the number of scan lines set.

Comments

All coordinates are device coordinates (that is, the coordinates of the DIB) except destX and destY, which are logical coordinates.

The origin for device-independent bitmaps is the bottom-left corner of the DIB, not the
top-left corner, which is the origin when the mapping mode is MM_TEXT.

This function also accepts a device-independent 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.