Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!iuvax!rutgers!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: color "xor" Message-ID: <318@internal.Apple.COM> Date: 15 Dec 88 03:01:23 GMT References: <4XdeYOy00UgCNdM4Bj@andrew.cmu.edu> Organization: Advanced Technology Group, Apple Computer Lines: 24 In article <4XdeYOy00UgCNdM4Bj@andrew.cmu.edu> kw1r+@andrew.cmu.edu (Kevin Whitley) writes: >1) If the same obect is drawn twice (with the same foreground & background >colors) in xor, the screen should remain unchanged. >2) Drawing in xor against pixels in the background color should give the >foreground color. (Drawing against colors of any other pixel can be undefined). You can achieve (2) by using HiliteMode (p 61 of Inside Mac volume 5). You can pass hiliteMode instead of patXOR as your drawing mode. The black bits in the source determine which bits in the destination are affected (as in XOR mode). Those bits that are in the current background color are made to be the current highlight color. If you wanted to do this to a rectangular area, for example, you would set the PenMode to hiliteMode, the PenPat to black, and use PaintRect. To reverse the operation, you have to set up the highlight and background colors appropriately. (This is not like XOR where 2 successive calls undo each other.) In that sense, it doesn't directly satisfy (1), but it can be made to do so. -- Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr