Hi Rafael,

one way is to use the combination of the setClip() and drawImage()
methods of the Graphics class:

e.g., assuming dstX, dstY - the position in the frame where image
should be drawn,
      srcX, srcY, srcH, srcW - the area of image which should be drawn,
then code can look like this:
   g.setClip(dstX, dstY, srcW, srcH);
   g.drawImage(src, dstX - srcX, dstY - dstY, null);

On the other hand if you are working with instance of the BufferedImage
then you can simply get subimage
using getSubimage() and draw it with drawImage().

Thanks,
Andrew.

Rafael wrote:

Hey people! =)

I want to know *how can I draw a specific area of an image in any
point X, Y of my frame*. Example: I have an image of 1024x768 pixels
and
I just want to draw the area X=1, Y=600, Width=500 and Height=600 in
the points 0, 0 of my frame.

Plz, Could someone help me?

Thanks!
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body of the message "signoff JAVA2D-INTEREST". For general help, send
email to [EMAIL PROTECTED] and include in the body of the message
"help".

=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to