Gr2PICT

/**
 * Gr2PICT, a Graphics subclass that draws to PICT format.
 * @version 1.0
 * @author Don Gilbert
 * @mailto: software@bio.indiana.edu
 */
PICT is a compact, widely used file format for drawings. It is mainly vector based (e.g., like Postscript), but image pixelmaps can be included. Software to edit PICT drawings is widely available, and it is a very compact format, unlike Postscript. PICT is ubiquitous on Macintoshes and commonly available to MSWindows software.

The Gr2PICT class saves Java drawings to a PICT format output stream. It extends the java.awt.Graphics class. It works for any Component and its subcomponents.



Gr2PICT is derived from the Postscript writer PSgr by E.J. Friedman-Hill.

The current release of Gr2PICT lacks the ability to save pixel maps (images) into the PICT output stream. I just ran out of time -- the coding to convert pixels into the PICT format takes a bit of time to write. Hopefully I'll find time in the coming months, or I welcome anyone else's contribution of this code.

The recommended use of this is in applications, since the data is usable only after stored to a local file. Applet use is problematic, since the applet needs to send data to server and server needs to echo it back to be saved by browser, and current browsers had various problems with this. The sample code driver (Gr2PICTlet.java) will compile and run either as an applet or application.

Java source files

gr2pictlet.java
gr2pict.java
savepict.java
quickdraw.java

The .class archive: Gr2PICT.zip

A server echo script for applet use:
echopict.pl

See also by ftp at ftp://iubio.bio.indiana.edu/molbio/java/apps/gr2pict/