Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!husc6!unix!stores From: stores@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac.programmer Subject: Re: Storing an icon as a region (or is it worth it) Keywords: Handle, RgnHandle, etc. Message-ID: <1868@unix.SRI.COM> Date: 1 Aug 89 15:51:37 GMT References: <9043@thorin.cs.unc.edu> Reply-To: stores@unix.UUCP (Matt Mora) Organization: SRI International, Menlo Park, CA Lines: 39 In article <9043@thorin.cs.unc.edu> markham@phi.cs.unc.edu (Andrew Markham) writes: >I would like to take an ICON resource, read it in and somehow store it as >a Region so that I can take advantage of the "Quickness" of regions in >comparison to icons. Basically I do the following: >/* this to get it initially */ >GetIcon(theIcon,iconID); >iconRgn:= NewRgn; >OpenRgn; >SetRect(theRect,left,top,right,bottom); >PlotIcon(theRect,theIcon); /* does this work? it didn't for me */ >CloseRgn(iconRgn); I quote from IM "While a region is open, all calls to Line, LineTo, and the procedures that draw framed shapes (except arcs) affect the outline of the region. Only the line endpoints and shape boundaries affect the region definition; the pen mode, pattern, and size do not affect it." The call to PlotIcon will not be recorded in the rgn. Apple has some code called "bitmaptoRgn" that will do what you want. I'm not to sure of the name, and I think you have to license the code from Apple. -- ___________________________________________________________ Matthew Mora SRI International stores@unix.sri.com ___________________________________________________________