C++在 Direct2D 设备中绘制圆弧
我需要在 D2D 设备中绘制圆弧,是否有函数可以执行此操作?(例如 DrawLine 或 DrawEllipse) 否则,我看到有 ArcSegment 函数返回 D2D1_ARC_SEGMENT 结构,我该如何绘制它?
I need to draw an arc in a D2D device, is there a function that does this?(something like DrawLine or DrawEllipse)
Otherwise, i've seen that there is the ArcSegment function that returns a D2D1_ARC_SEGMENT structure, how can i draw that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
填充路径几何图形 (
ID2D1PathGeometry
) 时可以使用D2D1_ARC_SEGMENT
。将所需的圆弧添加到路径后,您可以使用ID2D1RenderTarget::Draw/FillGeometry()
绘制它。The
D2D1_ARC_SEGMENT
can be used when populating a path geometry (ID2D1PathGeometry
). Once you've added the arc you want to the path, you can draw it usingID2D1RenderTarget::Draw/FillGeometry()
.我对 Direct2D 不太熟悉,所以我不知道任何特定的函数可以让你做到这一点,但是它不会阻止你实现自己的函数来实现你想要的。
我建议研究样条曲线及其计算方式 wiki
似乎是一个不错的起点。然后,您可以使用公式和多次 DrawLine 调用来生成 Arc。
编辑:甚至这个可能会更好地为您服务。
Im not too familiar with Direct2D so I am unaware of any specific function that would allow you to do this, however it does not stop you from implementing your own function to achieve what you want.
I recommend looking into splines and how they are calculated wiki
seems like a good place to start. You could then generate your Arc with with the formula and several DrawLine calls.
Edit: or even this may serve you better.