CMSC 437/691C
Graphical User Interface Programming


TUE,THU 5:30-6:45 PM ACIV 150
Fall 1996


Project 2: A Pixel-Based Paint Program

This page was last updated on 2 October 1996.
Date Due: Tuesday, October 8, 1996 before midnight.

Purpose

To familiarize you with basic X11 drawing operations, interactive mouse input, event handling, and Motif manager widgets.

Assignment

You must write a pixel-based paint program based on the Motif DrawingArea widget. Commands to the program will be given using PushButton and ToggleButton widgets, which will set the various drawing modes, and direct interaction with the mouse on the DrawingArea widget. No menus, pop-up dialog boxes, etc. are required.

The paint application project should take the form of a large rectangle for drawing flanked by a vertical tool bar on the left and a horizontal color bar on the top. The tool bar should consist of icons which can be selected to set the type of shape to be drawn, the fill mode and the color mode. The color bar should contain buttons for selecting the current color. The drawing area should allow interactive drawing of the selected shapes in the current drawing color. Two push buttons, in the upper-left, should allow the drawing area to be cleared to the clear color and the program to quit.

The final program should have the following functionality:

In addition to the above, projects by students enrolled in the 691C section should have the following:

Hints

As before, you are encouraged to reuse code from a prototype. Also as before, please indicate in your code which prototype you are working from, even if your final result bears little resemblance to the original.

One place to start is the "draw" program in Chapter 13 of the Young textbook. However, since that program is more sophisticated than the assignment in its use of widgets, I suggest that you start with your Project 1 code and add in portions from the "draw" program, rather than starting with the "draw" program.

Another prototype is called 'draw2', which comes from O'Reilly volume 6A, and will be available in ~ian/pub/guip/oreilly/ch10/draw2.c. It is a very simple example illustrating the DrawingArea, pixmap-storage, and handling input with callbacks (rather than Event Handlers).

Demo Example

I have installed an example of the second project in ~ian/pub/guip/proj-ex/proj2/color_draw. As with the demos for Project 1, this example does not necessarily have all the features or look-and-feel of what you are required to do! For example, your project requires a different widget layout. However, it does have colors, rubberbanding, and all the tools, and the behavior of the tools is as described above.