以特定角度连接的线具有尖顶点而不是圆角 [英] Joined lines at certain angles have pointed vertexes instead of rounded

查看:160
本文介绍了以特定角度连接的线具有尖顶点而不是圆角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式可让您使用各种工具绘图。其中一个让你做一个角度:你敲三次,然后为你绘制一个角度。不幸的是,它变得非常尖锐,但随后在某些角度再次圆角出于某种原因。我正在使用

My app allows you to draw using a variety of tools. One of them lets you make an angle: you tap three times, then an angle is drawn for you. Unfortunately, it gets really pointy but then rounded again at certain angles for some reason. I'm using

CGContextSetLineCap(context, kCGLineCapRound);

这里是一张图片来说明我在说什么:

Here is a picture to exemplify what I'm talking about:

大多数情况下,我所做的是:

For the most part, all I do is:

CGContextMoveToPoint(context, first.x, first.y);
CGContextAddLineToPoint(context, second.x, second.y);
CGContextAddLineToPoint(context, third.x, third.y);

然后笔画。

推荐答案



That's controlled by your line join style, not your line cap style.

CGContextSetLineJoin(context, kCGLineJoinRound);

默认线连接样式是斜角,看起来像是你击中斜角限制是为什么它在某个角度变圆。 (请参见 CGContextSetMiterLimit )。

The default line join style is miter, and it looks like you're hitting the miter limit, which is why it becomes round at some angle. (See CGContextSetMiterLimit).

这篇关于以特定角度连接的线具有尖顶点而不是圆角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆