VIZA 652
Fall 1997
Draw Program
Homework Assignment 9
Due: 5:00pm, Monday, December 8, 1997
Assignment
Your assignment is to write a C program that extends the interactive sketching
program that you did for homework problem 7. This time, however, the program
will have additional features that you might find in a commercial drawing
program.
Drawing tool selection is done from a menu of tools displayed along
the left-hand side of the screen. The following tools should be available:
-
pencil -- pencil line simply draws using the mouse when the left
mouse button is depressed.
-
line -- straight line draws a "rubber-band" straight line with starting
point at the position where the mouse left button is pressed, and ending
point at the current mouse position as long as the button is held down.
When the button is released, the line is permanently drawn.
-
box -- outlined rectangle draws an outlined rectangle, with one
corner at the position where the mouse left button is pressed, and diagonally
opposite corner at the current mouse position as long as the button is
held down. When the button is released, the outline of the rectangle is
permanently drawn.
-
rectangle -- filled rectangle draws an outlined rectangle, with
one corner at the position where the mouse left button is pressed, and
diagonally opposite corner at the current mouse position as long as the
button is held down. When the button is released, the filled rectangle
is permanently drawn.
-
quit -- exit program causes the program to terminate
Color selection is done from a palette of colors displayed as a menu across
the top of the screen. When the user clicks the mouse in the palette area,
the program will switch to using the color that was clicked on to do any
subsequent drawing operations.
Please run the program
/usr/local/misc/courses/viza652/examples/draw
to see one example of a correctly working program.
Turn In
Turn in the C source code for your program and the executable. Use the
submit procedure:
submit 652 9 files
where files stands for the file names for the source code and
executable files.