Slick -> First copy() that rotate and than subimage

Hello,
like the topictheme already says I’m trying to use Slick (it’s my first time) and my programm works surprising well, but now I met my first error^^
To the Problem:
I have a few "master"pictures, that I create once and don’t reload if I’ve used them. Now I want to rotate this picture, but because I don’t want to work with my master picture I make a copy of it, with the simple command copy() so far so easy. Not I use the rotate command on it (I rotate it 90, 180, 270 and 0 degrees), and than I need a little part of this rotated picture on my display, to get this little part I use the subImage command from the Image class of Slick.

My Problem is, that after I do all that and my programm shows me the result I see, that I have a subimage of the picture, which isn’t rotated… I think, that the problem is the shadow copy that the copy command created… But I’m not sure how to make a FAST hard copy… Maybe you can help me.

Here the code:

			
                        Image draw = img.copy();
			draw.rotate(grad);
			Image newdraw = draw.getSubImage(actx, acty, this.tilewidth-actx, this.tileheigth-acty);
			newdraw.draw(0, 0);

Thanks alot for your help, if this isn’t enough code just ask me.

biro

Hello,
sorry if I should do a kind of double post now, but I believe that it’s stylistic better if I write this in a new post.

Today I continued to experiment on my m´litte Programm and the result is very satisfying, or at least half satisfying!
I got my programm so far that it draw the picture now correct, meaning a subimage of the rotated original. Looks like the only thing that needed to be done was a flush() on the graphics of the copy. The only thing I don’t like is that everytime my programm shows me now the picture it also says:

Sat Apr 30 10:58:22 CEST 2011 INFO:Offscreen Buffers FBO=true PBUFFER=true PBUFFERRT=true
Sat Apr 30 10:58:22 CEST 2011 DEBUG:Creating FBO 50x50

Can someone translate that for me in an english that I can understand please?^^

Here the used code:

		Image draw = img.copy();
			draw.rotate(grad);
			Image aimg = this.getCopy(draw);
			Image newdraw = draw.getSubImage(actx, acty, this.tilewidth-actx, this.tileheigth-acty);
			newdraw.draw(0, 0);

And here the getCopy() Method, that only does flush at the moment…

  private Image getCopy(Image img) throws SlickException {
		Image aimg = new Image(img.getWidth(), img.getHeight());
		Graphics g = img.getGraphics();
		//g.copyArea(aimg, 0, 0);
		g.flush();
		return aimg;
  }

What I now don’t understand is why the flush is needed, for that the subimage gets taken form the rotated picture and not from the not rotated one, maybe someone can explain that to me. And maybe someone has another Idea for how to write it shorter.

Greetings
biro

Edit:
It looks like that my rotation method kills my fps… while I have an undrosseled fps from between 3000 and 5000 I have only and fps of about 20 when my screens shows and rotated picture… Hope someone can help me and has an more efficient way to get a subimage from an rotated image…