Click to See Complete Forum and Search --> : Image Zoom
TiPeRa
Apr 21st, 2001, 04:05 PM
In there an api which will zoom and image in and out SMOOTHLY adn quickly?
Thanks:D
Vlatko
Apr 21st, 2001, 05:18 PM
Yes. StretchBlt.
Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
· hdcDest
Identifies the destination device context.
· nXOriginDest
Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
· nYOriginDest
Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
· nWidthDest
Specifies the width, in logical units, of the destination rectangle.
· nHeightDest
Specifies the height, in logical units, of the destination rectangle.
· hdcSrc
Identifies the source device context.
· nXOriginSrc
Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.
· nYOriginSrc
Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.
· nWidthSrc
Specifies the width, in logical units, of the source rectangle.
· nHeightSrc
Specifies the height, in logical units, of the source rectangle.
· dwRop
Specifies the raster operation to be performed. Raster operation codes define how Windows combines colors in output operations that involve a brush, a source bitmap, and a destination bitmap.
See the BitBlt function for a list of common raster operation codes.
Megatron
Apr 21st, 2001, 07:17 PM
If you're using it locally (within VB, e.g: a PictureBox), then you can use VB's PaintPicture function.
Vlatko
Apr 22nd, 2001, 04:24 AM
Note that PainPicture is considerbly slower than StrethBlt (important if the picture is large).
TiPeRa
Apr 22nd, 2001, 07:02 AM
I used paintpicture before and it was slow, but StretchBlt looks a bit complicated!! Any source code available?
Vlatko
Apr 22nd, 2001, 07:36 AM
Private Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As Long
Private Sub Command1_Click()
'Set the width and height
Picture2.Width = 100: Picture2.Height = 100
Picture1.Width = 50: Picture1.Height = 50
'No pictures
Picture1.Picture = LoadPicture("")
DoEvents
Copy the desktop to our picturebox
PaintDesktop Picture1.hdc
'Stretch the picture
StretchBlt Picture2.hdc, 0, 0, 100, 100, Picture1.hdc, 0, 0, 50, 50, ScrCopy
End Sub
Megatron
Apr 22nd, 2001, 10:10 AM
I, personally haven't tested it, but Kedaman did some tests on this, and PaintPicture proved to be faster. You could probably E-mail him for the exact numbers.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.