Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!umn-d-ub!gandreas From: gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) Newsgroups: comp.sys.mac.programmer Subject: Re: Hilite Mode Error Message-ID: <783@umn-d-ub.D.UMN.EDU> Date: 27 Feb 89 15:59:16 GMT References: <4Y2CH4y00VE1MC7EUf@andrew.cmu.edu> Reply-To: gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) Organization: University of Minnesota, Duluth Lines: 59 In article <4Y2CH4y00VE1MC7EUf@andrew.cmu.edu> rj0z+@andrew.cmu.edu (Robert George Johnston, Jr.) writes: > > In Volume V of Inside Macintosh, on page 61, an explanation of how >to use the Hilite Mode follows: > > There are two ways to use the hilite mode. The easiest is to call >BitClr(Ptr(HiliteMode, pHiliteBit)); just before calling InvertRect, >InvertRgn, InvertArc, InvertRoundRct, or InvertPoly or any drawing using >srcXor mode. On a one-bit-deep destination, this will work exactly like >inversion, and is compatible with all versions of QuickDraw. > > Consider the following Pascal code: > begin > PenMode(srcXor); > BitClr(Ptr(HiliteMode, pHiliteBit)); > FrameRect(SomeRect); > end; > [ Works in ColorQuickDraw, not on a Plus or SE ] > Perhaps somebody should look into whether the book is wrong or the >implementation is wrong. > > Rob Johnston. The problem is in both places. From back in IM I we get: PROCEDURE PenMode (mode: INTEGER); PenMode sets the transfer mode through which the pnPat is transferred onto the bitMap when lines or shapes are drawn. The mode may be any one of the pattern transfer modes: patCopy patXor notPatCopy notPatXor patOr patBic notPatOr notPatBic If the mode is one of the source transfer modes (or negative), no drawing is performed. Also, IM V-60 says "On the Macintosh II the rules for setting the pen mode and the text mode have been relaxed slightly. It's no longer necessary to specify a pattern or a source mode (patCopy as opposed to srcCopy) to perform a particular operation. QuickDraw will choose the correct drawing mode automatically. However, to be compatible with earlier versions of QuickDraw, your application must specify the correct drawing mode. Text and bitmaps should always use a source mode; rectangles, regions, polygons, arcs, ovals, round rectangles, and lines should always use a pattern mode." So, what it says in IM V about "srcXor mode" is correct, since on a machine that uses the hilight mode, srcXor works exactly as patXor. But when you ran your example on a non CQD machine, it didn't work since srcXor does nothing for drawing on those machines. This demonstrates that once again, unless you know every line in IM I-V, you can get into trouble :-( =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = "Whether you like it, or don't like it, sit | - gandreas@ub.d.umn.edu - = = back and take a look at it, because it's the | Glenn Andreas = = best going today! WOOOOoooo!" - Ric Flair | = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=