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

FWD>to forward...



    Date: 24 Aug 90 11:49:29 U
    From: Bill_Park@qm.sri.com (Bill Park)

	Does anyone know how to print multiple-page graphic output to a
    Symbolics hardcopy stream?
       I have noticed that the dynamic window function:
    DW:FORMAT-GRAPH-FROM-ROOT
    does this correctly if you specify a hardcopy stream as the output
    stream (and it even uses  postscript commands).  

     On the other hand the graphic primitives such as GRAPHICS:DRAW-LINE
    etc will truncate and print only a single page.

It's non-trivial.

For normal stream output the condition
HARDCOPY:HARDCOPY-OUTSIDE-OF-BOUNDING-BOX is signalled when you reach a
border.  You can CONDITION-BIND this to
HCI::SIMPLE-FORMATTER-EXCEPTION-INTERCEPTOR, which wraps lines and
ejects pages (HARDCOPY:HARDCOPY-FILE and HARDCOPY:HARDCOPY-FROM-STREAM
do this automatically).

But for graphics it appears to be pretty complex.  The graph and table
formatting routines do two passes through the output.  The first pass
simulates the output in order to figure out the total size.  On the
second pass the actual output is performed.  When the output is to a
printer the coordinate system is inverted by using
DW::WITH-HARDCOPY-UPSIDE-DOWN-STREAM, and the stream is sent a
:WITH-PAGES-FOR-BOX message.  This takes a continuation that actually
does the output and the size of the image it will be drawing (this was
determined during the first pass).

The interesting thing is how :WITH-PAGES-FOR-BOX is implemented for
Postscript printers.  The entire image is first sent to the printer as
the definition of a Postscript function.  Then, for each page, it sends
commands to specify the viewport location and then invoke the function.
In other words, it sends to the printer the Postscript equivalent of

(flet ((draw-image () ...))
  (set-viewport 0 0 page-width page-height)
  (draw-image)
  (set-viewport page-width 0 page-width page-height)
  (draw-image)
  (set-viewport (* page-width 2) 0 page-width page-height)
  (draw-image)
  ...
  (set-viewport 0 page-height page-width page-height)
  (draw-image)
  ...)

I think it's a pretty clever way to take advantage of the power of
Postscript.

                                                barmar