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

fillPolygon() broken

XMLWordPrintable

    • 2d
    • sparc
    • solaris_8

      fillPolygon() is broken on java 1.3,, solaris/sparc.
      Following program demonstrates the bug.
      Draws a polygon and then fills the same polygon. Use xmag to see detail.
      It's easy to see the two don't match:

      nairobi$ java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
      nairobi$ uname -a
      SunOS nairobi 5.8 Generic_108528-01 sun4u sparc SUNW,Ultra-80
      nairobi$ cat FillPolygon.java
      import java.awt.*;
      import javax.swing.*;

      public class FillPolygon extends JComponent {

          public void paint(Graphics g) {
              int x[] = new int[] {1, 8, 14, 8, 1};
              int y[] = new int[] {1, 1, 7, 13, 13};
              Polygon thumb = new Polygon(x, y, x.length);

              g.setColor(Color.green);
              g.fillRect(0, 0, 50, 50);

              g.setColor(Color.red);

              g.drawPolygon(thumb);
              g.translate( 15, 0 );
              g.fillPolygon(thumb); // BUG!
          }

          static public void main(String args[]) {
              JFrame f = new JFrame();
              f.getContentPane().add(new FillPolygon());
              f.setSize(100, 100);
              f.setVisible(true);
          }
      }

            flar Jim Graham
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: