Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4210679

Same 20% opaque color for poly fill and wide border cause unwanted darker color

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • None
    • 1.2.0
    • client-libs
    • 2d
    • x86
    • windows_98

    Description



      Name: gsC80088 Date: 02/10/99


      If I draw a polygon with the same 20% opaque color for a polygon and it's wide border (BasicStroke 45f), the area where the
      border overlaps the fill produces an unwanted darker color.

      This bug is best understood by seeing an image of the result:
      bug.jpeg

      This image and an associated readme may be found at

      ftp://ncrds.er.usgs.gov/pub/java2d_bug/

      log in as "anonymous".
                                       
      CODE:

      final static Color trgreen = new Color(0,255,0,50);
      final static BasicStroke stroke = new BasicStroke(2.0f);
      final static BasicStroke wideStroke = new BasicStroke(45.0f,
                                              BasicStroke.CAP_ROUND,
                                              BasicStroke.JOIN_ROUND);

      /* Clockwise outer polygon */

              GeneralPath p1 = new GeneralPath(GeneralPath.WIND_NON_ZERO);

              p1.moveTo( w * .25f, h * 0.2f);
              p1.lineTo( w * .75f, h * .5f);
              p1.lineTo( w * .25f, h * .8f);
              p1.lineTo( w * .2f, h * .5f);
              p1.closePath();

      /* Counter-clockwise polygon hole */

              p1.moveTo( w * .25f, h * 0.4f);
              p1.lineTo( w * .35f, h * .63f);
              p1.lineTo( w * .5f, h * .5f);
              p1.closePath();

              g2.setStroke(wideStroke);
              g2.setColor(trgreen);
              g2.fill(p1);
              g2.setColor(trgreen);
              g2.draw(p1);
      (Review ID: 48844)
      ======================================================================

      Attachments

        Activity

          People

            flar Jim Graham
            gstone Greg Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: