WinGStretchBlt

Copies an area from the source specified device context to an area of the destination device context, resizing if necessary to fill the destination rectangle. WinGStretchBlt is optimized to copy WinGDCs to display DCs. It does not operate on any other types of Device Contexts.

BOOL WinGStretchBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc)

Parameters

hdcDest Identifies the destination device context.
nXOriginDest X coordinate of the upper-left corner of the destination rectangle in MM_TEXT client coordinates.
nYOriginDest Y coordinate of the upper-left corner of the destination rectangle in MM_TEXT client coordinates.
nWidthDest Width of the destination rectangle..
nHeightDest Height of the destination rectangle..
hdcSrc Identifies the source device context.
nXOriginSrc X coordinate of the upper-left corner of the source rectangle in MM_TEXT client coordinates.
nYOriginSrc Y coordinate of the upper-left corner of the source rectangle in MM_TEXT client coordinates.
nWidthSrc Width of the source rectangle.
nHeightSrc Height of the source rectangle.

Return Value

Returns non-zero if successful, otherwise returns zero.

Comments

WinGStretchBlt requires both DCs to use MM_TEXT mapping mode at the time of the call or the results may be unpredictable. At other times, any mapping mode may be used in either DC.

WinGBitBlt does not handle non-zero viewport or window origins set by SetViewportOrg or SetWindowOrg.

WinGStretchBlt uses the STRETCH_DELETESCANS mode when expanding or shrinking an image.

WinGStretchBlt will fail under Windows 3.1 or Win32s if the source DC does not contain a monochrome or an 8-bit-per-pixel WinGBitmap.

On Win32, calls to WinGBStretchBlt may be batched by the operating system. To ensure that a blt occurs immediately upon calling WinGStretchBlt, be sure to call GDIFlush just after every call to WinGStretchBlt.

WinGStretchBlt only copies from a WinGDC to a Display DC. To copy from a WinGDC to a WinGDC, use BitBlt. You can not copy from a Display DC to a WinGDC.

Maximizing Performance

You will get the highest performance from WinGStretchBlt if you use a WinGBitmap created from header information supplied by a call to WinGRecommendDIBFormat.

WinGStretchBlt is optimized for copying WinGDCs to the screen.

Aligning the destination rectangle to DWORD boundaries (4-pixel boundaries on an 8-bit display) can help WinGStretchBlt to achieve maximum speed.

Stretching by integer ratios is faster than arbitrary ratios. 1 to 2 stretching is fastest.

Clipping can slow WinGStretchBlt down. In general, don't select clipping regions into or blt outside the boundaries of the source or destination DCs and avoid blting to an overlapped window if possible.

See Also

WinGBitBlt WinGCreateDC WinGCreateBitmap WinGRecommendDIBFormat Maximizing Performance With WinG