开发者

How does GraphicsPath.Flatten() affects to the drawing performance?

开发者 https://www.devze.com 2023-02-14 16:04 出处:网络
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) t

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:

How does GraphicsPath.Flatten() affects to the drawing performance?

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开发者_StackOverflow, 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号