Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This 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 set in the destination device context.
BOOL StretchBlt( HDC hdcDest , int nXOriginDest , int nYOriginDest , int nWidthDest , int nHeightDest , HDC hdcSrc , int nXOriginSrc , int nYOriginSrc , int nWidthSrc , int nHeightSrc , DWORD dwRop );
Parameters
See BitBltfor a list of common raster operation codes.
Windows CE versions 1.0 and 1.01 support only the SRCCOPYand SRCINVERTraster operations.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
StretchBltstretches 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, the system 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, StretchBltconverts the source and pattern bitmaps to match the destination bitmap.
If StretchBltmust 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.
StretchBltcreates a mirror image of a bitmap if the signs of the nWidthSrcand nWidthDestparameters or of the nHeightSrcand nHeightDestparameters differ. If nWidthSrcand nWidthDesthave different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrcand nHeightDesthave different signs, the function creates a mirror image of the bitmap along the y-axis. Windows CE versions 1.0 and 1.01 do not support mirroring.
Not all devices support the StretchBltfunction. For more information, see the GetDeviceCaps.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Wingdi.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
BitBlt, GetDeviceCaps, GetLastError, MaskBlt