Logan Shire
Logan Shire

Reputation: 5103

Bezier path by filling path?

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?

Upvotes: 1

Views: 218

Answers (2)

Tommy
Tommy

Reputation: 100632

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.

Upvotes: 0

Joe Million
Joe Million

Reputation: 147

CGContextFillPath will fill a path within a context when it is drawn.

Upvotes: 2

Related Questions