Results 1 to 7 of 7

Thread: Image Zoom

  1. #1

    Thread Starter
    Hyperactive Member TiPeRa's Avatar
    Join Date
    Apr 2001
    Location
    In between
    Posts
    464
    In there an api which will zoom and image in and out SMOOTHLY adn quickly?

    Thanks

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Yes. StretchBlt.
    Code:
    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.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    Megatron
    Guest
    If you're using it locally (within VB, e.g: a PictureBox), then you can use VB's PaintPicture function.

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Note that PainPicture is considerbly slower than StrethBlt (important if the picture is large).
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5

    Thread Starter
    Hyperactive Member TiPeRa's Avatar
    Join Date
    Apr 2001
    Location
    In between
    Posts
    464
    I used paintpicture before and it was slow, but StretchBlt looks a bit complicated!! Any source code available?

  6. #6
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    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
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  7. #7
    Megatron
    Guest
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width