home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!pagesat!spssig.spss.com!uchinews!news
- From: greg@zaphod.uchicago.edu (Greg Kuperberg)
- Newsgroups: comp.sys.mac.programmer
- Subject: Looking at a bit in a bitmap truly bytes. Help!
- Message-ID: <1992Dec22.004631.14531@midway.uchicago.edu>
- Date: 22 Dec 92 00:46:31 GMT
- Sender: news@uchinews.uchicago.edu (News System)
- Organization: Dept. of Mathematics, U. of Chicago
- Lines: 22
-
- I have an icon and the user clicks the mouse and I'd like to know
- whether the mouse click actually landed in the icon. The obvious
- method (TM) is to look in the icon's mask and see if the mouse click is
- in there. What could be simpler? Famous last words.
-
- This idea puts me in the most ridiculous quandary as far as Politically
- Correct Toolbox Programming is concerned. I have to chase down the
- Icon's mask, already a moral violation of the Object-Oriented
- mentality, and then I have to either find a grafPort somewhere and set
- the grafPort's bits to the mask and finally use GetPixel, or I have to
- monkey with the raw bits of the mask packed into bytes. The first
- method is in practice a really kludgey way to try to stay PC, and maybe
- my code has a bug, but it doesn't seem to work. (Yes, I remember that
- data with a Handle can move.) The second method is un-PC
- maybe to the point of being architecture-dependent. Another possibility
- is to CopyBits a single bit.
-
- I think I can eventually find A Way to do this on my own, thank you.
- What I want to know is: What is the most Politically Correct,
- future-compatible way? A C code example would be helpful.
-
- Please send a copy of your response by mail, thanks.
-