SA-3, due Apr 5

Create an image processing tool that modifies an image locally where the mouse is, as you move the mouse. (So kind of like the mouse is a brush, just touching up in a portion of the image.) The modification is up to you, so have fun with it.

Exercises

  1. Start with the stripped down ImageProcessingGUI0.java and ImageProcessor0.java from lecture notes.
  2. In ImageProcessor:
    1. Add an image processing method of your choice, but only operating "near" a certain coordinate. That is, it should take x and y coordinates (and perhaps others), and do something right around there. For help, take a look at "drawSquare" from my completed image processor as an example, but do something more interesting :).
    2. Comment the method as to what it's supposed to be doing to the image.
  3. In ImageProcessingGUI:
    1. Add an instance variable to keep track of whether the "brush" is down or up. The image should only be modified when the brush is down.
    2. Modify "handleKeyPress" to support key presses for "brush down" and "brush up", setting the instance variable accordingly.
    3. The DrawingGUI superclass supports a method called "handleMouseMotion" that works exactly like "handleMousePress", but is called as the mouse moves.
      @Override
      public void handleMouseMotion(int x, int y) {
        ...
      }
      Provide this method in ImageProcessingGUI (i.e., paste this signature and fill in the body), having it invoke your image processor method only when the brush is down. Note that you'll need to invoke "repaint" after modifying the image, so that the display will be updated.

Submission Instructions

Turn in your completed Java code and a snapshot of an image that you've modified using it.