1 Reply Latest reply: Jan 2, 2013 11:09 PM by StanislavL RSS

    Java2D, filling polygon

    976196
      I have two polygons, one is inside the other. I want to fill the portion
      between the polygons using some Paint. Currently I am doing as follows:


      Graphics2D g2d;
      Paint thePaint;
      Polygon outer, inner;

      g2d.setPaint(thePaint);
      g2d.fillPolygon(outer);
      g2d.setColor(Color.WHITE);
      g2d.fillPolygon(inner);


      This gives the desired results. But is affecting the performance when a
      large number of nested polygons exist.

      Is there any other direct, better, and efficient method to do this.

      Kindly help. Thanks in advance and best regards

      Abhay