SetStretchBltMode (Windows CE 5.0)

Send Feedback

This function sets the bitmap stretching mode in the specified device context.

int SetStretchBltMode(  HDC hdc,  int iStretchMode);

Parameters

  • hdc
    [in] Handle to the device context.
  • iStretchMode
    [in] Specifies the stretching mode. This parameter can be one of the following values.
    Value Description
    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.
    BILINEAR 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.

Return Values

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.

Value Meaning
ERROR_INVALID_PARAMETER One or more input parameters are invalid.

Remarks

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.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Windows.h.
Link Library: Coredll.lib.

See Also

GDI Functions | SetBrushOrgEx | StretchBlt | GetStretchBltMode

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.