# Function Reference

# _WinAPI_StretchDIBits

Copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle, stretching or compressing the rows and columns by using the specified raster operation

#include <WinAPIGdi.au3>
_WinAPI_StretchDIBits ( $hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $tBITMAPINFO, $iUsage, $pBits, $iRop )

## Parameters

$hDestDC | Handle to the destination device context.
$iXDest | The x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
$iYDest | The y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
$iWidthDest | The width, in logical units, of the destination rectangle.
$iHeightDest | The height, in logical units, of the destination rectangle.
$iXSrc | The x-coordinate, in pixels, of the source rectangle in the image.
$iYSrc | The y-coordinate, in pixels, of the source rectangle in the image.
$iWidthSrc | The width, in pixels, of the source rectangle in the image.
$iHeightSrc | The height, in pixels, of the source rectangle in the image.
$tBITMAPINFO | $tagBITMAPINFO structure that contains information about the DIB.
$iUsage | The type of colors used. (either logical palette indexes or literal RGB values). The following values are defined: $DIB_PAL_COLORS $DIB_RGB_COLORS
$pBits | A pointer to the image bits, which are stored as an array of bytes.
$iRop | The raster-operation code that specifies how the source pixels, the destination device context's current brush, and the destination pixels are to be combined to form the new image. It must be 0 or one of the following values: $BLACKNESS $CAPTUREBLT $DSTINVERT $MERGECOPY $MERGEPAINT $NOMIRRORBITMAP $NOTSRCCOPY $NOTSRCERASE $PATCOPY $PATINVERT $PATPAINT $SRCAND $SRCCOPY $SRCERASE $SRCINVERT $SRCPAINT $WHITENESS

## Return Value

Success: | the number of scan lines copied. Note that this value can be negative for mirrored content. 0 - Otherwise.
Failure: | sets the @error flag to non-zero (GDI_ERROR).

## Remarks

_WinAPI_StretchDIBits() creates a mirror image of a bitmap if the signs of the $iWidthSrc and $iWidthDest parameters,
or if the $iHeightSrc and $iHeightDest parameters differ. If $iWidthSrc and $iWidthDest have different signs,
the function creates a mirror image of the bitmap along the x-axis. If $iHeightSrc and $iHeightDest have different
signs, the function creates a mirror image of the bitmap along the y-axis.

## See Also

Search StretchDIBits in MSDN Library.