int StretchDIBits(hdc, XDest, YDest, cxDest, cyDest, XSrc, YSrc, cxSrc, cySrc, lpvBits, lpbmi, fuColorUse, fdwRop) | |||||
HDC hdc; | /* handle of device context | */ | |||
int XDest; | /* x-coordinate of destination rectangle | */ | |||
int YDest; | /* y-coordinate of destination rectangle | */ | |||
int cxDest; | /* width of destination rectangle | */ | |||
int cyDest; | /* height of destination rectangle | */ | |||
int XSrc; | /* x-coordinate of source rectangle | */ | |||
int YSrc; | /* y-coordinate of source rectangle | */ | |||
int cxSrc; | /* width of source rectangle | */ | |||
int cySrc; | /* height of source rectangle | */ | |||
const void FAR* lpvBits; | /* address of buffer with DIB bits | */ | |||
LPBITMAPINFO lpbmi; | /* address of structure with bitmap data | */ | |||
UINT fuColorUse; | /* RGB or palette indices | */ | |||
DWORD fdwRop; | /* raster operation, */ |
The StretchDIBits function moves a device-independent bitmap (DIB) from a source rectangle into a destination rectangle, stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
hdc
Identifies the destination device context for a screen surface or memory bitmap.
XDest
Specifies the logical x-coordinate of the destination rectangle.
YDest
Specifies the logical y-coordinate of the destination rectangle.
cxDest
Specifies the logical x-extent of the destination rectangle.
cyDest
Specifies the logical y-extent of the destination rectangle.
XSrc
Specifies the x-coordinate, in pixels, of the source rectangle in the DIB.
YSrc
Specifies the y-coordinate, in pixels, of the source rectangle in the DIB.
cxSrc
Specifies the width, in pixels, of the source rectangle in the DIB.
cySrc
Specifies the height, in pixels, of the source rectangle in the DIB.
lpvBits
Points to the DIB bits that are stored as an array of bytes.
lpbmi
Points to a BITMAPINFO structure that contains information about the DIB. The BITMAPINFO structure has the following form:
typedef struct tagBITMAPINFO { /* bmi */
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
fuColorUse
Specifies whether the bmiColors member of the lpbmi parameter contains explicit RGB (red-green-blue) values or indices into the currently realized logical palette. The fuColorUse parameter can be one of the following values:
Value | Meaning |
DIB_PAL_COLORS | The color table consists of an array of 16-bit indices into the currently realized logical palette. |
DIB_RGB_COLORS | The color table contains literal RGB values. |
fdwRop
Specifies the raster operation to be performed. Raster-operation codes define how the graphics device interface (GDI) combines colors in output operations that involve a current brush, a possible source bitmap, and a destination bitmap. For a list of raster-operation codes, see the description of the BitBlt function. For a complete list of the raster operations, see the Microsoft Windows Programmer's Reference, Volume 4.
The return value is the number of scan lines copied, if the function is successful.
The StretchDIBits function uses the stretching mode of the destination device context (set by the SetStretchBltMode function) to determine how to stretch or compress the bitmap.
The origin of the coordinate system for a device-independent bitmap is the lower-left corner. The origin of the coordinates of the destination rectangle depends on the current mapping mode of the device context.
StretchDIBits creates a mirror image of a bitmap if the signs of the cxSrc and cxDest parameters or the cySrc and cyDest parameters differ. If cxSrc and cxDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If cySrc and cyDest have different signs, the function creates a mirror image of the bitmap along the y-axis.