GDI+ Widen Bug
So when developing our very graphic intensive GDI+ mapping product, I ran into this problem back in July 2004. If you have a GraphicsPath with two lines, all the same point (in this case at 100,100) and you try to run a widen on the path, GDI+ throws an out of memory exception. Not cool.
Essentially you have a point, and you want to widen the point to create a "circle". However, because the Pen is drawn like a highlighter and the widen call creates a path that outlines the shape created by the pen, it seems that the code to widen doesn't work nicely in this scenario.
Here is the C# code:
GraphicsPath gp = new GraphicsPath();
gp.AddLines(new Point[]{new Point(100,100),new Point(100,100), new Point(100, 100)});
gp.Widen(new Pen(Color.Black, 1F));
I have run into a lot of similar issues with GDI+. Hidden bugs that only show up under intensive graphic manipulation. I hope someone at Microsoft is listening because it's exceedingly difficult to create enterprise applications with GDI+.
Essentially you have a point, and you want to widen the point to create a "circle". However, because the Pen is drawn like a highlighter and the widen call creates a path that outlines the shape created by the pen, it seems that the code to widen doesn't work nicely in this scenario.
Here is the C# code:
GraphicsPath gp = new GraphicsPath();
gp.AddLines(new Point[]{new Point(100,100),new Point(100,100), new Point(100, 100)});
gp.Widen(new Pen(Color.Black, 1F));
I have run into a lot of similar issues with GDI+. Hidden bugs that only show up under intensive graphic manipulation. I hope someone at Microsoft is listening because it's exceedingly difficult to create enterprise applications with GDI+.

1 Comments:
Do you ever post new stuff to your blog?
By
Anonymous, at 4:15 PM
Post a Comment
<< Home