SetStretchBltMode (Compact 2013)
This function sets the bitmap stretching mode in the specified device context.
int SetStretchBltMode( HDC hdc, int iStretchMode );
[in] Handle to the device context.
[in] Specifies the stretching mode. This parameter can be one of the following values.
Performs a Boolean AND operation using the color values for the eliminated and existing pixels. If the bitmap is a monochrome bitmap, this mode preserves black pixels at the expense of white pixels.
Deletes the pixels. This mode deletes all eliminated lines of pixels without trying to preserve their information.
Linearly interpolates color values in both the x and y directions.
This mode only works when stretching the source, not shrinking.
This mode only works for the raster operations SRCCOPY, SRCAND, and SRCPAINT (see Ternary Raster Operations). If you set this mode for any other raster operation, the mode COLORONCOLOR will be used for bitmaps with a color depth greater than 1bpp, and the mode BLACKONWHITE will be used for bitmaps with a color depth of 1bpp.
If the function succeeds, the return value is the previous stretching mode.
If the function fails, the return value is zero.
To retrieve extended error information, call GetLastError. This can be the following value.
One or more input parameters are invalid.
The stretching mode defines how the system combines rows or columns of a bitmap with existing pixels on a display device when an application calls the StretchBlt function.
The BLACKONWHITE (STRETCH_ANDSCANS) and WHITEONBLACK (STRETCH_ORSCANS) modes are typically used to preserve foreground pixels in monochrome bitmaps. The COLORONCOLOR (STRETCH_DELETESCANS) mode is typically used to preserve color in color bitmaps.
The HALFTONE mode is slower and requires more processing of the source image than the other three modes; however, it produces higher-quality images. Also note that SetBrushOrgEx must be called after setting the HALFTONE mode to avoid brush misalignment.
Additional stretching modes might also be available depending on the capabilities of the device driver.