public class RestoreImage extends Manipulator{
  
  /** the copy of the original image */
  private Pixel[][] savedCopy;
  
  /** creates a new RestoreImage object saving a copy of the current image */
  public RestoreImage (ImageBase ib) {
    Picture picture = ib.getPicture();
    savedCopy = new Pixel[picture.getWidth()][picture.getHeight()];
    for (int x = 0; x < picture.getWidth(); x++) {
      for (int y = 0; y < picture.getHeight(); y++) {
        savedCopy[x][y] = new Pixel(picture.getPixel(x,y).getComponents());
      }
    }    
  }

  public String getManipulationName() {
    return "Restore";
  }
    
  /** returns the saved copy to be copied over to the working image */
  public Pixel[][] processImage(Pixel[][] picture) {
    return savedCopy;
  }
}


