Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get UIBezierPath Stroke's Outline Path

I have a UIBezierPath stroke, now I want to get the stroke's outline path(not the stroke's path itself), is there a way I could get that? or at least NSLog the UIBezierPath stroke's outline path? Thanks

like image 238
jane Avatar asked Mar 10 '23 17:03

jane


1 Answers

You can use CGPathCreateCopyByStrokingPath for this.

UIBezierPath *path = ...;
CGFloat lineWidth = 10;
CGPathRef cgStrokedPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL,
    lineWidth, kCGLineCapRound, kCGLineJoinRound, 0);
UIBezierPath *strokedPath = [UIBezierPath bezierPathWithCGPath:cgStrokedPath];
like image 62
rob mayoff Avatar answered Mar 16 '23 07:03

rob mayoff