I have a bezier path that comes into my program having been created from an SVG and the problem is it is just an outline. I need to perform hit detection on it, anywhere on the interior of the shape. Is there an equivalent of CGPathCreateCopyByStrokingPath
for filling it?
CGContextFillPath将在绘制上下文时填充上下文中的路径。
CGPathCreateCopyByStrokingPath
takes a path and returns a new path describing the outline of the shape that would be formed when stroking that path. It returns a CGPathRef
. So if you can perform hit detection on the results of that, then you can perform them directly on your original path. You don't need a conversion.
Supposing I've misunderstood the question, you can use CGPathContainsPoint
to test whether a point is inside a path. Use that directly on what you get from your SVG.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.