Results 1 to 16 of 16

Thread: Zooming A picture

  1. #1

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Does anyone know how to zoom (+ or -) a picture in a picture box. Please give me the code.

    Thanks.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Maybe you want to stretch a part of the picture (where you want to zoom)... So use StretchBlt

    Example is on my page

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Wink

    Recently, I have done some performance research with graphical functions. Paintpicture is faster than stretchblt in this case
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Can you PLEASE give a code for zooming out and in a picture in a picture box. It would be of great help to me.


    Thanks.
    Kinjal

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Post

    Wow! They just changed the outlook of this site again.

    Ok, speed is here the zoomfactor.
    Code:
        With Picture1
            .Picture = .Image
            .PaintPicture Picture1, 0, 0, .ScaleWidth, .ScaleHeight, .ScaleWidth / speed, .ScaleHeight / speed, .ScaleWidth - .ScaleWidth / speed * 2, .ScaleHeight - .ScaleHeight / speed * 2
        End With
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Talking

    I would use the BitBlt API. Its great for working with images. If you don't know how to use it then simply goto the tutorial section of Lucky's VB Gaming Site.
    rino_2
    Visual Basic, HTML
    Please Visit my Site: Richard's VB Site

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Thumbs down

    Bitblt surely is fastest but it doesn't stretch
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    593
    Try the StretchBlt API then. It stretches where BitBlt does not (I think).

    John

  9. #9
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    That's right. But I heared PaintPicture is faster (and can also stretch)...

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Unhappy Is anyone reading my posts at all?

    Just (if you care) read trough this thread and you know what I mean
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Thumbs up

    Hello Kedanan

    Your code worked excellent for magnifying!
    But how do I use your code to demagnify the picture? What are the changes required in the code? Hoe to maintain the aspect ratio of the picture?

    Thanks.

    Kinjal

  12. #12

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Hello FOX

    Your example did not work on my picture box, i don't know why? I have drawn grid on my picture box using picture.pset
    and also draw lines. But none of them are magnified using your code.


    Kinjal

  13. #13
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Which example did you download? The Screenshot demo uses StretchBlt to resize the captured picture so if you want to zoom into a picture you have to replace the DCs and coordinates of StretchBlt call...

  14. #14
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Wink

    Just set speed to a negative value. With paintpicture you should be able to mirror & flip the picture too. To get the ratio, just use some math.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  15. #15
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    593

    Unhappy Re: Is anyone reading my posts

    Just (if you care) read trough this thread and you know what I mean
    No...oops

    Sorry!

    John

  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Thumbs up

    John, could you make some color options for me (i don't like the purple background)?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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