rasnow@bek-mc.caltech.edu (Brian Rasnow) (07/18/89)
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)