Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image Observer

 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm implementing/attempting to implement Image Observer in a servlet to draw an image


and have implementation for the method imageUpdate( java.awt.Image image, int flags, int x, int y, int width, int height).
The method does get called and executed. In log, I can see it attempting to wait for the .drawImage call to finish, but the image never gets drawn.
Does anyone know anything about this? Thanks in advance.
Here is the imageUpdate - The lines that show up in the log are 0,4 and 7 - AND NOTHING ELSE!
 
Romain Guy
author
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using an ImageObserver you can make sure that all of your image instances are instances of BuffereImage. A BufferedImage, contrary to the ToolkitImage, is guaranteed to be loaded synchronously.
 
Chet Haase
author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note: when you do use a BufferedImage (which, for instance, is created for you if you load images via ImageIO, or which you can create from scratch in various ways), then you should pass null as the ImageObserver argument to drawImage:



Chet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic