The StretchBlt Call

BLOWUP1 calls the StretchBlt function during processing of the WM_LBUTTONUP message to transfer the blocked-out image to BLOWUP1's client area:

StretchBlt (hdc, 0, 0, rect.right, rect.bottom,

hdc, ptBeg.x, ptBeg.y,

ptEnd.x - ptBeg.x, ptEnd.y - ptBeg.y,

SRCCOPY) ;

This function is discussed in more detail in Chapter 13, but let's take a quick look at it here.

StretchBlt transfers a bitmapped image from a source to a destination. The first five parameters are for the destination of the image, defining the device context handle, the x- and y-coordinates of the upper left corner, and the width and height. The next five parameters give the same information for the source of the image. The last parameter is the operation, which in this case is a simple copy from source to destination.

The source of the image involves two POINT structures named ptBeg (beginning of the block) and ptEnd (end of the block). These two points have negative coordinate values if you block out an image to the left of or above the client area. StretchBlt can read a bitmapped image that falls outside the client area, but like all GDI functions it cannot write outside the client area.