[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Usiing Off-screen drawing with trap calls
- To: stimpy@media.mit.edu
- Subject: Re: Usiing Off-screen drawing with trap calls
- From: "Mark A. Tapia" <markt@dgp.toronto.edu>
- Date: Mon, 18 Jul 1994 20:25:55 -0400
- Cc: info-mcl@cambridge.apple.com
On Mon Jul 18, Doug Soo writes:
I am currently working on trying to use off screen drawing in MCL usin
g
offscreen graphics worlds, e.g. NewGWorld and related traps. I was wo
ndering
if you had any sample code that I could see implementing this. Any he
lp is
much appreciated.
Here's an example of a macro (executed within the ccl: package) that saves
and restores a gworld:
(defmacro with-saved-gworld (&rest body)
;; Saves the gworld, executes the body of the code and then restores the
gworld
;; upon termination (normal or abnormal)
(let ((saved-port (gensym))
(saved-device (gensym)))
`(with-macptrs (,saved-port ,saved-device) ; from Bill StClair at
Apple
(ccl::get-gworld ,saved-port ,saved-device)
(flet ((restore-gworld ()
(ccl::set-gworld ,saved-port ,saved-device)))
(unwind-protect
(progn ,@body
(restore-gworld))
(restore-gworld) ; from Bill StClair at Apple
)))))
For a complete example that uses an existing gworld (namely the printer,
see the print-u.lisp.hqx code in the contrib directly in the pub/MCL2/contrib
directory available by anonymous ftp from cambridge.apple.com. The code
in menu-enhancements.sit.hqx in the oou-utils.lisp file also contains
an example of saving and restoring a portion of the main screen.
mark