[OpenJDK 2D-Dev] miter line join bug

Hiroshi Yamauchi yamauchi at google.com
Thu Feb 19 04:28:14 UTC 2009


Hi,

Here's a miter bugfix, and a test.

Thanks,
Hiroshi

---- bug ----
The miter line join decoration isn't rendered properly.

---- fix ----
+++ jdk/src/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java	2009-02-18
17:14:05.000000000 -0800
@@ -245,6 +245,7 @@
                              FloatToS15_16(coords[1]));
                 break;
             case PathIterator.SEG_CLOSE:
+                lsink.lineJoin();
                 lsink.close();
                 break;
             default:

---- test ----
public class JoinMiterTest {
  public static void main(String[] args) throws Exception {
    BufferedImage image = new BufferedImage(200, 200,
BufferedImage.TYPE_INT_RGB);
    Graphics2D g = image.createGraphics();
    g.setPaint(Color.WHITE);
    g.fill(new Rectangle(image.getWidth(), image.getHeight()));
    g.translate(25, 100);
    g.setPaint(Color.BLACK);
    g.setStroke(new BasicStroke(20, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER));
    g.draw(new Polygon(new int[] {0, 150, 0}, new int[] {75, 0, -75},
3));
    ImageIO.write(image, "PNG", new File(args[0]));
  }
}



More information about the 2d-dev mailing list