Ali's Mandelbrot viewer 1.0 Extra credit implemented: Can select different preset color schemes (via save/load) (3 pts) Can save/restore colormap files (5 pts) Has undo command (5 pts) Has redo command (2 pts) Takes command-line parameters (5 pts) Can zoom to arbitrary rectangular regions (5 pts) TOTAL: 25 pts Usage: java Fractal [n] [-zoom x0 y0 x1 y1] n is an optional number of colors (and iterations) to use. -zoom starts the program zoomed to the rectangle with upper-left corner (x0,y0) and lower-right corner (x1,y1). If x0>=x1 or y1>=y0 this parameter will be ignored. Operation is simple; left-clicking zooms in by a factor of 4x and right-clicking zooms out by a factor of 4x. If you have a Mac with one button, you can't zoom out. You can also click-and-drag to select a region to zoom in on. This region must be at least 4 pixels in area. You can load and save colormap files via the Colors menu. The colormaps use the Fractint format and should end in ".map". The format is simple; see below. The State menu allows you to print out the current image parameters, including center coordinates, zoom factor, and image bounds. You can start up the viewer at a specific point by using the -zoom parameter; it takes the coordinates in the order the State menu prints them. The reset button resets the imageto the whole set. The back/forward button act just like those on a web browser; they undo an arbitrary number of moves/resets. The viewer uses multiple threads to calculate the image. Once it has finished calculating the current image, it saves it to a temporary buffer. This means that you can let the viewer draw off-screen, hidden, or minimized, and then view the image when it is complete. The image will not be recalculated until you select a different area to view or resize the viewer window. KNOWN BUGS: If you zoom/reset/resize while the image is drawing, occasionally the program will appear to draw segments of different images. This is due to a bug in Java where threads sometimes refuse to die when their stop() methods are called. The calculating thread, blithely unaware of its demise, continues to draw, using the new paramenters. Java refuses to allow repaint() to be called until the thread stops. Since the thread is now a member of the undead, this only happens when it finishes. Sorry. Complain to Sun. Occassionally an ArrayOutOfBounds index will occur for this same reason. COLORMAP FORMAT: The colormap files can have between 1 and 256 lines. Each line contains a set of three integer values separated by spaces, with each value between 0 and 255. These indicate red, green, and blue values respectively. The first line is the color of the Mandelbrot set, and the nth line is the color for a point that requires n iterations to escape. NOTE: All the included colormap files are from Fractint. See the Fractint license info for details on their allowed usage.