SetDIBitsToDevice

  WORD SetDIBitsToDevice(lpDestDev, X, Y, iScan, cScans, lpClipRect, lpDrawMode, lpDIBits, lpBitmapInfo, lpTranslate)    
  LPPDEVICE lpDestDev; /* points to device */
  WORD X; /* top left corner x-coordinate, */  
  WORD Y; /* top left corner y-coordinate, */  
  WORD iScan; /* start scan line in the DIB buffer */
  WORD cScans; /* number of scans to copy */
  LPRECT lpClipRect; /* points to clip rectangle on screen */
  LPDRAWMODE lpDrawMode; /* points to drawing mode information */
  LPSTR lpDIBits; /* points to the DIB buffer */
  LPBITMAPINFO lpBitmapInfo; /* points to bitmap information */
  LPINT lpTranslate; /* points to conversion-translation table */

The SetDIBitsToDevice function copies device-independent bitmap data directly to the given device. The function converts the bitmap data to the appropriate device-specific format and copies the resulting bits to the device. GDI calls this function whenever an application calls the SetDIBitsToDevice function (GDI.443).

A graphics device driver must export the SetDIBitsToDevice function if the RC_DIBTODEV value is set in the dpRaster member of the driver's GDIINFO structure.

Parameters

lpDestDev

Points to a PDEVICE structure specifying the device to receive the device-independent bitmap.

X

Specifies the x-coordinate (in device units) to receive the top left corner of the device-independent bitmap.

Y

Specifies the y-coordinate (in device units) to receive the top left corner of the device-independent bitmap.

iScan

Specifies the starting scan line.

cScans

Specifies the number of scan lines to copy.

lpClipRect

Points to a RECT structure specifying the clip rectangle. The structure has the following form:

typedef struct tagRECT {

short left;

short top;

short right;

short bottom;

} RECT;

lpDrawMode

Points to a DRAWMODE structure specifying the background mode and background color to use while copying the bitmap. The structure has the following form:

typedef struct tagDRAWMODE {

short Rop2; /*binary-raster operations*/

short bkMode; /*background mode*/

PCOLOR bkColor; /*physical background color*/

PCOLOR TextColor; /*physical text (foreground) color*/

short TBreakExtra;/*number of extra pixels to add to line*/

short BreakExtra; /*pixels per break: TBreakExtra/BreakCount*/

short BreakErr; /*running error term*/

short BreakRem; /*remaining pixels: TBreakExtra%BreakCount*/

short BreakCount; /*number of breaks in the line*/

short CharExtra; /*extra pixels for each character*/

COLORREF LbkColor; /*logical background color*/

COLORREF LTextColor; /*logical text (foreground) color*/

} DRAWMODE;

lpDIBits

Points to a buffer containing the device-independent bitmap bits.

lpBitmapInfo

Points to a BITMAPINFO structure specifying the dimensions and format of the device-independent bitmap. The structure has the following form:

typedef struct tagBITMAPINFO {

BITMAPINFOHEADER bmiHeader;

RGBQUAD bmiColors[1];

} BITMAPINFO;

If the RLE_FORMAT_4 or RLE_FORMAT_8 values are set in the biCompression member, the bitmap is in run-length-encoded (RLE) format. In this case, the function must decode the data as it retrieves it from the buffer pointed to by the lpDIBits parameter.

lpTranslate

Points to an array of color-translation values for converting palette colors to actual device colors. This parameter is ignored by devices that do not use color palettes.

Return Value

The return value is the number of scan lines actually copied, if successful. Otherwise, it is zero if there is an error or no scan lines are copied.

Comments

The export ordinal for this function is 21.

The function removes the cursor before copying the bitmap bits to the display device and restores the cursor after copying.

See Also

DeviceBitmapBits, StretchDIBits