SetStretchBltMode

  int SetStretchBltMode(hdc, iStretchMode)    
  HDC hdc; /* handle of device context */
  int iStretchMode; /* bitmap stretching-mode */

The SetStretchBltMode function sets the bitmap stretching-mode in the given device-context.

Parameters

hdc

Identifies the device context.

iStretchMode

Specifies the stretching mode. It can be one of the following values:

Value Meaning

BLACKONWHITE  
  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.
COLORONCOLOR  
  Deletes the pixels. This mode deletes all eliminated lines of pixels without trying to preserve their information.
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.
HALFTONE  
  Pixels from the source are mapped into blocks of pixels in the destination. The average color over the destination block of pixels approximates the color of the source pixels.

Return Value

The return value specifies the previous stretching-mode if the function is successful; otherwise it is 0.

Comments

The stretching mode defines how Windows combines rows or columns of a bitmap with existing pixels on a display when an application calls the StretchBlt function.

The BLACKONWHITE and WHITEONBLACK modes are typically used to preserve foreground pixels in monochrome bitmaps. The COLORONCOLOR mode is typically used to preserve color in color bitmaps.

The HALFTONE mode requires more processing of the source image than the other three modes; it is slower than the others, but produces higher quality images.

See Also

StretchBlt