Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!claris!UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: Rgns from icons Message-ID: <0B01FFFB.gnw2y0@outpost.UUCP> Date: 27 May 91 23:51:53 GMT Reply-To: peirce@outpost.UUCP (Michael Peirce) Organization: Peirce Software Lines: 27 X-Mailer: uAccess - Mac Release: 1.1.b3 In article <1991May27.132246.17040@murdoch.acc.Virginia.EDU>, heddle@clas01.cebaf.gov (David Heddle) writes: > Dear friends: > > Does anyone have code for generating a rgn from an icon (bw and color). > I guess one uses the icon mask, but I don't know how to convert a > bit map into a region. Presumably this is also how the lasso works > in a bit map painting program. The following is a code fragment from some of my own code. It uses BitMapToRegion to convert the mask of a CICN into a region. You used to have to license this routine for some reason, but I *think* it's built into System 7. oldSpotRgn := NewRgn; FailNIL(oldSpotRgn); HLock(Handle(fCICN)); WITH fCICN^^ DO BEGIN iconBMap.baseAddr := @iconMaskData; FailOSErr(BitMapToRegionhccc(oldSpotRgn,iconBMap)); -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE