| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |
Arguments: object printer-stream &key left top
Prints object on printer-stream at left, top from printer-physical-offset of the printer.
Currently the controls implement methods for this generic function, so that they may be drawn in high resolution at an arbitrary position in printed output. Other windows or widgets could be copied directly from the screen to a printer stream by calling copy-stream-area (or get-pixmap followed by copy-to-stream), but that would simply copy the screen pixels rather than redrawing the object at the typically higher resolution of the printer. If an application implements a custom control (by defining a subclass of lisp-widget and supplying lisp code for drawing it and handling mouse clicks and so on), then a draw-on-printer method could be written for the control.
The following example will draw the Employee Grid example from the Navigator Dialog on a printer, using the printer's high resolution. First run the Employee Grid example and then evaluate the following form to print it.
(let* ((dialog (find-window :employee-chart)) grid) (unless dialog (error "Run the Employee Grid-Widget example first.")) (setq grid (find-component :employee-grid dialog)) ;; Open a printer stream at 100 stream units per inch, ;; which approximates the resolution of a computer screen, ;; and find the usable drawing area between the margins. (with-output-to-printer (out :units-per-inch 100) (let* ((left-margin (left-margin out)) (right-margin (right-margin out)) (top-margin (top-margin out)) (bottom-margin (bottom-margin out))) ;; Draw a horizontally centered title. (with-font (out (make-font-ex nil "Arial" 24)) (draw-string-in-box out "Employee Information" nil nil (make-box left-margin top-margin right-margin (+ top-margin 30)) :center :top)) ;; Draw the employee grid centered horizontally, and ;; a little below the title. (draw-on-printer grid out :left (+ left-margin (floor (- right-margin left-margin (width grid)) 2)) :top (+ top-margin 100)))))
Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |