Draw/Fill Polygon issue

Sep 2, 2010 at 9:56 AM

Hi guys, I want to check it out if it's a bug or I missed st.

I want to draw and fill a polygon, everything works fine when the polygon is in range; for example my writeablebitmap is 256*256; but my points are:
int[] points = new int[] { 10, 10, 80, 80, 120, -100, 10, 10 };

The fill polygon works pretty good but the draw polygon doesn't seems right.
            int[] points = new int[] { 10, 10, 80, 80, 120, -100, 10, 10 };

            WriteableBitmap bitmap = new WriteableBitmap(256, 256);
            bitmap.FillPolygon(points, Colors.Yellow);
            bitmap.DrawPolyline(points, Colors.Blue);
            bitmap.Invalidate();

            Image1.Source = bitmap;

Please try my code and see my issue.

Thanks,
Howard

Coordinator
Sep 3, 2010 at 7:47 PM

Hi Howard,

thanks for reporting this issue. I just fixed it. See the Change Set 60353:

http://writeablebitmapex.codeplex.com/SourceControl/changeset/changes/60353

 

- Rene Schulte

Sep 4, 2010 at 9:22 AM
Edited Sep 4, 2010 at 9:31 AM

Hi Rene,

That's great; thank you very much. Your team is amazing.

Best regards,
Howard 

Sep 5, 2010 at 3:30 PM

Hi Rene,

Sorry to trouble you again. It seems the issue still exists. When some of my polylines' points are out of boundary, the drawline method draws some extra lines on the screen. But the fillpolygon method works fine.
Here is the code to recreate this issue.
WriteableBitmap wb = new WriteableBitmap(256, 256);            

int[] points = new int[] { 10, 10, -20, 20, 50, 270, 270, 100, 100, -50, 10, 10 };            
wb.FillPolygon(points, Colors.Blue);            
wb.DrawPolyline(points, Colors.Black);            
wb.Invalidate();            
Image1.Source = wb; 

You will see the line doesn't match with  the fill color.

Best regards,
Howard 

Coordinator
Sep 6, 2010 at 11:27 PM

Hi Howard,

thanks for another report. I hope the new fix covers all circumstances now. See the Change Set 60493:

http://writeablebitmapex.codeplex.com/SourceControl/changeset/changes/60493

 

- Rene Schulte

Sep 8, 2010 at 1:39 AM

Hi Rene,

It all works fine now. Thanks a lot.

Howard