In Mac OS X v10.4 and later, you can use the function CGPathContainsPoint to find out if a point is inside a closed path. A direct replacement for PtInRgn, this function is useful when you have a corresponding path for each shape being tested. Here’s the prototype:
bool CGPathContainsPoint (CGPathRef path, const CGAffineTransform *m, |
CGPoint point, bool eoFill); |
CGPathContainsPoint returns true if the point is inside the area that’s painted when the path is filled using the specified fill rule. You can also specify a transform that’s applied to the point before the test is performed. (Assuming the point is in local view coordinates and the path uses the same coordinate space, a transform is probably not needed.)
Last updated: 2006-09-05