title: How to use Clipper library to enlarge and fill paths
body: <p>I am trying to use the Clipper library to modify a graphics path.</p>
  
  <p>I have list of widths that represent outlines / strokes. I want to start with the largest first and work my way down to the smallest.</p>
  
  <p>For this example, we will add 2 strokes with widths of 20 and 10.</p>
  
  <p>I want to take take my graphics path, and expand / offset it by 20 pixels into a new graphics path. I do not want to alter the original path. Then I want to fill the new graphics path with a solid color.</p>
  
  <p>Next, I want to take my original graphics path, and expand / offset it by 10 pixels into a new graphics path. I want to fill this new path with a different color.</p>
  
  <p>Then I want to fill my original path with a different color.</p>
  
  <p>What is the proper way to do this. I have the following method that I created to try and do this, but it is not working properly.</p>
  
  <pre><code>private void createImage(Graphics g, GraphicsPath gp, List&lt;int&gt; strokeWidths)
  {
    ClipperOffset pathConverter = new ClipperOffset();
    Clipper c = new Clipper();
    gp.Flatten();
  
    foreach(int strokeSize in strokeWidths)
    {
      g.clear();
      ClipperPolygons polyList = new ClipperPolygons();
      GraphicsPath gpTest = (GraphicsPath)gp.Clone();    
      PathToPolygon(gpTest, polyList, 100);
      gpTest.Reset();
  
      c.Execute(ClipType.ctUnion, polyList, PolyFillType.pftPositive, PolyFillType.pftEvenOdd);
      pathConverter.AddPaths(polyList, JoinType.jtMiter, EndType.etClosedPolygon);                  
      pathConverter.Execute(ref polyList, strokeSize * 100);
  
      for (int i = 0; i &lt; polyList.Count; i++)
      {
        // reverses scaling
        PointF[] pts2 = PolygonToPointFArray(polyList[i], 100);
        gpTest.AddPolygon(pts2);
      }
      g.FillPath(new SolidBrush(Color.Red), gpTest);
    }
  }
  
          private void PathToPolygon(GraphicsPath path, ClipperPolygons polys, Single scale)
          {
              GraphicsPathIterator pathIterator = new GraphicsPathIterator(path);
              pathIterator.Rewind();
              polys.Clear();
              PointF[] points = new PointF[pathIterator.Count];
              byte[] types = new byte[pathIterator.Count];
              pathIterator.Enumerate(ref points, ref types);
              int i = 0;
              while (i &lt; pathIterator.Count)
              {
                  ClipperPolygon pg = new ClipperPolygon();
                  polys.Add(pg);
                  do
                  {
  
                      IntPoint pt = new IntPoint((int)(points[i].X * scale), (int)(points[i].Y * scale));
                      pg.Add(pt);
                      i++;
                  }
                  while (i &lt; pathIterator.Count &amp;&amp; types[i] != 0);
              }
          }
          private PointF[] PolygonToPointFArray(ClipperPolygon pg, float scale)
          {
              PointF[] result = new PointF[pg.Count];
              for (int i = 0; i &lt; pg.Count; ++i)
              {
                  result[i].X = (float)pg[i].X / scale;
                  result[i].Y = (float)pg[i].Y / scale;
              }
              return result;
          }
  </code></pre>