[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Data bits across LGP2 stream

    Date: Thu, 29 Mar 90 10:03 PST
    From: Charest@ai-sun.jpl.nasa.gov (Len Charest)

    I have  some software that will produce a hardcopy of an 8-bit color screen on the Symbolics.
    The LISP code involved simply sends each byte of data (==ONE screen pixel) as TWO hex digits
    to the LaserWriter to be interpreted by PostScript. Therefore, a screenful of data which is ~1 MB 
    on the Symbolics side has expanded to ~2 MB on the PostScript side. If I can send a full byte to
    the LaserWriter I can cut the size of the PostScript data in half.

Ah, you have now discovered one of the big screws of postscript.  Since
postscript is a text programming language, there is no way to efficiently
transmit compact binary data in it.  Instead, all binary data has to be
unpacked into a text representation in order to send it to the printer.

    Question: how many data bits does an LGP2 stream transmit to the LaserWriter? 
    That is, is the stream strictly 7-bit ASCII or 8-bit "extended" ASCII. The actual stream I am 
    using is an instance of LGP::LGP2-BITMAP-STREAM, created with hci:make-hardcopy-stream.

The character set accepted by the laster writer isn't even the complete ascii
character set.  It's only the printed subset of the ascii character set.  For
example, you can't include any control characters in strings in postscript.

Furthermore, the laserwriter does special things, defined outside the
postscript language, when it sees some control characters.  For example, as
soon as you send a conreol-D to the laserwriter, it will abort its current
postscript job and reset itself to start a new postscript job.

    On a related note, if the stream is a full 8-bits then what is the appropriate
    function to send a single byte of data to the LaserWriter? Better yet, how can
    I send a "string" of bytes (i.e., NOT a LISP string but a contiguous set of bytes)
    to the LaserWriter. I am aware that LGP2 streams support the :string-out message,
    but the method there just sends the :tyo message for each char in the string, which
    in turn becomes a :show-char message and so on--not efficient nor appropriate.

You might be able to do better than 4 bits and get 6-bit data to the
laserwriter if you wrote a lisp program to pack your data into 6-bit data, and
then wrote an postscript unpacking program to unpack the data on the
laserwriter, but it's a lot of work.

Some people have worked on programs to do compression of bitmap data to reduce
the amount of data transmitted.  What is involved here is writing a lisp
program for to do the compression and a postscript program for decompressing
it.  The success of such a strategy depends a lot on how complicated the image
you are sending and the baud rate you are sending data to the laserwriter.  As
the image gets more complicated, you can't do as much compression, and as the
baud rate of the serial line goes up, the postscript program to decompress
starts running slower than it takes to just send the data.

Anyway, to do any of this you'll have to learn how to write efficient
bit-packing postscript programs, so it's not a trivial task.