[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: email@example.com (Tom McDougal)
- Subject: Re: hilighting
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Tue, 2 Mar 1993 09:15:42 -0600
- Cc: info-mcl
>I'm trying to figure out how to hilight an object using the hilite
>mode described in IM V, 61-62. It says:
>"There are two ways to use hilite mode. The easiest is to call
> BitClr (Ptr(HiliteMode,pHiliteBit))
>just before calling InvertRect..."
>On the next page it says:
>"The constants used with hilite mode are listed below:
> hilite = 50;
> pHiliteBit = 0;"
>Well, I couldn't figure this out, so I searched files for "hilite" and
>found this example, in MCL:library:Inspector
>; Invert a region using the highlight color (see Inside Mac V-62).
>(defun %invert-region (rgn)
> (with-macptrs ((hiliteMode (%int-to-ptr #x938)))
> (%put-byte hiliteMode (logand #x7f (%get-byte hiliteMode))))
> (#_InvertRgn :ptr rgn))
>The connection between this code and what IM-V says could use some
Pascal's BitClr procedure numbers bits from the most significant.
Hence the Pascal "pHiliteBit" has a value of 0, whereas the
assembly language "hiliteBit" has a value of 7. I don't know where
"hilite=50" came from. This equate is not in any of my interface files.
I assume it's a manual bug.
The MCL code would probably be clearer if it were written as:
(defun %invert-region (rgn)
(with-macptrs ((hiliteMode (%int-to-ptr #$HiliteMode)))
(logand (lognot (ash 1 #$hiliteBit)) (%get-byte hiliteMode))))
(#_InvertRgn :ptr rgn))