GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Question regarding working on images using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Question regarding working on images using Java" Watch "Question regarding working on images using Java" New topic
Author

Question regarding working on images using Java

Satyanarayana Murthy
Greenhorn

Joined: Jul 30, 2003
Posts: 3
Hi all ,
I have to develop a program which loads an image to Jpanel, and then draws a line using two points.After that when a user click on the image it should be able to zoon in/out.
I am new to java Swing and graphics stuff , i am planning to learn and do this , I really need some suggestion from where to start .I think i have to use java 2d API.I got little bit idea of how to draw a line on image,but i am blank anout how to zoom in /out.
I really appreciate any suggestions ,as this is part of my job atleast i want to know from where i should start.
Thank you
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Moving this to the Swing forum.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Michael Phospere
Greenhorn

Joined: Jul 19, 2003
Posts: 5
Using a BufferedImage (subclasses Image), you can:
1) Call BufferedImage.createGraphics() to get the Graphics context (as a Graphics2D object) for the image.
2) Use Graphics2D.drawXXX to draw whatever you want onto your image.
Michael Phospere
Greenhorn

Joined: Jul 19, 2003
Posts: 5
Mah bad. I didn't read
To simulate zoom in/zoom, I'm guessing you can use BufferedImage.getSubImage() to get the portion of the image you want to zoom in on, then use BufferedImage.getScaledInstance() to scale it back to the full size of the viewing window.
Just a guess, seems like it could work.
Satyanarayana Murthy
Greenhorn

Joined: Jul 30, 2003
Posts: 3
Thank you michel , but i am still not fully satisfied , anyway i will go and read about all that .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question regarding working on images using Java