"Managed Images" are typically only accelerated for operations
that copy-from the image to an accelerated destination.  This is
because we must retain the original bits of a managed image in
memory that cannot be "lost", as VRAM images on Windows may be.

For scenarios where an image is rendered to once, or infrequently,
managed images are probably a better approach because then you
don't have to worry about handling the acceleration/loss issues.

For scenarios where you are rendering to the image frequently
(as Swing does for its back buffer), a VolatileImage can be more
useful because:
       - we accelerate some operations to that image
       - the image will actually be accelerated (which may not be
       the case for a managed image rendered to frequently)

So for your example below, you're effectively eliminating the
possibility of using an accelerated back buffer.  Whether this
affects the overall performance of your application depends on
what your app is trying to do and the type and frequency of
rendering operations that you are performing.

Chet.


[EMAIL PROTECTED] wrote:
Googling for this I have found this: 
http://swingwt.sourceforge.net/javadoc/swingwt/awt/image/VolatileImage.html
but that is in another Swing implementation.

As of JDK 1.5, all the buffered images created using the constructors of the 
BufferedImage class are managed images. Given that, using VolatileImage as a 
back buffer in RepaintManager does still offer a significant performance 
improvment ?

I am asking this because I've done a nice thing with RepaintManager:
[code]
package myjavaextension.swing;

import java.awt.*;
import java.awt.image.BufferedImage;

import javax.swing.RepaintManager;

public class BlackAndWhiteRepaintManager extends RepaintManager {

   private BufferedImage offscreenBuffer;

   public BlackAndWhiteRepaintManager() {
      super();
      init();
   }

   private void init() {
      Dimension maximumSize = super.getDoubleBufferMaximumSize();
      offscreenBuffer = new BufferedImage(
         maximumSize.width, maximumSize.height, BufferedImage.TYPE_BYTE_GRAY );
   }

   @Override
   public Image getOffscreenBuffer( Component c, int proposedWidth, int 
proposedHeight ) {
      return offscreenBuffer.getSubimage( 0, 0, proposedWidth, proposedHeight );
   }

   @Override
   public Image getVolatileOffscreenBuffer( Component c, int proposedWidth, int 
proposedHeight ) {
      return null;
   }
}
[/code]
Installing this repaint manager will render a gray UI.

But I am affraid that the performance of using VolatileImage as a back buffer 
is lost.
[Message sent by forum member 'jsarmis' (jsarmis)]

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

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