Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!elroy.jpl.nasa.gov!cit-vax!bek-mc!rasnow From: rasnow@bek-mc.caltech.edu (Brian Rasnow) Newsgroups: comp.sys.mac.hypercard Subject: PointInRegion xftn problems... Message-ID: <11296@cit-vax.Caltech.Edu> Date: 18 Jul 89 01:27:19 GMT Sender: news@cit-vax.Caltech.Edu Reply-To: rasnow@bek-mc.caltech.edu (Brian Rasnow) Organization: California Institute of Technology Lines: 32 I am trying to implement the equivalent of the quickdraw PtInRgn fucntion as a LSC xfcn. The point and region coordinates are strings passed from hypercard. I want to create a quickdraw (qd) region, and call the qd function PtInRgn() for the answer (I am not interested in any drawing, etc.). The code below kills hypercard on OpenRgn(). If I save the current port, SetPort to a new window, do the region stuff, and restore the port, I can get thru the xftn - but hypercard dies the next time it tries drawing (eg. go next card). Any suggestions are appreciated. ptH = paramPtr->params[0]; rgnH = paramPtr->params[1]; sscanf( *ptH, "%d,%d", &(pt.h), &(pt.v) ); str = *rgnH; sscanf( str, "%d,%d", &firstx, &firsty ); str = stpchr( strp, '\n' ); qdrgn = NewRgn(); OpenRgn(); MoveTo(firstx, firsty); while(str != NULL) { sscanf(++str, "%d,%d", &x, &y ); str = stpchr( strp, '\n' ); LineTo(x,y); } LineTo(firstx, firsty); CloseRgn(qdrgn); answer = PtInRgn(pt, qdrgn); Thanks. rasnow@caltech.edu (Brian Rasnow)