Question of zoom in/out and draw on the same area
HI Folks,
The goal I like to achieve is.
(a) Draw a rectangle on an image by dragging the mouse.
(b) Release the mouse and then click on any point inside the rectangle to
select the region inside the rectangle.
(c) Zoom in: draw the selected region onto the same drawing area as the original (the same) one, that is, replace the original image with its selected region.
I have coded up (a). Would anyone tell me how to code up (b) and (c), best if show me show code snippets.
Thank you very much in advance.
Cheers!
[573 byte] By [
taogoa] at [2007-11-26 20:49:24]

# 1
Hi,
you should make "selection objects" which represent your rect.s.
they could have a drawMe(Rectangle source, Rectangle dest)
method which would be called in the rendering loop. While source represents the selected area of the orignal image and dest the destination aera which drawMe would actually draw the image into.
Source would get set on mouse up after dragging, dest would be set after the click equal to your drawing area.
I'm not sure about the actual image scaling but i think it can be done similar like that: http://www.rgagnon.com/javadetails/java-0243.html.
You dhould definately have a look at javax.imageio.*;
just some ideas
jEti