The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. Windows stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
BOOL StretchBlt(
HDC hdcDest, |
// handle of destination device context |
int nXOriginDest, |
// x-coordinate of upper-left corner of dest. rect. |
int nYOriginDest, |
// y-coordinate of upper-left corner of dest. rect. |
int nWidthDest, |
// width of destination rectangle |
int nHeightDest, |
// height of destination rectangle |
HDC hdcSrc, |
// handle of source device context |
int nXOriginSrc, |
// x-coordinate of upper-left corner of source rectangle |
int nYOriginSrc, |
// y-coordinate of upper-left corner of source rectangle |
int nWidthSrc, |
// width of source rectangle |
int nHeightSrc, |
// height of source rectangle |
DWORD dwRop |
// raster operation code |
); |
See the BitBlt function for a list of common raster operation codes.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
StretchBlt stretches or compresses the source bitmap in memory and then copies the result to the destination rectangle. The color data for pattern or destination pixels is merged after the stretching or compression occurs.
When an enhanced metafile is being recorded, an error occurs (and the function returns FALSE) if the source device context identifies an enhanced-metafile device context.
If the specified raster operation requires a brush, Windows uses the brush currently selected into the destination device context.
The destination coordinates are transformed by using the transformation currently specified for the destination device context; the source coordinates are transformed by using the transformation currently specified for the source device context.
If the source transformation has a rotation or shear, an error occurs.
If destination, source, and pattern bitmaps do not have the same color format, StretchBlt converts the source and pattern bitmaps to match the destination bitmap.
If StretchBlt must convert a monochrome bitmap to a color bitmap, it sets white bits (1) to the background color and black bits (0) to the foreground color. To convert a color bitmap to a monochrome bitmap, it sets pixels that match the background color to white (1) and sets all other pixels to black (0). The foreground and background colors of the device context with color are used.
StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or of the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis.
Not all devices support the StretchBlt function. For more information, see the GetDeviceCaps function.
BitBlt, GetDeviceCaps, MaskBlt, PlgBlt, SetStretchBltMode
file: /Techref/os/win/api/win32/func/src/f87_6.htm, 7KB, , updated: 2000/4/7 11:19, local time: 2024/11/25 09:38,
18.221.68.196:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/os/win/api/win32/func/src/f87_6.htm"> StretchBlt</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.