StretchBlt Function

Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal hSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

StretchBlt copies a piece of an image from one object to another. This function also allows you to change the original size and dimensions of the image piece, unlike the related function BitBlt. In addition to using the straight "copy" method, you can specify other ways of copying the image with the dwRop parameter. The point you specify to put the image in the target object will be the upper-left corner of the piece. The function returns 0 if the function failed and a non-zero value if it succeeded.

hDestDC
The device context of the target object (the one that receives the image piece).
x
The x coordinate of the point to put the image inside the target.
y
The y coordinate of the point to put the image inside the target.
nWidth
The width of the image piece in the target.
nHeight
The height of the image piece in the target.
xSrc
The x coordinate of the upper-left corner of the image piece in the source.
ySrc
The y coordinate of the upper-left corner of the image piece in the source.
nSrcWidth
The width of the image piece in the source.
nSrcHeight
The height of the image piece in the source.
dwRop
Exactly one of the Blt flags specifying the method to use to copy the piece.

Example:

' Copy a 16x32 rectangle from the upper-left corner of one picture box to another,
'  stretching the width to double its original amount
x = StretchBlt(picTarget.hdc, 0, 0, 32, 32, picSource.hdc, 0, 0,16, 32, SRCCOPY)
picTarget.Refresh  ' show the updated image

Related Call: BitBlt
Category: Graphics
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/stretchblt.html