Windows provides a function that you can use to scale a bitmap; this function, StretchBlt, performs a bit-block transfer from a rectangle in a source device-context into a rectangle in a destination device context. However, unlike the BitBlt function which duplicates the source-rectangle dimensions in destination rectangle, StretchBlt allows you to specify the dimensions of both the source and the destination rectangles. When the destination bitmap is smaller than the source bitmap, Windows combines rows and/or columns of color data in the bitmap before rendering the corresponding image on the display. Windows combines this color data according to the specified stretch-mode; this mode is defined by calling the SetStretchBltMode function. When the destination bitmap is larger than the source bitmap, Windows scales or magnifies each pixel in the resultant image accordingly.
The following illustration shows the client area of an application that captures the contents of the entire desktop and stores the corresponding color data in a bitmap. The window on the left displays the original bitmap; the window on the right displays the bitmap after it was scaled to twice its original size by calling the StretchBlt function:
Bitmap Scaling