Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!decwrl!claris!outpost.UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: hilite color Message-ID: <0B010004.e7vt1w@outpost.UUCP> Date: 12 Feb 91 16:52:26 GMT Reply-To: peirce@outpost.UUCP Organization: Peirce Software Lines: 50 X-Mailer: uAccess - Mac Release: 1.0.3 In article <1991Feb12.014247.7709@verity.com>, anders@verity.com (Anders Wallgren) writes: > > In article <1991Feb11.200302.424@ux1.cso.uiuc.edu>, rolf@sparc1 (Rolf Wilson) writes: > > Question 1: How do you hilite something in the user-selected > > hilite color? I don't mean text. InvertRect always? > > uses black. > > Question 2: Is there a way of doing the above while still > > using the "old" color model? > >-- > > > In pascal, call: > > BitClr(Ptr(HiliteMode, pHiliteBit)); > > before calls to InvertRect, InvertRgn, etc. This is compatible with > all versions of QuickDraw and doesn't what the bit-depth of the > monitor is. This is documented in the Color QuickDraw chapter in IM > V, I think. Another useful variation is to draw in the hilite color. It's stored as an RGBColor in low memory. For example, Public Folder draws its progress bar using the hilite color. CONST kHiLiteColor = $0DA0; IF colorOK THEN BEGIN BlockMove(Ptr(kHiLiteColor),@hiLiteColor,SIZEOF(RGBColor)); RGBForeColor(hiLiteColor); PaintRect(theRect); ForeColor(blackColor); END ELSE BEGIN FillRect(theRect,dkGreyPattern); END; The only thing to remember here is that you need to have a color window to work with (unlike the BitClr technique that will work in non-color windows). -- michael -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE -- Ask me about AppSizer (and ask Claris about Public Folder :-)