次の方法で共有


SetStretchBltMode (Compact 2013)

3/28/2014

This function 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 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 Value

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

Header

windows.h

Library

coredll.lib

See Also

Reference

GDI Functions
SetBrushOrgEx
StretchBlt
GetStretchBltMode