Keith's right on the general ideas of Volatile vs. BufferedImage acceleration, but let me correct/clarify some of the details:
- GraphicsConfiguration.createCompatibleImage() will create a VRAM-cached accelerated copy of the BufferedImage and you will benefit from hardware acceleration as available on 1.4. This was not something new in 1.5, but has been there since 1.5. Other "managed image" APIs that create this acceleratable cached version of the image include Component.createImage(w,h) and (I think) Toolkit.loadImage()/(new ImageIcon()).getImage().
- New in 1.5 is the ability to get a managed image from _any_ image creation method, including new BufferedImage(w, h, type). Same acceleration functionality as described above, but now you don't have to call particular APIs to get that capability.
- The main reason for dealing with VolatileImages is if you need/want rendering _to_ the image to be accelerated, or if you will be modifying the image frequently but still want copies from the image to be accelerated. A common case for this is back buffers; the Swing back buffer is a VolatileImage. Otherwise, managed images (as described above) are way less hassle but have the same benefits of fast copies (Blts).
For more nitty gritty details on BufferedImage and VolatileImage objects and random acceleration tips, check out the BufferedImage and VolatileImage blogs on javadesktop.org.
Chet.
Keith Lea wrote:
If you're targeting JDK 1.5, you can use an accelerated BufferedImage instantiated from a GraphicsConfiguration (with the createCompatibleImage method), which is stored in memory but also cached in your video card's VRAM. I'm not sure what "blting" is, but BufferedImage probably provides the fastest and easiest way to copy image data to other BufferedImages and to the screen.
If you need JDK 1.4 compatibility, you should use VolatileImage, probably backed by a BufferedImage (which is not, in 1.4, stored in VRAM). VolatileImages are stored in VRAM like 1.5's accelerated BufferedImage.
(You could also use VolatileImage in 1.5, but for most applications it's not worth the extra code required when BufferedImage is mostly just as fast.)
-Keith
Lincoln Quirk wrote:
So if someone could help me out -- how do I create a region that I can do some low-level, fast blt'ing to? Or, if you have a better idea on how I should implement my physics that takes better advantage of Java, some ideas about that would be good too.
Thank you,
Lincoln Quirk
===========================================================================
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".
