[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
some help for CopyBitzers
- To: info-mcl@cambridge.apple.com
- Subject: some help for CopyBitzers
- From: engber@aristotle.ils.nwu.edu (Mike Engber)
- Date: Mon, 17 Feb 92 19:06:38 CST
In response to the recent flurry of CopyBits q's, here's a couple
defn's which should clean your code up a bit:
(defmacro with-wptr-XMapPtr ((wptr PixMap-or-BitMap-Ptr) &body body)
(let ((fn (gensym)))
`(flet ((,fn (,PixMap-or-BitMap-Ptr) ,@body))
(declare (dynamic-extent #',fn))
(call-with-wptr-XMapPtr #',fn ,wptr ))))
(defun call-with-wptr-XMapPtr (fn wptr)
(if (wptr-color-p wptr)
(ccl::with-macptrs ((pixMap_h (pref wptr :CGrafPort.portPixMap)))
(with-dereferenced-handles ((pixMap_p pixMap_h))
(funcall fn pixMap_p)))
(ccl::with-macptrs ((bitMap_p (pref wptr :GrafPort.portBits)))
(funcall fn bitMap_p))))
The with- macro executes body with the symbol you pass in for
PixMap-or-BitMap-Ptr bound to either a BitMapPtr or a PixMapPtr This is
what CopyBits & related calls want. These macros should handle all
your worries about whether you're in a color window or not.
-ME