Setstretchbltmode-Windows API

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.