Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cbmvax!vu-vlsi!swatsun!jackiw
From: jackiw@cs.swarthmore.edu (Nick Jackiw)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Bitmap --> region code needed
Message-ID: <3139@carthage.cs.swarthmore.edu>
Date: 28 Sep 89 15:09:33 GMT
References: <8909261258.AA01237@cscwam.UMD.EDU>
Reply-To: jackiw@carthage (Nick Jackiw)
Distribution: usa
Organization: Visual Geometry Project, Swarthmore College, PA
Lines: 39

In article <8909261258.AA01237@cscwam.UMD.EDU> rick@wam.UMD.EDU writes:
> I hope someone can point me in the right direction.  I'm looking for code
> (C, asm, or Pascal) that will convert a bitmap into a region (ie black pixels
> included in region or vice versa for white pixels).
> Public domain source would be nice but commercial source will also do.

Apple licenses a subroutine called _BitmapRgn, of the form:

FUNCTION BitMapRgn(region:RgnHandle; bMap:BitMap):OSErr;

"The region will be built so that all one bits in bMap are inside the region
and all zero bits are outside of it." - Technote #193

The subroutine is available in the 32-bit Quickdraw init (I dunno the trap
number, but the MacDTS would); or separately, from:

	Apple Software Licensing / Apple Computer, Inc.
	20525 Mariani Ave MS 38-I / Cupertino, CA 95014

Also take a look at CalcMask and CopyMask, described in Inside Mac #IV. You
may be able to accomplish your desired effect without ever needing to go to
the region stage.

-Nick


> I need to use a bitmap to mask a region while
> drawing in much the same way that X uses bitmaps as clipping regions while
> drawing.  Any help would be greatly appreciated. I think I may have seen some
> discussion on this topic a while back in this newsgroup.  Thanx.
> 
> 	rick@wam.umd.edu


-- 
     _  _|\____    Nick Jackiw | Visual Geometry Project | Math Department
   / /_/   O>  \   ------------+-------------------------+ Swarthmore College
   |       O>   |  215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081
    \_Guernica_/   ------------+-------------------------+                 USA