qd.pl is a small contribution to the world of perl hackery. It is a library of perl routines for creating Macintosh PICT files. It replaces a large number of the MacOS Quickdraw routines with equivalent perl subroutines. It handles text drawing, line drawing, rectangles, ovals, polygons, round-cornered rectangles, color and pattern transfer modes, and various scaling and warping operations.
Why would anyone want such a thing? The main advantage that PICT format has over more powerful graphics languages, such as Postscript, is that the pictures generated in this way can be manipulated on an object-by-object basis in any of the Macintosh drawing programs. Further, PICT is pretty standard at this point and many MS-WINDOWS and even a few X11-based drawing programs can read and write this type of file. It is also easy to translate the images into GIF, JPEG, TIFF or Postscript using the NetPBM utilities (Note: NetPBM is available many places. If this particular ftp site is busy, use Archie to find another site. The picttoppm that came with earlier pbm releases was broken and will produce a boring black rectangle with my example program).
In addition, Quickdraw has a simple programmatic interface. It is very easy to create complex drawings. It is well described in Apple's Inside Macintosh books, and many third party books as well.
There are a few limitations, including the fact that I never got around to writing the powerful region-manipulation calls. Maybe in the next release.
require "qd.pl"
1> test_qd.pl | picttoppm | ppmtogif -transparent white > test.gif
2> test_qd.pl | BinHex -t PICT -c JVWR -n 'Test Picture'| mail `whoami`
This is a little C filter that takes a UNIX file and encodes it into the Macintosh BinHex format, suitable for transmission via e-mail, ftp, or the World Wide Web. The nice thing about this format is that it allows you to specify the Macintosh file name, file type and creator. The nice thing about this program is that, unlike other utilities that do similar things, it works on STDIN as well as on files, and is therefore suitable for use in a UNIX pipe.
Instructions for compiling and installing it are in the tar'red source code.
Lincoln Stein, lstein@genome.wi.mit.eduWhitehead Institute/MIT Center for Genome Research
This document last modified November 11, 1994