Click here to Skip to main content
Sign Up to vote bad
good
See more: C#graphicsgeometry
The problem is the following.
 
I have 2 arrays of points. In a graphics I need to paint the polygon (array 1) without painting the inside (array 2), As this image.
 
http://wiki.openstreetmap.org/w/images/thumb/b/b4/Multipolygon_Illustration_1.svg/400px-Multipolygon_Illustration_1.svg.png[^]
 
Any idea how to do this in C#?
Posted 30 Jan '13 - 0:03
gilvani1.3K
Edited 30 Jan '13 - 0:04


1 solution

hello, I found the solution.
 
In graphics I changed the CompositingMode that determines when to paint a polygon on the other it is overwritten and not superimposed.
 

Bitmap img = new Bitmap( 200, 200 );
Graphics imgGraph = Graphics.FromImage( img );
imgGraph.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
imgGraph.FillPolygon( Brushes.Red, Points1 );
imgGraph.FillPolygon( Brushes.Transparent, Points2 );
 

 

That's all folks!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 206
1 Maciej Los 146
2 Richard MacCutchan 145
3 Tadit Dash 140
4 Sergey Alexandrovich Kryukov 135
0 Sergey Alexandrovich Kryukov 10,264
1 OriginalGriff 7,957
2 CPallini 4,201
3 Rohan Leuva 3,522
4 Maciej Los 3,155


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid