石英 2D 笔画对齐

发布于 2024-08-23 22:22:32 字数 269 浏览 3 评论 0原文

使用 kCGPathFillStroke 作为绘图模式时,是否可以调整笔画的默认居中对齐方式?

例如,当使用以下方法绘制闭合路径时:

CGContextDrawPath(context, kCGPathFillStroke);

笔划位于绘制路径外部 50%/内部 50%。描边颜色具有不透明的 Alpha,因此最终效果并不理想。我希望中风位于内侧或外侧。

我认为执行此操作的唯一可能方法是重建路径,收缩 50% 的笔画宽度。

Is it possible to adjust the alignment, from the default centered, of a stroke when using kCGPathFillStroke as the drawing mode?

For example, when drawing a closed path using:

CGContextDrawPath(context, kCGPathFillStroke);

The stroke lies 50% outside/50% inside the drawn path. The stroke color has a non-opaque alpha so the net effect is undesirable. I want the stroke to lie either all inside or outside.

The only potential way I see of doing this is to rebuild the path, contracted by 50% of the stroke width.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坠似风落 2024-08-30 22:22:33

你的猜测是正确的。调整路径的位置。

Your guess is correct. Adjust the path's position.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文