1) Freehand Drawing
The Paint program defaults to "freehand" draw mode.
This mode can also be selected by choosing "Freehand" in the drop down list of drawing styles.
Just drag (press and hold the mouse button) the mouse around the drawing area and it paints! Free hand drawing is actually just a series of interconnected lines which are drawn with Bresenham's Algorithm.
2) Line Drawing
This mode is selected by choosing "Line" in the list of drawing styles.
Lines are drawn using Bresenham's line-clipping algorithm.
To draw a line, click and hold the left mouse button on the first point of the line and drag the cursor to the last point for the line. At this time, release the mouse button and the line will be drawn.
3) Circle Drawing
This mode is selected by choosing "Circle" in the list of drawing styles.
Circles are drawn using Bresenham's algorithm for drawing circles.
To draw a circle, select the center by pressing the mouse button and then drag the mouse (with the button still pressed) to the edge of the circle. At this time, release the mouse and the circle will be drawn.
4) Ellipse Drawing
This mode is selected by choosing "Ellipse" in the list of drawing styles.
Ellipse are drawn using a modified version of Bresenham's algorithm for drawing circles.
To draw an ellipse, select the center by pressing the mouse button and then dragging the mouse (with the button still pressed) to the point for the desired width and height of the ellipse. At this time release the button and the ellipse will be drawn.
To initialize clipping, select the "clip" button on the left side of the screen. After selecting the button, draw the clipping rectangle. The clipping rectangle is drawn in rubberband mode so you must click and hold the left mouse button at the upper-left corner of the desired rectangle and drag the mouse until the desired rectangle is drawn. At this time, release the mouse button and the rectangle should be drawn.
If you want to select (resize) the clipping rectangle, just click the "Clip" button again and draw a new rectangle. The applet automatically clips any lines that are on the screen when the clipping rectangle is drawn.
The clipped lines (lines inside clipping rectangle) are drawn in green. Portions (or whole) lines outside the clipping rectangle are displayed in their original color. As specified by one of the TA's (Mike Stark), the lines only need to be drawn within one virtual pixel of the original line.
NOTE: Only lines are clipped!! (circles and ellipses are not clipped, but freehand drawings are clipped because they are a sequence of lines). FreeHand draiwings are only clipped when a new clipping rectangle is specified over them.
6) Stop Clipping
To stop clipping and redraw the lines in their original color, select the red "STOP" button. No more clipping occurs until the "Clip" button is selected again.
7) Variable Grid Size
Select the grid size with the drop down list. When a new grid size is chosen, all objects are erased.
8) Color Selection
Selecting the draw color is accomplished with three scroll bars - red, green, and blue. The current color is displayed above the scroll bars. To change the color, select new values for the red, green, and blue components of the color by using each of the respective scrollbars.
9) Clear Window
To clear the drawing area, press the "clear" button on the left side of the screen.
To undo the last object drawn, press the "undo" button on the left side of the screen. The applet allows an unlimited number of undo's (at least until all objects are gone! - Even then, you can press the button to your heart's delight, but nothing will happen. :).
11) Persistent Drawing
This is not a mode, but rather a special feature of my paint applet. The applet maintains its current state, even if the browser window is scrolled or covered up by other windows (thus the name persistent drawing).