zoom In/zoom Out an Image

D

dwurity

Hi
I am developing an applet application, in which I have placed an
Image, now I want the Image to Zoom In and Zoom Out, how can I do
this.....

Thanks in advance
dwurity
 
J

jfalt

Zoom in and zoom out use the exact same techniques.
The Graphics2D translate() method sets the top left corner of the
viewable image. The translation happens *after* the image has been
scaled..so your numbers need to be scaled.

For zooming in and zooming out, just use values that are inverses of
each other. For example, if you zoom in 1.25 each time, such that each
time you zoom, your scale *= 1.25, then to zoom out, your scale *= .8
(or scale /= 1.25)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top