dredge@hitchrack.STANFORD.EDU (Michael Eldredge) (01/07/88)
PLOTCAP graphics library is available from Stanford. I have written a plotting package that has been in use here at Stanford for several years. It is called PLOTCAP. It was originally developed to work with the IC Simulators that we write in the IC Lab. It is a general purpose 2D plotting package including a couple of libraries, a plotting program that has seen much more use than I ever dreamed it would and a plot device description data base (plotcap). The motivation for its development was: 1. As new devices are added to the system, no program should have to be recompiled - all programs should just work with the new device. 2. The interface should be very simple allowing plots to look (more or less) the same on whatever the device. The programmer need not know the capabilities of the particular device, just its name. The library is called "gplot2". It is a library that gives a simple 2d interface for plotting (move,draw,clear,area file, line type, scale, rotate, translate, clip, etc..). The functions that cannot be done in hardware (e.g. line types) are handled by the library. The library is fully implemented in C. There is a Fortran cover library that calls the C code. Although the code was developed on Unix, it is not Unix specific. It has in fact been successfully ported to several other operating systems. There is also a higher level 2D library to draw axes, text, etc. It is "device independent". The device drivers are loaded on the fly from the device description data base PLOTCAP, a (somewhat) termcap like data base. The drivers, however, are not interpreted but are "compiled" and run (by an internal finite state machine - it doesn't actually load sun or vax code). Since drivers are loaded on the fly, programs don't have to be reloaded/relinked (as required with other "di graphics" packages) when a new driver is added - just put it in the central plotcap file and all programs will then be able to plot to the new device. Some of the drivers currently included are: tek 4100, hp terminals, Imagen laser printers, Apple LaserWriter (PostScript), sunview, X-windows, ditroff (yes, ditroff), LaTex, Printronix dot matrix printer, DEC vt240 The ditroff entry is kinda fun -- Simulation programs plot data as they run - usually to the terminal/workstation. But when someone is writing a paper, they just change the output device to 'ditroff' and in the paper include a ".so fig1.tr" (or whatever). Writing an entry for a new device is pretty simple. You specify device parameters, for example: raster or vector draws, number of pixels in X and Y, pixels per unit in X and Y, init and end sequences. The PLOTCAP language lets you write code to manipulate output data, say for example, a coordinate must be output as two bytes (one with the upper 5 bits of data, the other with the lower) and the 6th bit must be set. You want to say: "Take bits 9-5 of X, or with 040 (octal) then output it as a byte, etc..." In PLOTCAP: %B = X[9-5] | 040; %B = X[4-0] | 040; Plotcap is a (simple) programming language and so has more power than graphcap /termcap like methods (it can even do cursor-location input). There is a program - "dplot" which is a general "give me your data and a little information and I'll get you a nice plot" program. The code is available for a small licensing fee (I don't know how much) from Stanford through: Lori Fuller Office of Technology Licensing Stanford University 350 Cambridge Av. Suite 250 Palo Alto, CA 94306 (415) 723-0651 Michael Eldredge (Stanford Integrated Circuits Lab)