SetStretchBltMode function (wingdi.h)
The SetStretchBltMode function sets the bitmap stretching mode in the specified device context.
int SetStretchBltMode(
[in] HDC hdc,
[in] int mode
);
[in] hdc
A handle to the device context.
[in] mode
The stretching mode. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
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. |
|
Maps pixels from the source rectangle into blocks of pixels in the destination rectangle. The average color over the destination block of pixels approximates the color of the source pixels.
After setting the HALFTONE stretching mode, an application must call the SetBrushOrgEx function to set the brush origin. If it fails to do so, brush misalignment occurs. |
|
Same as BLACKONWHITE. |
|
Same as COLORONCOLOR. |
|
Same as HALFTONE. |
|
Same as WHITEONBLACK. |
|
Performs a Boolean OR operation using the color values for the eliminated and existing pixels. If the bitmap is a monochrome bitmap, this mode preserves white pixels at the expense of black pixels. |
If the function succeeds, the return value is the previous stretching mode.
If the function fails, the return value is zero.
This function can return the following value.
Return code | Description |
---|---|
|
One or more of the input parameters is 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; but 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.
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wingdi.h (include Windows.h) |
Library | Gdi32.lib |
DLL | Gdi32.dll |