[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pen-pattern for CWindowRecord
- To: firstname.lastname@example.org
- Subject: pen-pattern for CWindowRecord
- From: email@example.com
- Date: Tue, 15 Sep 92 14:31:49 EDT
I have a macro called with-pen-pattern which temporarily sets a new
pattern. It works fine for WindowRecords but not for CWindowRecords.
That's because the function pen-pattern assumes a WindowRecord. I
tried to modify the definition to work with CWindowRecords, without
much luck. It looks to me like the pattern for CWindowRecords of type
0 (old-style patterns) should be stored in the :pixpat.pat1data field.
However, the contents of this field appear to be random. What's wrong?
(defmacro with-pen-pattern (view pattern &body body)
`(let* ((port (wptr ,view))
(old-pattern (pen-pattern ,view)))
(unwind-protect (progn ,@body)
(defmethod pen-pattern ((view simple-view) &optional
(save-pat (make-record (:pattern :storage :pointer))))
(let ((wptr (wptr view)))
(if (window-color-p (view-window view))
;; why doesnt this work correctly for color windows?
(let ((pixpat (rref wptr cwindowrecord.port.pnpixpat)))
(if (zerop (href pixpat :pixpat.pattype))
(pref pixpat :pixpat.pat1data)
(error "Can't get pen pattern for this window")))
(pref wptr windowRecord.pnPat))
(:pattern :storage :pointer)