Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Scale the image

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this problem, please provide me with some suggestions.
Imagine i have a rectangle of 374*378 and an image is loaded into that rectangle , now when a user clicks anywhere on that image , i will retrieve that point(upto this i am able to solve the problem).Now i have to make that point as center of the image and take the surrounding portion of the image and fit into the same rectangle. This is nothing but doing a zoomin depending on where the user clicks on that image.
I really appreciate any suggestions
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well base your offset on the size of the display area. What I mean is, if they click on say 285,235 as an example, and your display area is 374 * 378, then base your offset off half your display area (i.e. 98... because 285 - (374 / 2) = 98) and the same for the height. That should set the image up so the point they clicked on ends up being in the middle.
Hrm... I'm not sure if I explained that right... well can't hurt to try this forum isn't very active.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And if you want me to get specific about it (like with code) I need to know what you're using to display and manipulate the image. i.e. Swing, AWT, JAI? ImageIcon? PlanarImage? etc.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic