获取UIBezierPath中风的轮廓路径
问题描述:
我有一个UIBezierPath
中风,现在我想要得到的笔划的轮廓路径(未描边的路径本身),是有办法,我能得到什么?或者至少NSLog
的UIBezierPath
中风的轮廓路径?由于获取UIBezierPath中风的轮廓路径
答
您可以使用CGPathCreateCopyByStrokingPath
这一点。
UIBezierPath *path = ...;
CGFloat lineWidth = 10;
CGPathRef cgStrokedPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL,
lineWidth, kCGLineCapRound, kCGLineJoinRound, 0);
UIBezierPath *strokedPath = [UIBezierPath bezierPathWithCGPath:cgStrokedPath];
这正是我要找的!谢谢!! – jane
记得拨打'CGPathRelease(cgStrokedPath);'! – JimmyB