author | mchung |
Mon, 26 Nov 2012 22:49:06 -0800 | |
changeset 16098 | 9001e536ab4e |
parent 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
2391
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
2391
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
4 |
* |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
8 |
* |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
13 |
* accompanied this code). |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
14 |
* |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2391
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
22 |
*/ |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
23 |
|
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
24 |
/* @test |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
25 |
* @summary Pass if no RuntimeException. |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
26 |
* @bug 6812600 |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
27 |
*/ |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
28 |
import java.awt.*; |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
29 |
import java.awt.image.BufferedImage; |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
30 |
|
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
31 |
public class JoinMiterTest { |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
32 |
|
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
33 |
public static void main(String[] args) throws Exception { |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
34 |
BufferedImage image = new BufferedImage(200, 200, |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
35 |
BufferedImage.TYPE_INT_RGB); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
36 |
Graphics2D g = image.createGraphics(); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
37 |
g.setPaint(Color.WHITE); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
38 |
g.fill(new Rectangle(image.getWidth(), image.getHeight())); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
39 |
g.translate(25, 100); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
40 |
g.setPaint(Color.BLACK); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
41 |
g.setStroke(new BasicStroke(20, BasicStroke.CAP_BUTT, |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
42 |
BasicStroke.JOIN_MITER)); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
43 |
g.draw(new Polygon(new int[] {0, 150, 0}, new int[] {75, 0, -75}, 3)); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
44 |
if (image.getRGB(16, 10) == Color.WHITE.getRGB()) { |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
45 |
throw new RuntimeException("Miter is not rendered."); |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
46 |
} |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
47 |
} |
3397fe90e591
6812600: The miter line join decoration isn't rendered properly
jgodinez
parents:
diff
changeset
|
48 |
} |