0

I am working on a Java 2d game, I want to make a method, to check id the images i will update are allready being rendered completely, if they are, then they are not going to be re-drawed.

And now i am stuck. I searched for a way to do this and i found that imageUpdate(Image, InfoFlags, x, y, w, h) its the best method that fits my needs.

I think(anyone correct me if i am wrong) That this returns false if the image is not complety rendered.

Here are my questions. What are Info Flags? Can anyone give an exmaple of this method? Do I need an Image Observer? What is an ImageObser and what it does?

Thanks

Zaphyk
  • 157
  • 2
  • 8
  • This question sounds *very* dubious. What do you mean by "rendered completely"? When you draw an image with `graphics.drawImage(image,x,y,null)` then it **is** "rendered completely", unless you have some really unusual situation that you should explain in more detail... – Marco13 Mar 17 '14 at 23:26
  • Sorry, I didnt explained very well. I mean for example I have a background image and some of the image get cut off, or changes, or sothing gets in front, i will need to re-draw the image right? – Zaphyk Mar 17 '14 at 23:40
  • Usually you just paint everything in the paintComponent method. There you paint the background, and possibly foreground images. There are sophisticated optimizations (own BufferStrategy, VolatileImage etc) but it seems like you are not using them. It is also possible that a call to `reapint(x,y,w,h)` only triggers the repaint of a certain area, but IMHO (!) there are few situations where you can exploit this in order to achieve a higher performance. – Marco13 Mar 18 '14 at 09:04

1 Answers1

0

Did you take a look at the java docs? They should be able to answer your question.

http://docs.oracle.com/javase/7/docs/api/java/awt/image/ImageObserver.html#imageUpdate(java.awt.Image, int, int, int, int, int)

Abubakr
  • 312
  • 2
  • 14
  • Yes, I did. But i still dont get it. Do you have a clear exmaple of whta I have to put in info flags or at least answer one of the questions i asked? – Zaphyk Mar 17 '14 at 20:55