Set the clipping rect to the size of the desired result image, and draw the image at an offset of the negative value of the location of the result in the big image:
Code:
// drawing the rectangle (30,40) to (40,60) from the big image
// on coordinate x,y
g.setClip(x,y,10,20); // set the clip rect to the size and location of the desired result
g.drawImage(theBigImage,x - 30,y - 40,Graphics.TOP|Graphics.LEFT); // draw the big image at an offset of (30,40) from the destination coordinates (x,y)
shmoove
[edit]
You might also want to save the previous clipping rect (with getClipX(), getClipY(), getClipWidth(), and getClipHeight() from the Graphics class) before setting the new one.
[/edit]