home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!pagesat!spssig.spss.com!uchinews!dent.uchicago.edu!greg
- From: greg@dent.uchicago.edu (Greg Kuperberg)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Looking at a bit in a bitmap truly bytes. Help!
- Message-ID: <1992Dec23.155102.4442@midway.uchicago.edu>
- Date: 23 Dec 92 15:51:02 GMT
- References: <1992Dec22.004631.14531@midway.uchicago.edu> <1992Dec22.205409.28125@kth.se>
- Sender: news@uchinews.uchicago.edu (News System)
- Organization: Dept. of Mathematics, U. of Chicago
- Lines: 41
-
- In article <1992Dec22.205409.28125@kth.se> d88-jwa@hemul.nada.kth.se (Jon Wtte) writes:
- >What's non-oo about chasing down the mask? Don't you store objects
- >of icons in a decent data structure, check which one was clicked
- >and call the GetMask method of it?
-
- You shouldn't be surprised that I store the icon with a CIconHandle.
- It's a good thing it's a cicn and not an ICON, because then it would
- just be a Handle and I'd have no idea where the mask is.
-
- By the way, I was pleasantly surprised that if you have cicn's,
- there is no need to have a duplicate lists of ICON's.
-
- >Or even better, have the Icon object know how to check its own mask.
-
- The point is not that I'd like to have my own nifty objects that
- obediently inspect themselves. When it's important to wrap some
- variables in an object I'll do it.
-
- Rather, I'd like to respect the Toolbox's informal notion of objects.
- I know when I change my data structures. I don't know when Apple is
- going to change theirs.
-
- >What I would do is open a new port, SetPortBits to
- >a known scratch space one longword long, and move
- >the origin and clip so that you know what's going on,
- >and draw the icon MASK into that port, then DisposePort
- >the port.
-
- Here are some suggests that have variously come from
- you, me, Jamie McCarthy, and Matthew Russotto:
-
- 1) Grab the baseAddr and read the raw bytes.
- 2) SetPortBits to the mask and use GetPixel.
- 3) SetPortBits to the mask and do a teeny weeny CopyBits to scratch space.
- 4) SetPortBits to scratch and do a teeny weeny CopyBits from the mask.
- 5) Use BitMapToRgn if it exists and then use PtInRgn.
-
- What I ended up doing was writing a routine that does 1) and I called
- it PtInBitMap. If the folks at Apple are reading this they should
- try to throw such a routine into the Toolbox at some point. I don't
- understand how Quickdraw could have PtInRect but not PtInBitMap.
-