|
Re: image "area selection" tool?
|
Posted: Apr 1, 2002 3:35 AM
|
|
Hai,
Just use paint method to draw an Image(drawImage(img,x,z,obs)) and create a logic in ur paint method to draw a rect using mouselistener and mousemotionlistener Like starting point(x1,y1) at mousepressed and ending point(x2,y2) at mouse released, it must be like g.setColor(Color.red); Rectangle selectionRect=new Rectangle(x1,y1,x2-x1,y2-y1); g.drawRect(selectionRect);
Then use cropImage method to crop image of the about rectangle
ImageFilter filter=new CropImageFilter(selectionRect); Image cropimg=createImage(new FilteredImageSource(img.getSource(),filter));
this is just a guide,
if u have doubts can contact me at david_cor@rediffmail.com
regards, David
|
|