CPSC 124, Spring 2006
Programming Assignment 2: Mosaic Draw Continued

This is the second of three programming projects. It is due on Wednesday, April 19. The project is a continuation of the Mosaic Draw program that you worked on for Lab 9. If you did not complete that lab successfully, you can ask me for a copy of my solution to use as a basis for further work.

Remember that this is an individual assignment. You should not give help to or receive help from any other member of the class. You should not discuss your program or show your work to other people in the class. You can get help from me or from the computer science TA's, but not from anyone else. You should not copy code from the Internet or from any other source.

The basic assignment, which will be worth a maximum of about 80%, is to add an "Undo" command, several new "Color"commands, and "Rectangle" and "Filled Rectangle" tools. Furthermore, you must post the applet versin of your program on your web site, along with one or two images that were created using your program. Here is a working version of the applet that meets the basic requirements:

(An executable jar file for the stand-alone application version can be found in the file MosaicDrawCompleteBasic.jar.)

Here are some more details on the required features:

For full credit, and possibly extra credit, you should implement some additional features. Here is a version that implements a large number of features, more than I would expect you to do (but note that the command-key equivalents for the menu commands are probably not active in this applet version):

(An executable jar file for the stand-alone application version can be found in the file MosaicDrawCompleteFull.jar.)

This version has a "Redo" command and an "Undo" that can undo multiple actions. It has added command-key equivalents for some commands and uses radio buttons and checkboxes in the menus for some of the commands. (The command-key equivalents are probably not functional in the appet version.) The applet has a "Line" tool. A new "Mode" menu has been added, and the "Tools" menu has been redesigned. In this version, the "Tool" tells which squares will be affected when the user drags the mouse, and the "Mode" determines what will happen to those squares. For example, the "Brush 3x3" tool combined with the "Erase" mode allows you to erase 3-by-3 blocks of squares. In the "Draw Under" mode, drawing will only affect uncolored squares, while in "Draw Over", drawing only affects squares that already have a color and background squares are left unchanged. In "Blend" the color of a square is set to a combination of 25% of the drawing color and 75% of the current color; "Blend Over" applies this operation only to squares that already have a color. If the "Symmetric" option is turned on, then whenever one square is colored, its horizontal and vertical reflections are also drawn. There is also a more subtle change: Wiggling the mouse around inside a square does not cause that square to continuously change color. These are not by any means the only changes that could be made. It would be nice to have tools for drawing ovals and filled ovals, but these would be even harder than lines. It would be nice to save information about the current picture to a file so that you could reload it later and continue to work on it. It would be nice to be able to choose the amount of blending used in the blend tools. You might be able to think of even more possibilities.

Some of the options are fairly easy to implement, others are quite difficult, and one of them (multiple undos) requires a technique that we have not yet covered in class. I will discuss the implementation of some of these options in class, but you will probably want to come in to discuss your ideas with me and get some help about how to implement them.

David Eck, March 2006