StretchDIBits


WORD StretchDIBits(LPPDEVICE lpPDevice, WORD fGet, WORD DestX, 
    WORD DestY, WORD DestXE, WORD DestYE, WORD SrcX, WORD SrcY, 
    WORD SrcXE, WORD SrcYE, LPSTR lpBits, LPBITMAPINFO lpBitmapInfo,
    LPINT lpTranslate, DWORD dwROP, LPBRUSH lpPBrush,
    LPDRAWMODE lpDrawMode, LPRECT lpClipRect);

Moves a source bitmap into a destination bitmap, stretching or compressing the source bitmap as necessary to fit the dimensions of the destination bitmap. The function either converts and copies a DIB to a given device or converts and copies a device-specific bitmap to a DIB. The fGet parameter specifies whether the source bitmap is a DIB or device-specific bitmap.

>0

Number of scanlines copied

=0

Error or no scanlines copied

<0

GDI must simulate operation


lpPDevice

Address of a PDEVICE or PBITMAP structure that specifies a device or a device-specific bitmap.

fGet

Flag that specifies whether the bitmap bits should be set or retrieved. If this parameter is zero, the function stretches or compresses the bitmap bits in the buffer pointed to by the lpBits parameter and copies them to the given device or bitmap. If this parameter is 1, the function retrieves bits from the device or bitmap.

DestX and DestY

Coordinates of the upper-left corner of destination bitmap.

DestXE and DestYE

Width and height of the destination bitmap in pixels. If DestYE is negative, the function must "flip" the bitmap, effectively displaying or printing it upside down. In this case, the height of the destination bitmap is the absolute value of the parameter.

SrcX and SrcY

Coordinates of the upper-left corner of source bitmap.

SrcXE and SrcYE

Width and height of the source bitmap in pixels.

lpBits

Address of the buffer that contains or receives the DIB bits. If the fGet parameter is zero, the buffer must contains the bitmap bits to be copied to the device or device-specific bitmap. If fGet is 1, the buffer receives bitmap bits copied from the device or bitmap.

lpBitmapInfo

Address of a BITMAPINFO structure that specifies the dimensions and format of the DIB.

lpTranslate

Address of an array of color translation values to convert palette colors to actual device colors. This parameter is ignored by devices that do not use color palettes.

dwRop

Raster operation to use during stretching and compressing. The dwRop parameter can be any one of 256 ternary raster-operation values; the following lists the most common values.

Value

Meaning

SRCCOPY (0x00CC0020)

Copies source bits to the destination rectangle:

Destination = Source.

SRCPAINT (0x00EE0086)

Combines the source and destination bits using the bitwise OR operator:

Destination = Source | Destination.

SRCAND (0x008800C6)

Combines the source and destination bits using the bitwise AND operator:

Destination = Source & Destination.

SRCINVERT (0x00660046)

Combines the source and destination bits using the bitwise exclusive OR operator:

Destination = Source ^ Destination.

SRCERASE (0x00440328)

Combines the source and inverse of destination bits using the bitwise AND operator:

Destination = Source & (~ Destination).

NOTSRCCOPY (0x00330008)

Copies the inverse of the destination bits to the destination rectangle:

Destination = ~ Destination.

NOTSRCERASE (0x001100A6)

Combines the inverse of the source and destination bits using the bitwise AND operator:

Destination = (~ Source) & (~ Destination).

MERGECOPY (0x00C000CA)

Combines the source and brush bits using the bitwise AND operator:

Destination = Source & Pattern.

MERGEPAINT (0x00BB0226)

Combines the destination and inverse of the source bits using the bitwise OR operator:

Destination = (~ Source) | Destination.

PATCOPY (0x00F00021)

Copies the brush bits to the destination rectangle:

Destination = Pattern.

PATPAINT (0x00FB0A09)

Combines the destination, pattern, and the inverse of source bits using the bitwise OR operator:

Destination = (~ Source) | Pattern | Destination.

PATINVERT (0x005A0049)

Combines the pattern and destination bits using the bitwise exclusive OR operator:

Destination = Pattern ^ Destination.

DSTINVERT (0x00550009)

Copies the inverse of the destination bits:

Destination = ~ Destination.

BLACKNESS (0x00000042)

Set all destination bits to black.

WHITENESS (0x00FF0062)

Set all bits to white.


lpPBrush

Address of a PBRUSH structure that specifies the current brush. Depending on the specified raster operation, the brush may be used during the stretching or compressing of the bitmap.

lpDrawMode

Address of a DRAWMODE structure that specifies the color information the function needs to determine patterned brush colors and to carry color conversions and transparent copy operations.

lpClipRect

Address of a RECT structure that specifies the clipping rectangle.

The export ordinal for this function is 28.

GDI calls this function whenever an application calls the StretchDIBits function (GDI.439).

A graphics device driver must export the StretchDIBits function if the RC_STRETCHDIB value is set in the dpRaster member of the driver's GDIINFO structure.

For Windows version 3.x, the source bitmap will always be a DIB (with the fGet parameter set to zero). The destination bitmap can be either a memory bitmap or the actual device surface.

See also PDEVICE, PBITMAP, DRAWMODE, RECT, GDIINFO