• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

image zoom-in

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi!
could anybody help me out with image zoom-in and zoom-out. I am making an applet, wherein on the click of a button, the user should be able to zoom-in successively , and on the click of another button, zoom-out of the image successively. if anybody could help me out in this...
thanx in advance..
meera
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never done this.
I'd try to construct a new image of whatever size I am displaying using a clipping region of the original image effectively zooming in on the original image. To zoom in some more, repeat using some clipping region of the new image. To zoom out, either maintain a collection of images and step backwards through them, or use some clipping region from the original image to construct a new image, etc.
For a more sophisticated approach, you might want to see what the group at Koala Graphics did. They provide an open source, high end, 2D graphics package.
Good Luck.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Meera,
try out the following code:

///
hope u got what u want!
rgds,
Shashi
 
Shashi Kanta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, by the way, if its too small to see, u just copy and paste in onto wordpad.
rgds,
Shashi
 
meera sood
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx a lot..i tried and it worked!!!
otherwise, i tried using the getScaledInstance() method of java.awt and it also worked.
thanx again...

meera
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic