1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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.
22 */
23
24 import java.awt.Color;
25 import java.awt.Graphics2D;
26 import java.awt.GraphicsConfiguration;
27 import java.awt.GraphicsEnvironment;
28 import java.awt.GradientPaint;
29 import java.awt.geom.Point2D;
30
31 import java.awt.Font;
32
33 import java.awt.image.BufferedImage;
34 import java.awt.image.VolatileImage;
35
36
37 /*
38 * @test
39 * @bug 7189452 8024767
40 * @summary Check if source offset for text rendering is handled correctly
41 * (shouldn't see the text on a similarly colored background).
42 * @author a.stepanov
43 * @run main TextRenderingTest
44 */
45
46 public class TextRenderingTest {
47
48 private static final int width = 450;
49 private static final int height = 150;
50
51 public static void main(final String[] args) {
52
53 GraphicsEnvironment ge =
54 GraphicsEnvironment.getLocalGraphicsEnvironment();
55 GraphicsConfiguration gc =
56 ge.getDefaultScreenDevice().getDefaultConfiguration();
57 VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
58
|
1 /*
2 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
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.
22 */
23
24 import java.awt.Color;
25 import java.awt.Graphics2D;
26 import java.awt.GraphicsConfiguration;
27 import java.awt.GraphicsEnvironment;
28 import java.awt.GradientPaint;
29 import java.awt.geom.Point2D;
30
31 import java.awt.Font;
32
33 import java.awt.image.BufferedImage;
34 import java.awt.image.VolatileImage;
35
36
37 /*
38 * @test
39 * @key headful
40 * @bug 7189452 8024767
41 * @summary Check if source offset for text rendering is handled correctly
42 * (shouldn't see the text on a similarly colored background).
43 * @author a.stepanov
44 * @run main TextRenderingTest
45 */
46
47 public class TextRenderingTest {
48
49 private static final int width = 450;
50 private static final int height = 150;
51
52 public static void main(final String[] args) {
53
54 GraphicsEnvironment ge =
55 GraphicsEnvironment.getLocalGraphicsEnvironment();
56 GraphicsConfiguration gc =
57 ge.getDefaultScreenDevice().getDefaultConfiguration();
58 VolatileImage vi = gc.createCompatibleVolatileImage(width, height);
59
|