First off you'll have to be using 1.4, otherwise you won't be able to take advantage. Secondly have a look for VolatileImage, which is stored only in vRam and which you need to do management of image loss manually. However there are a couple of snafus that may trip you up with volative images, namely i dont think you can do any sort of transparency

There's also 'AutomaticImages' which are regular BufferedImages which the VM will attempt to cache in vRam, and handle management itself. With the correct massaging you can also get these to have 1-bit transparency and still be hardware accelerated.
A code snippit from my (now on permanent hold,

) Phoenix project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| public BufferedImage loadImage(String filename, boolean solid) { Image tempImage = new ImageIcon(filename).getImage(); BufferedImage sprite = null; int spriteW = tempImage.getWidth(null); int spriteH = tempImage.getHeight(null); if (spriteW != -1) { if (solid) sprite = graphicsConfig.createCompatibleImage(spriteW, spriteH, Transparency.OPAQUE); else sprite = graphicsConfig.createCompatibleImage(spriteW, spriteH, Transparency.BITMASK); Graphics2D g = (Graphics2D)sprite.getGraphics(); g.drawImage(tempImage, null, null); g.dispose(); } else { System.out.println("Error loading images: " + filename + " not found"); } return sprite; } |
Jeff et al, if you're reading this - how long until we see a full site with the articles section up again?