CS476/576

Assignment #2

Due Midnight, Wednesday   Oct 24, 2012


Write  an X lib/Motif  program with the following descriptions:

 

NAME

draw3cbs  draw 3 colored basic shapes

 

SYNOPSIS

draw3cbs

 

DESCRIPTION
The program interface has a drawing canvas to draw three basic colored shapes: lines, circles and rectangles.

To draw a shape the user clicks twice at two different points  p1 and p2.

Let d be  the distance between p1 and p2 and X is some integer value, e.g. 100.

·        If d <= X draw a line between p1 and p2.  Mark the two ends of the line with two small solid circles.

·        If  d > X and d <= 2X draw a circle centered between p1 and p2 with diameter d. Mark the center and the two points with small solid circle.

·        If d > 2X draw a rectangle with two of its vertices at p1 and p2. Mark the four vertices with small solid circles.

 

In addition the program has three control areas:

·        Color Control:  To select a color from at least four colors: red, green, blue and black:                      n n    

·        Program Control: Contains two buttons*:

Quit: Exit the program with a chance to confirm or cancel.

Clear:  Clears the drawing area with a chance to confirm or cancel.

 

See http://www.cs.odu.edu/~cs476/fall12/assignments/a2/wahab/   sample solution

 

*The interaction with these control buttons follows a "modal" interface –one that prevents the user from interacting with the application until completing the current activity.