1 /*
2 * Copyright (c) 2014, 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 */
27 import java.awt.GraphicsConfiguration;
28 import java.awt.GraphicsEnvironment;
29 import java.awt.Image;
30 import java.awt.Rectangle;
31 import java.awt.image.BufferedImage;
32 import java.awt.image.DataBuffer;
33 import java.awt.image.DataBufferByte;
34 import java.awt.image.DataBufferInt;
35 import java.awt.image.DataBufferShort;
36 import java.awt.image.VolatileImage;
37 import java.io.File;
38 import java.io.IOException;
39
40 import javax.imageio.ImageIO;
41
42 import static java.awt.Transparency.TRANSLUCENT;
43 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
44
45 /**
46 * @test
47 * @bug 8059942
48 * @summary Tests rotated clip when unmanaged image is drawn to VI.
49 * Results of the blit to compatibleImage are used for comparison.
50 * @author Sergey Bylokhov
51 */
52 public final class IncorrectUnmanagedImageRotatedClip {
53
54 public static void main(final String[] args) throws IOException {
55 BufferedImage bi = makeUnmanagedBI();
56 fill(bi);
57 test(bi);
58 }
59
60 private static void test(final BufferedImage bi) throws IOException {
61 GraphicsEnvironment ge = GraphicsEnvironment
62 .getLocalGraphicsEnvironment();
63 GraphicsConfiguration gc = ge.getDefaultScreenDevice()
64 .getDefaultConfiguration();
65 VolatileImage vi = gc.createCompatibleVolatileImage(500, 200,
66 TRANSLUCENT);
|
1 /*
2 * Copyright (c) 2014, 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 */
27 import java.awt.GraphicsConfiguration;
28 import java.awt.GraphicsEnvironment;
29 import java.awt.Image;
30 import java.awt.Rectangle;
31 import java.awt.image.BufferedImage;
32 import java.awt.image.DataBuffer;
33 import java.awt.image.DataBufferByte;
34 import java.awt.image.DataBufferInt;
35 import java.awt.image.DataBufferShort;
36 import java.awt.image.VolatileImage;
37 import java.io.File;
38 import java.io.IOException;
39
40 import javax.imageio.ImageIO;
41
42 import static java.awt.Transparency.TRANSLUCENT;
43 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
44
45 /**
46 * @test
47 * @key headful
48 * @bug 8059942
49 * @summary Tests rotated clip when unmanaged image is drawn to VI.
50 * Results of the blit to compatibleImage are used for comparison.
51 * @author Sergey Bylokhov
52 */
53 public final class IncorrectUnmanagedImageRotatedClip {
54
55 public static void main(final String[] args) throws IOException {
56 BufferedImage bi = makeUnmanagedBI();
57 fill(bi);
58 test(bi);
59 }
60
61 private static void test(final BufferedImage bi) throws IOException {
62 GraphicsEnvironment ge = GraphicsEnvironment
63 .getLocalGraphicsEnvironment();
64 GraphicsConfiguration gc = ge.getDefaultScreenDevice()
65 .getDefaultConfiguration();
66 VolatileImage vi = gc.createCompatibleVolatileImage(500, 200,
67 TRANSLUCENT);
|