home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!bcm!lib!bmb8
- From: cshotton@oac.hsc.uth.tmc.edu (Chuck Shotton)
- Newsgroups: comp.sys.mac.programmer
- Subject: Blitting PixMaps with a mask
- Message-ID: <cshotton-130892083933@bmb8.med.uth.tmc.edu>
- Date: 13 Aug 1992 13:54:02 GMT
- Sender: usenet@lib.tmc.edu
- Followup-To: comp.sys.mac.programmer
- Organization: UTHSCH Academic Computing
- Lines: 32
- Nntp-Posting-Host: bmb8.med.uth.tmc.edu
-
- I need some info on whether or not the following is possible using any
- existing toolbox calls (e.g. CopyMask, CopyDeepMask, CalcMask, etc.)
-
- I have a color image on a white background, residing happily in a gworld.
- I'd like to blit that image (without the white background) over another
- complex background. I KNOW I can do this with no problem if I use a region
- that matches the outline of the color image and CopyBits.
-
- I'd like to use the color image itself as the source for calculating a mask
- or region *quickly* (i.e. using CopyMask or BitMapToRgn). However, it
- appears that BitMapToRgn only only calculates regions for 1 bit deep
- pixmaps. If I move the color image to a 1 bit gworld, I end up with a swiss
- cheese region or mask, since the lighter colors turn white.
-
- CopyDeepMask comes closest to working, using the color image for both the
- source and mask and using srcCopy. (BTW, it seems that CopyDeepMask WON'T
- work if the source and mask are exactly the same PixMap. Is this right?).
- However, since the mask (i.e. the original color image) isn't all black,
- various amounts of the background image bleed through.
-
- I'd like to avoid the painful task of building custom regions, since the
- source data is fairly dynamic. Is there a way to do this copy easily that
- I've overlooked? It looks like a combination of CalcCMask with a matchProc
- and CopyMask would work. If the matchProc just returned a 1 for every
- non-white pixel, things would work fine. However, I can't find any
- documentation on how to write a matchProc or what the args are in IM V or
- VI.
-
- Thanks,
- Chuck
-
- p.s. In the meantime, I'm off to wade through Principia Offscreen again.
-