Homework Assignment 3

Deadline: 14/3 (during/after class)

1. A simple drawing program.

For this exercise you need to construct a very simple drawing program. Your webpage will have a canvas on which the user should be able to draw with the mouse. The specifications are the following:

  1. The user should have a selection of tools available: pencil, line, circle and rectangle.
  2. The user should be able to pick a color and thickness of the drawing tool he's using.
  3. The pencil should work in the natural way: the user presses the left mouse button and drags the pointer around the canvas.
  4. The other tools should also be drag-and-release: for example, for the line the user presses the mouse on one endpoint of the line, and then drags the pointer (keeping the mouse pressed) to the other endpoint. The drawing should refresh in real time, showing what the line will look like.
  5. There should be a clear button that resets the canvas to all-white.