Here is the source and documentation for printpic, a program to convert
pictures to postscript format and print them on a laser writer.

The program has been tested on a VAX 780 running berkeley 4.3 UNIX
feeding an Apple laser writer.  You will have to modify this program if
your "lpr" line printer spooler doesn't accept postscript.

For portability, the program does all picture input through a simple set of
interface routines.  The interface to this pic package is currently oriented
toward 4-channel (r,g,b,alpha), 8 bit per channel picture files, but could
easily be adapted to read from frame buffer memory or handle other picture
formats.  The current interface is:

    #include <pic.h>
	might look something like:
	    typedef struct {unsigned char r, g, b, a;} pic_pixel;
	    typedef struct { ... } pic;
	    pic *pic_open();

    pic *pic_open(file, mode)
    char *file, *mode;
	open a picture file with given mode and return pointer to a structure
	containing state information (like fopen)

    pic_read_size(p, xp, yp)
    pic *p; int *xp, *yp;
	return the size of picture p in *xp and *yp

    pic_read_line(p, y, buf)
    pic *p; int y; pic_pixel *buf;
	read scan line y of picture p into scan line buffer buf

    pic_close(p)
    pic *p;
	close picture p

You will have to write or find routines like this to get printpic working.
If your image channels are not 8 bits then change the definitions of PVBITS
and PVMAX.
If your random() routine doesn't return numbers in the range 0 to 2^31-1 then
you should change RANDOMRANGE2 and/or the call to random().

Paul Heckbert
PIXAR
P.O. Box 13719			UUCP: {sun,ucbvax}!pixar!ph
San Rafael, CA 94913		ARPA: ph%pixar.uucp@ucbvax.berkeley.edu
