home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20175 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.6 KB

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