Partager via


Gdi_SetStretchBltMode_I (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

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 operations, 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 Value

If the method succeeds, the return value is the previous stretching mode.

If the method fails, the return value is zero.

To retrieve extended error information, call GetLastError. This can be the following value.

Value Desription

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. To avoid brush misalignment, SetBrushOrgEx must be called after setting the HALFTONE mode .

Depending on the capabilities of the device driver, additional stretching modes may be available.

Requirements

Header gdi.hpp
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

Gdi
SetBrushOrgEx
StretchBlt
GetStretchBltMode