uchicago.src.sim.gui
Class LocalPainter

java.lang.Object
  extended by uchicago.src.sim.gui.Painter
      extended by uchicago.src.sim.gui.LocalPainter

public class LocalPainter
extends Painter

Used by DisplaySurface to do the actual painting of displayables. A typical user should never use this class directly.

Version:
$Revision: 1.8 $ $Date: 2004/11/03 19:50:59 $
Author:
Nick Collier

Field Summary
protected  boolean eraseBox
           
protected  boolean firstDraw
           
protected  java.awt.image.BufferedImage origImage
           
protected  int prevHeight
           
protected  int prevWidth
           
protected  int prevX
           
protected  int prevY
           
 
Fields inherited from class uchicago.src.sim.gui.Painter
bgColor, buffImage, displayables, g2, height, orderedDisplayables, origHeight, origWidth, simGraphics, surface, toolkit, width
 
Constructor Summary
LocalPainter()
          Creates a LocalPainter.
LocalPainter(DisplaySurface s, int w, int h)
          Creates a LocalPainter using the specified displaySurface, and with the specified width and height.
 
Method Summary
 void drawRect(java.awt.Graphics g, int x, int y, int rectWidth, int rectHeight)
           
 void eraseRect(java.awt.Graphics g)
           
 void paint(java.awt.Graphics g)
          Paints all the displayables on the screen in the order they were added to the display surface
 void takeSnapshot(java.io.DataOutputStream os)
          Takes a snapshot of the current screen image and writes it to the specified output stream
 
Methods inherited from class uchicago.src.sim.gui.Painter
addDisplayable, addDisplayable, createBufferedImage, createGraphics2D, dispose, finalize, getCurrentImage, getGraphics, init, paintBackground, removeDisplayable, reSize, setBackgroundColor
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firstDraw

protected boolean firstDraw

origImage

protected java.awt.image.BufferedImage origImage

prevX

protected int prevX

prevY

protected int prevY

prevWidth

protected int prevWidth

prevHeight

protected int prevHeight

eraseBox

protected boolean eraseBox
Constructor Detail

LocalPainter

public LocalPainter()
Creates a LocalPainter. Before this LocalPainter can be used its init method must be called. This will done automatically by the DisplaySurface if this LocalPainter is an argument to a DisplaySurface's constructor.


LocalPainter

public LocalPainter(DisplaySurface s,
                    int w,
                    int h)
Creates a LocalPainter using the specified displaySurface, and with the specified width and height.

Parameters:
s - the displaySurface associated with this LocalPainter
w - the width of the painter
h - the height of the painter
Method Detail

eraseRect

public void eraseRect(java.awt.Graphics g)
Specified by:
eraseRect in class Painter

drawRect

public void drawRect(java.awt.Graphics g,
                     int x,
                     int y,
                     int rectWidth,
                     int rectHeight)
Specified by:
drawRect in class Painter

paint

public void paint(java.awt.Graphics g)
Paints all the displayables on the screen in the order they were added to the display surface

Specified by:
paint in class Painter

takeSnapshot

public void takeSnapshot(java.io.DataOutputStream os)
Takes a snapshot of the current screen image and writes it to the specified output stream

Specified by:
takeSnapshot in class Painter
Parameters:
os - the OutputStream to write the snapshot to