Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StretchDIBits

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function copies the color data for a rectangle of pixels in a DIB to the specified destination rectangle.

If the destination rectangle is larger than the source rectangle, this function stretches the rows and columns of color data to fit the destination rectangle.

If the destination rectangle is smaller than the source rectangle, this function compresses the rows and columns by using the specified raster operation.


WINGDIAPI BOOL WINAPI StretchDIBits(
  HDC hdc,
  int XDest,
  int YDest,
  int nDestWidth,
  int nDestHeight,
  int XSrc,
  int YSrc,
  int nSrcWidth,
  int nSrcHeight,
  CONST VOID* lpBits,
  CONST BITMAPINFO* lpBitsInfo,
  UINT iUsage,
  DWORD dwRop
);

hdc

[in] Handle to the destination device context.

XDest

[in] Integer that specifies the x-coordinate, in logical units, of the upper left corner of the destination rectangle.

YDest

[in] Integer that specifies the y-coordinate, in logical units, of the upper left corner of the destination rectangle.

nDestWidth

[in] Integer that specifies the width, in logical units, of the destination rectangle.

nDestHeight

[in] Integer that specifies the height, in logical units, of the destination rectangle.

XSrc

[in] Integer that specifies the x-coordinate, in pixels, of the origin of the source rectangle in the DIB.

YSrc

[in] Integer that specifies the y-coordinate, in pixels, of the origin of the source rectangle in the DIB.

nSrcWidth

[in] Integer that specifies the width, in pixels, of the source rectangle in the DIB.

nSrcHeight

[in] Integer that specifies the height, in pixels, of the source rectangle in the DIB.

lpBits

[in] Pointer to the DIB bits, which are stored as an array of bytes.

lpBitsInfo

[in] Pointer to a BITMAPINFO structure that contains information about the DIB.

iUsage

[in] Unsigned integer that specifies whether you provided a value for the bmiColors member of the BITMAPINFO structure, and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or indexes.

The following table shows the possible values.

Value Description

DIB_PAL_COLORS

The array contains 16-bit indexes into the logical palette of the source device context.

DIB_RGB_COLORS

The color table contains literal red, green, and blue values.

dwRop

[in] DWORD that specifies how to combine the source pixels, the current brush of the destination device context, and the destination pixels to form the new image.

Nonzero indicates success.

Zero indicates failure.

To get extended error information, call GetLastError.

Aa922062.note(en-us,MSDN.10).gifNote:
The data type of the return value for StretchDIBits in Windows Embedded CE is different from the data type for the return value of StretchDIBits on Windows-based desktop systems

The origin of a bottom-up DIB is the bottom-left corner; the origin of a top-down DIB is the upper-left corner.

StretchDIBits creates a mirror image of a bitmap if the signs of the nSrcWidth and nDestWidth parameters differ, or if the signs of the nSrcHeight and nDestHeight parameters differ.

If nSrcWidth and nDestWidth have different signs, the function creates a mirror image of the bitmap along the x-axis.

If nSrcHeight and nDestHeight have different signs, the function creates a mirror image of the bitmap along the y-axis.

Headerwindows.h
Librarycoredll.lib
Windows Embedded CEWindows CE .NET 4.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2015 Microsoft