home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13940 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  2.0 KB

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