Unexpected LineJoinStyle behavior when lines in path at 180 degrees

醉酒当歌 提交于 2019-12-21 14:11:15

问题


I'm getting a clipped LineJoin in a UIBezierPath when one line comes back exactly over the previous line. If I adjust the second line by one pixel, the LineJoin behaves as expected. Here's the code:

UIBezierPath *path = [UIBezierPath bezierPath];
[path setLineWidth:10.0f];
[path setLineCapStyle:kCGLineCapRound];
[path setLineJoinStyle:kCGLineJoinRound];
[path moveToPoint:CGPointMake(100, 100)];
[path addLineToPoint:CGPointMake(200, 100)];
[path addLineToPoint:CGPointMake(150, 100)];
[path moveToPoint:CGPointMake(100, 120)];
[path addLineToPoint:CGPointMake(200, 120)];
[path addLineToPoint:CGPointMake(150, 121)];
[[UIColor redColor] setStroke];
[path stroke];

Here's what's displayed:

Is this a bug? If not, is there some way to get the top path LineJoin to be rounded? (without fudging the points)

This came up when I made a UIBezierPath from 'touch-input', and while scribbling around sometimes this happened.


回答1:


This is fixed in iOS 7. Open Radar also updated.



来源:https://stackoverflow.com/questions/13425765/unexpected-linejoinstyle-behavior-when-lines-in-path-at-180-degrees

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!