GraphicsPath.Flatten() 对绘图性能有何影响?
恐怕我在 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:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想要连接线,你应该使用
AddLines
将其绘制为折线If you want the line to be joined, you should draw it as a polyline using
AddLines