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
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.
Joined: Jul 19, 2003
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.
Joined: Jul 30, 2003
Thank you michel , but i am still not fully satisfied , anyway i will go and read about all that .