The setstretchbltmode function sets the stretch mode in the content of the specified device.
Int setstretchbltmode (
HDC, // handle of DC
Int istretchmode // bitmap stretch mode
);
HDC: handle of input and device content
Istretchmode: input, the specified stretch mode. The parameter can be one of the following nominal values:
Value
Description
Blackonwhite
Execute a Boolean and operation on the existing element to be deleted. If the bitmap is a monochrome bitmap, this mode retains black pixels as white pixels.
Coloroncolor
Delete pixels. In this mode, all pixel rows to be deleted are deleted without retaining their information.
Halftone
Maps pixels from the source rectangle to the specified target rectangle. The average color of the target and source rectangle is similar.
After setting the halfton stretch mode, the application must call the setbrushorgex function to set the brush source. If the call fails, the brush is not aligned.
This option is not supported on Windows 95/98/ME.
Stretch_andscans
Same as blackonwhite.
Stretch_deletescans
Same as coloroncolor.
Stretch_halftone
Same as halftone.
Stretch_orscans
Same as whiteonblack.
Whiteonblack
Perform a Boolean OR operation to use the color of the existing pixel to be deleted. If the bitmap is a monochrome bitmap, this mode retains the white pixels as black pixels.
Return Value:
If the function succeeds, the previous stretching mode is returned.
If it fails, 0 is returned.
Windows NT/2000/XP: Use getlasterror to get more information. The following is one of them:
Value
Meaning
Error_invalid_parameter
One or more parameters are invalid.
Note:
Stretch mode defines how a program combines bitmap rows or columns with existing pixels on the display device when calling the stretchblt function.
Blackonwhite (stretch_andscans) and whiteonblack (stretch_orscans) are typically used to retain foreground pixels of a monochrome bitmap. The coloroncolor (stretch_deletescans) mode is usually used to retain the color in the color bitmap.
Halftone is relatively slow and requires more source image processing, but provides higher image quality. Similarly, setbrushorgex does not hesitate to use halfton mode to avoid non-alignment of the brush.
In addition, the stretch mode also depends on the device drive capabilities.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/windcsn/archive/2005/09/28/491183.aspx