Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // BufferedImageRenderer.java
- // SwingEasel
- //
- // Created by Philip Rhodes on 9/2/05.
- // Copyright 2005 Philip J Rhodes. All rights reserved.
- //
- import java.awt.*;
- import java.awt.image.*;
- /** This abstract class provides a BufferedImage for double buffering. Although
- * Swing provides double buffering by default, using a BufferedImage allows
- * us to access the array of bytes representing the image, speeding performance.
- */
- public abstract class BufferedImageRenderer extends ImageRenderer{
- /** Create a VolatileImageRenderer to render the shapes in the World w.*/
- BufferedImageRenderer(World w, int width, int height, boolean showFPS){
- super(w, width, height, showFPS);
- }
- /** Creates the Buffered image and associated Graphics object. The image
- * takes its dimensions from the size of the JPanel. (Remember that this
- * class is a child of JPanel.)
- */
- public void init(){
- // do {
- this.backingImage = new BufferedImage(this.imageWidth, this.imageHeight, BufferedImage.TYPE_BYTE_INDEXED );
- // } while(this.backingImage == null);
- this.imageGraphics = this.backingImage.getGraphics();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement