WinGBitBlt

Copies an area from a specified device context to a destination device context. WinGBitBlt is optimized to copy WinGDCs to display Dcs. It does not operate on any other types of Device Contexts.

BOOL WinGBitBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc)

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 source and destination rectangle.
nHeightDest Height of the source and 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.

Return Value

The return value is non-zero if the function is successful. Otherwise, it is zero.

Comments

WinGBitBlt 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.

WinGBitBlt will fail under Windows 3.1 and Win32s if the source DC does not contain an 8-bit-per-pixel WinGBitmap.

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

WinGBitBlt only copies from a WinGDC to a Display DC. To copy from a WinGDC to a WinGDC, use custom blt functions or BitBlt. You can not copy from a Display DC to a WinGDC on Windows 3.x or Win32s.

Maximizing Performance

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

WinGBitBlt 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 WinGBitBlt to achieve maximum speed.

Clipping can slow WinGBitBlt 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

WinGStretchBlt WinGCreateDC WinGCreateBitmap WinGRecommendDIBFormat Maximizing Performance With WinG