Results 1 to 5 of 5
- 10-14-2012, 08:13 PM #1
Senior Member
- Join Date
- May 2012
- Posts
- 172
- Rep Power
- 9
Really need help with this one.. (Clopping the image using drawImage)
Ok so I've created a little "game" when you can move and jump, and I used the drawImage like this:
Java Code:g.drawImage(myImage,(int) Window.charX,(int) Window.charY,50,50,null);
But then I've decided to make some animations, basically I've made one image (png) that stores few frames of the characters, and I tried to crop it like this:
Java Code:g.drawImage(myImage,(int) Window.charX,(int) Window.charY,80,120, 0, 0, 40, 60, null);
So, how exactly do I use it?WARNING I am Russian so it's possible that I wont understand you correctly...
- 10-14-2012, 09:44 PM #2
Member
- Join Date
- Sep 2012
- Posts
- 34
- Rep Power
- 0
Re: Really need help with this one.. (Clopping the image using drawImage)
not sure what type of image you use, but i use BufferedImage and then -> image.getSubImage(x,y,width,height);
this way i refer only to the frame i need
- 10-14-2012, 09:58 PM #3
Senior Member
- Join Date
- May 2012
- Posts
- 172
- Rep Power
- 9
Re: Really need help with this one.. (Clopping the image using drawImage)
I use BufferedImage aswell
So that image.getSubImage(x,y,width,height); crops the image?WARNING I am Russian so it's possible that I wont understand you correctly...
- 10-14-2012, 10:09 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 34
- Rep Power
- 0
Re: Really need help with this one.. (Clopping the image using drawImage)
yes.
- 10-14-2012, 10:16 PM #5
Senior Member
- Join Date
- May 2012
- Posts
- 172
- Rep Power
- 9
Similar Threads
-
Problem with drawImage
By matevos in forum AWT / SwingReplies: 1Last Post: 08-06-2012, 10:44 PM -
An image drawn by drawimage on top of Swing application flikers and not stable
By Ghozia in forum AWT / SwingReplies: 1Last Post: 11-30-2011, 04:18 PM -
Does not recognize drawImage method...
By Koba in forum New To JavaReplies: 13Last Post: 11-21-2011, 04:06 AM -
DrawImage with transparency ?
By mrhid6 in forum AWT / SwingReplies: 2Last Post: 10-01-2011, 11:58 PM -
drawImage im 13 plz help
By pseudohawtcakes in forum New To JavaReplies: 3Last Post: 05-17-2011, 08:07 PM
Bookmarks