The Java 2D API implements a new imaging model that supports the manipulation of fixed-resolution images stored in memory. A new Image class in the java.awt.image package, BufferedImage, can be used to hold and to manipulate image data retrieved from a file or a URL. For example, a BufferedImage can be used to implement double buffering--the graphic elements are rendered off-screen to the BufferedImage and are then copied to the screen through a call to Graphics2D drawImage. The classes BufferedImage and BufferedImageOp also enable you to perform a variety of image-filtering operations, such as blur and sharpen. The producer/consumer imaging model providedin previous versions of the JDK is supported for backward compatibility.
bi = new BufferedImage[4]; String s[] = { "bld.jpg", "bld.jpg", "boat.gif", "boat.gif"}; for ( int i = 0; i < bi.length; i++ ) { Image img = getImage(getURL("images/" + s[i])); try { MediaTracker tracker = new MediaTracker(this); tracker.addImage(img, 0); tracker.waitForID(0); } catch ( Exception e ) {} int iw = img.getWidth(this); int ih = img.getHeight(this); bi[i] = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB); Graphics2D big = bi[i].createGraphics(); big.drawImage(img,0,0,this); }