Zooming in on a particular part of a BufferedImage

MrsPitney

New Member
I am trying to get a subImage of a \[code\]BufferedImage\[/code\] and then use this subImage to replace the original \[code\]BufferedImage\[/code\], to implement a zooming feature based on a user specified selection. However, when I redraw the subImage onto the original image the bottom of the sub-image is not being displayed. I have no idea why. I was wondering if anyone could spot any obvious faults!?!\[code\]private void zoomImage(int x1, int x2, int y1, int y2){ BufferedImage subImage = originalImage.getSubimage(x1, y1, x2-x1, y2-y1); Graphics2D graphics2D = (Graphics2D) originalImage.getGraphics(); graphics2D.drawImage(subImage, 0, 0, 600, 400, 0,0, x2-x1,y2-y1, null); // clean up graphics2D.dispose();}\[/code\]I was also wondering if there is a better way to implement zooming in on a particular rectangular selection and use the zoomed in section to replace the original image.
 
Top