Another way besides adjusting the acceleration threshold
  via the property is to "prime" the images before rendering as
  you're loading them.

  It could be done by rendering an image to a VolatileImage until
  the former becomes "accelerated" as reported by Image.getCapabilities()
  (or until a certain threshold, say, 3, is met, so that you don't loop
  forever if an image can't be cached in vram for one reason
  or another).

  Also, prior to doing all that you might want to check if the
  VolatileImage you have is accelerated (also via
  getCapabilities()).

  Thanks,
    Dmitri
  Java2D Team


[EMAIL PROTECTED] wrote:
I am having problems getting the performance I want when drawing images.

I load a BufferedImage using ImageIO then draw it to a JPanel using the 
Graphics2D.draw(Image, AffineTransform, ImageObserver) method. The first time I 
draw this image it is much slower than subsequent calls. I think that the 
BufferedImage becomes 'Managed' through the creation of a CachingSurfaceManager 
that creates an accelerated SurfaceData object (I have be looking at the Java 
source).

I want my calls to drawImage to be as fast as possible (I am scrolling an area 
with many images drawn on it in various places). So much so that if I have not 
got an accelerated BufferedImage already then I will skip drawing it and return 
to it later. I currently load the image from file in a separate Thread and it 
is here that I want to explicitly make the BufferedImage 'Managed'. I thought 
that I was there by explicitly calling validate(gc) on the 
CachingSurfaceManager for the image, but that did not work. The first call to 
draw is still much slower.

The other option was to create a VolatileImage and draw that. The problem is 
that I need it to work just as well with the opengl and d3d rendering pipeline. 
OpenGL is fine, D3D for some reason is slow.

I am using JDK6. Any help would be appreciated.

Regards,

Alistair
[Message sent by forum member 'alnrelly' (alnrelly)]

http://forums.java.net/jive/thread.jspa?messageID=217999

===========================================================================
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