Computer Science @ Marlboro  

Graphics and GUI Programming

Info | Assignments | Lecture Notes | Resources | Roster

WhenTues/Thur 11:30 - 12:50 (Note: tentative; may be 10-110:30
WhereSci 217
FacultyJim Mahoney (
Credits 3-4 ( i.e. 9-12 hours/week including class )
Level Intermediate
Prereq previous computer programming

An examination of the concepts and methods in programming graphical user interfaces made up of windows and mouse clicks as well as other computer graphics such as 3D rendering and animation. The specific topics and level of the course will depend on the students. (We'll likely use Java, Perl, or C.)
Grading will be based on
  • Weekly assignments (one grade for how many done)
  • Several projects; I'm not sure exactly how many yet.
I'm not quite sure what topics at what levels we'll be covering; in part that'll depend on who takes the course.

This webpage will continue to change throughout the semester as assignments and resources are added.

  1. for Tues Jan 27
    1. Send me ( an email telling me you're registering for this class.
    2. Install Perl and Perl/Tk on a system you have access to. Review and/or start translating what you know into Perl, including object oriented syntax. Peruse the Perl/Tk tutorial listed below in the Resources, and get something like that running yourself. (This can be done on; remind me to get accounts up for folks.) Report on progress next Tues.

  2. for Tues Feb 3
    1. Look into either a Perl/Tk or a Java/Swing, and write something along the lines of one of the demos, including some comments. Come to class ready to show your work and discuss which objects, events, and views your code uses. I have links below in the resources section, or share one of the textbooks.
      • Perl: On ("ssh -X user@cs") or on your own Perl/Tk installation (if its up and running), run the Perl/Tk "widget" demo. Just type "widget" at the command line; its installed in /usr/bin/ Browse through the available widgets and code to get a rough idea of what's available. Adopt some of the code for your own purposes - perhaps in a Tic Tac Toe game.
      • Java: Follow the "Creating a GUI with Swing" trail. Download one of their demos, and adopt it to do something simple of your own choosing. (Tic tac toe, anyone?) Be ready to discuss next Tuesday in class.

  3. for Tues Feb 10
    1. Write a Perl/Tk application that draws a fractal in a canvas, something along the lines of the Koch Curve that I showed in class.

  4. for Tues Feb 17
    1. We're moving toward online CGI web scripts and Please read the documentation for and Write a web script that generates a dynamic image. Your choice of what or how.

  5. for Tues Feb 25
    1. 2D mathematics and vectors practice; assigned in class.

  6. for Thurs Mar 4
    1. Read the materials and links on JPEG techniques: compression, cosine transforms, and color spaces.

  7. for Thurs Mar 11 (or at end of spring break)
    1. Mid-term project: write a program which will
      1. display a JPEG image
      2. apply a cosine transform the image, using a block size of your choice,
      3. display the cosine transform
      4. filter the transform to remove some of the higher frequencies, and finally
      5. displays a blurred (higher frequencies removed) image.
      We've been working in Perl, and you can do this that way, but if you'd rather use Java, C, Mathematica, or whatever that's OK too. Feel free to use any libraries you like to import/export the JPEG image to an array of numbers; Perl's in particular comes to mind. You can apply the cosine transform by hand or with a library such as Perl's Math::FFT. I'm planning on doing this as a CGI script, but a stand alone application is OK, too.

      In any case, use your application to illustrate what the cosine transform and this frequency filter does with various examples.

      I intend to grade the result, including what evidence you provide that you understand what's going on.

  8. for Thurs April 1
    1. Answer some questions about 4x4 Discrete Cosine Transforms, with any program or tool you wish. See graphics/dct/ for the questions and answers in Mathematica.

Lecture Notes
  • Jan 20 graphics/introclass.txt
  • Jan 22 perl summary
  • Jan 27 start Perl/TkTues Jan 27 - go over Perl/Tk "widgets" command, Tk/, Tk/, and discuss a bit more of Perl syntax: references and objects
  • Feb 3
  • Feb 10 - images and events in Perl/Tk - see
  • Feb 12 - discussed at show_env.cgi (source) ,, and general ideas behind web applications.
  • Feb 17 - more CGI discussion. Examples in /code/perl/cgi/ (as usual, append _html to URL to see source). Also went over 2D rotations and vectors. See feb17.txt.
  • Feb 24 - rotate,shift,stretch: house/transform.cgi. See sources for readings on compression, JPEG, PNG, etc. Continue discussion of JPEG transformation: YUV, compress UV, 8x8 blocks, DFT, compress, zig-zag order, then run-length and Huffman compression.
  • March 9 - see the notes and programs in graphics/jpeg/ which play around with discrete cosine transforms. Also see notes on mathematica, which is a good way to muck about with this stuff.
  • April 27 graphics/perspective_raytrace.txt


Student work

Jim Mahoney (
Last modified <% scalar localtime($m->current_comp->load_time) %>