[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clip-region interaction with princ
- To: Peter Szolovits <psz@mit.edu>, info-mcl@cambridge.apple.com
- Subject: Re: clip-region interaction with princ
- From: e@flavors.com (Doug Currie, Flavors Technology, Inc.)
- Date: Wed, 29 Dec 1993 12:38:05 -0500
>I need to clip text to a region (really a rect) in a window, but it seems that
>the standard princ function applied to a window does not obey the clip region.
There are MacTraps for this purpose;
look at #_DrawString #_DrawText and #_TextBox
Your example, modified:
(defclass foowin (window) ())
(defparameter w1 (make-instance 'foowin))
(defmethod view-draw-contents :after ((w foowin))
(with-region rgn
(clip-region w rgn)
(clip-rect w 100 100 150 150)
(paint-rect w 90 90 140 210)
(#_MoveTo 102 110)
; (princ "The quick brown fox did something?" w)
(with-pstrs ((s "The quick brown fox did something?"))
(#_DrawString s))
(set-clip-region w rgn))
)
For text longer than 255 characters, you will need to either break the
string up into pieces yourself, or use #_DrawText if you have a pointer to
the text:
(with-pstrs ((s "The quick brown fox did something?"))
(#_DrawText s 1 (%get-unsigned-byte s)))
e