Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!garnet.berkeley.edu!deadman From: deadman@garnet.berkeley.edu (Ben Haller) Newsgroups: comp.sys.mac.programmer Subject: Re: DragGrayRgn() procedure problem with color. Message-ID: <1991May4.232051.13698@agate.berkeley.edu> Date: 4 May 91 23:20:51 GMT References: <1CE00001.ei5m1b@tbomb.ice.com> Sender: root@agate.berkeley.edu (Charlie Root) Organization: Stick Software Lines: 36 I wonder if anyone notices when I have my "readnews day" from the fact that there are maybe ten posts in a (approximate) row on each of the groups I read... :-> In article <1CE00001.ei5m1b@tbomb.ice.com> time@ice.com writes: > I have a program which allows you to drag objects from one >window to another. The program uses the DragGrayRgn() procedure > Now, with color I am using the global gHiliteMode bit to indicate >that the "inversion" should use the current "hilite color". This is > HOWEVER, when I am dragging the gray region around, and I pass over >one object that is highlighted to the next one, so that the highlighted >targets *change* *UNDERNEATH* the dragged gray rgn, then I get all >these little lines left all over the place. It appears that the inversion >has changed the context underneath the region and when it is XOR-ed >during the dragging it doesn't do what it is supposed to. > >Anyone know the secret? Well, since you mention "the Finder does this perfectly" I have to wonder exactly what you're talking about. It looks to me like, as far as DragGrayRgn is concerned, the Finder completely ignores the current highlight color. And well it should, it would have the same problem you're having if it tried. The problem is that the DragGrayRgn routine depends on xor working like xor, not like some bizarre half-breed created by setting the hilite bit and thereby driving QuickDraw out of its poor little mind. The operation must be reversible, i.e. a xor b xor b must equal a. When you set the hilite bit you mess this up, since you've told QuickDraw to perform a non-reversible operation. So you get garbage on your screen. No surprise. This isn't what the hilite color is supposed to be used for anyway. So don't...you know, just *don't*. -Ben Haller (deadman@garnet.berkeley.edu) "Jane says / She's never been in love She don't know what it is / Only knows if someone wants her..." - Jane's Addiction