game
Class BackupPixelObserver

java.lang.Object
  extended by game.BackupPixelObserver
All Implemented Interfaces:
PixelObserver

public class BackupPixelObserver
extends java.lang.Object
implements PixelObserver


Constructor Summary
BackupPixelObserver(GraphicsPanel panel)
          Initiates the act of observing changes wrought by ImagePainters to the supplied panel.
 
Method Summary
 void pixelAffected(Point p, java.awt.Color newColor, java.awt.Color oldColor)
          If this is the first time we have changed this pixel, then record the old color for this pixel so it can be restored later
 void restore()
          For each pixel that has been changed, restore it to the color value it had when we started this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackupPixelObserver

public BackupPixelObserver(GraphicsPanel panel)
Initiates the act of observing changes wrought by ImagePainters to the supplied panel.

Parameters:
panel - The panel hosting the image being modified.
Method Detail

pixelAffected

public void pixelAffected(Point p,
                          java.awt.Color newColor,
                          java.awt.Color oldColor)
If this is the first time we have changed this pixel, then record the old color for this pixel so it can be restored later

Specified by:
pixelAffected in interface PixelObserver

restore

public void restore()
For each pixel that has been changed, restore it to the color value it had when we started this class. When done, call panel.repaint() so it forces the update out.