Beruflich Dokumente
Kultur Dokumente
Overview
This exercise has two related parts; in the first part you will practice the use of multidimensional arrays by implementing a class for representing color images. In the second part you will graphically explore the Mandelbrot set. Overall you need to implement two classes according to their given API: 1. RGBImage, which uses the RGBColor class. 2. Mandelbrot class, which uses the Complex class and RGBImage classes. To avoid interference from bugs and possible incompatibilities with your implementation from ex4, we provide you our own RGBColor (API) and Complex (API) classes (used by the school solution). Please use these provided classes and not your own classes. The classes are available in the intro.ex5 package and you may import them using import intro.ex5.RGBColor; import intro.ex5.Complex;
RGB Image
In this part of the exercise you will use a two-dimensional array of RGBColor objects to represent a color image. Each point in the image is called a pixel (picture element) which represents the color at a single coordinate.
Error handling
Use the intro.ex5.ErrorPrinter class to handle invalid parameters for the RGBImage class. Whenever the API says to "raise an error," call the ErrorPrinter.error method, and pass it a short message explaining what the error was. This method will print your error message and then terminate the program.
User interaction
The user may zoom in on a certain area by clicking the right mouse button. This will cause the image to be magnified by a constant factor, and re-centered around the selected point. The user may also shift the area displayed (without changing the magnification) by pressing and dragging with the left mouse button. This will cause the image to be redrawn so that the point where the user pressed the button moves to the point where the user released the button. Note: all of the interaction is handled by the classes that we provide you. Your task is only to correctly implement the classes RGBImage and Mandelbrot, according to the provided API.
Testing
As in previous exercises, we provide you with automatic testers we'll use on your solution. You may run them in one of the following ways: Run the command ~introcsp/bin/testers/ex5 ex5.jar from the shell. Download the file www.cs.huji.ac.il/~introcsp/testing/ex5testing.tar.bz2 (or .zip) and follow the instructions in the TESTING file.
Submission
Submit a jar file named ex5.jar containing the files RGBImage.java, Mandelbrot.java and README.