Copies a bitmap into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary.
Stretch x, y, a$, w, h [, Mod]
Stretch x, y, hBmp, w, h [, Mod]
x, y, w, h, Mod:integer expression
a$:svar; bitmap
hBmp:integer expression; bitmap handle
Stretch copies the bitmap specified in a$ to the coordinates specified in x and y. The bitmap must first be read into the variable a$ by using Get.
hBmp can be used instead of a$. In this case a handle, obtained from Get or LoadImage, or a handle from a Picture object, is passed.
w and h specify the width and height of the destination area. If the dimensions of the source area are greater than the destination area the bitmap is correspondingly shrunk. In the reverse case, i.e. the dimensions of the source area are smaller than that of the destination area the bitmap is correspondingly stretched.
During the copy the source raster, the destination raster and the current fill pattern can be combined with each other. Mod must then take of the following values:
BLACKNESS( $00000042)
DSTINVERT( $00550009)
MERGECOPY( $00C000CA)
MERGEPAINT( $00BB0226)
NOTSRCCOPY( $00330008)
NOTSRCERASE( $001100A6)
PATCOPY( $00F00021)
PATINVERT( $005A0049)
PATPAINT( $00FB0A09)
SCRAND( $008800C6)
SRCCOPY( $00CC0020)
SRCERASE( $00440328)
SRCINVERT( $00660046)
SRCPAINT( $00EE0086)
WHITENESS( $00FF0062)
For Description of the values see command BitBlt
Local a$, a%, n%
Local x%(5), y%(5)
For n% = 0 To 4
Read x%(n%), y%(n%)
Next n%
OpenW 1
PolyFill 5, x%(), y%() Offset _X / 2, _Y / 2
Message "Click OK to continue"
Get _X / 2 - 96, _Y / 2 - 82, _X / 2 + 96, _Y / 2 + 100, a$
Stretch 0, 0, a$, 96, 91
Data -59,-81,0,100,59,-81,-95,31,95,31
Draws a star, gets it in a string (a$) and puts it back using Stretch at position (0,0), using half of the width and half of the size. The picture is really sized to size 96x91 instead of the original 192x182.
AutoRedraw = 1
Ocx CommDlg cd
With cd
.Filter = "*.bmp;*.gif;*.jpg"
.FileName = "*.bmp;*.gif;*.jpg"
.IniDir = WinDir
.ShowOpen
EndWith
Dim pic As Picture
If Exist(cd.FileName)
Set pic = LoadPicture(cd.FileName)
Stretch 0, 0, pic.Handle, _X, _Y
Set pic = Nothing
EndIf
Stretch corresponds to Windows function StretchBlt().
CreatePicture, LoadPicture, PaintPicture, FreeBmp, BitBlt, PatBlt
{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}