GraphicsPath.Flatten() 对绘图性能有何影响?

发布于 2024-10-20 10:52:17 字数 625 浏览 3 评论 0原文

恐怕我在 Winforms/GDI+ 中遇到了错误。我正在构建一条由直线和曲线组成的图形路径。在某些缩放级别(将变换矩阵应用于图形对象),路径绘制错误,请参见图片:

在此处输入图像描述

进行一些测试后,我注意到如果我将 Flatten() 应用于图形路径,问题就会消失。看起来曲线被转换为连接的线段,问题消失了(这是代码):

result.AddLine(sourcex, sourcey, sourcex, sourcey + sourceOffset);
result.AddArc(ellipseContainer, startAngle, sweepAngle);
result.Flatten(); // this line solves the issue!!

我已经调试了应用程序,图形路径中的点数为 9,没有应用 Flatten() ,以及 53 应用Flatten()

我的问题是。您对将 Flatten() 应用于graphicsPaths 的绘图性能有何看法?您认为这一变化会受到影响吗?

提前致谢。

I'm afraid that I'm experiencing a bug in Winforms/GDI+. I'm building a graphics path composed by a line and then a curve. At some zoom levels (applying a transform matrix to the graphics object) the path is wrongly drawn, see the picture:

enter image description here

Doing some testing I noticed that if I apply Flatten() to the graphics path, the problem dissapears. It seems that the curves are converted to connected segments, and the problem dissapears (this is the code):

result.AddLine(sourcex, sourcey, sourcex, sourcey + sourceOffset);
result.AddArc(ellipseContainer, startAngle, sweepAngle);
result.Flatten(); // this line solves the issue!!

I have debugged the application and the number of points in the graphics path is 9 without apply Flatten(), and 53 applying Flatten().

My question is. What do you think about drawing performance applying Flatten() to graphicsPaths? Do you think that could be affected by this change?

Thanks in advance.

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

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

发布评论

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

评论(1

半仙 2024-10-27 10:52:17

如果你想要连接线,你应该使用 AddLines 将其绘制为折线

If you want the line to be joined, you should draw it as a polyline using AddLines

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