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.*;
25 import java.awt.image.*;
26 import java.util.*;
27 import javax.swing.*;
28
29 /**
30 * @test
31 * @bug 8024895
32 * @summary tests if changing extra alpha values are honored for transformed blits
33 * @author ceisserer
34 */
35 public class EABlitTest extends Frame {
36 protected void test() {
37 BufferedImage srcImg = createSrcImage();
38 Image dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20, 50);
39
40 //be over-cautious and render twice to avoid BI caching issues
41 renderToVI(srcImg, dstImg);
42 renderToVI(srcImg, dstImg);
43
44 BufferedImage validationImg = new BufferedImage(20, 50, BufferedImage.TYPE_INT_RGB);
45 Graphics2D valG = (Graphics2D) validationImg.getGraphics();
46 valG.drawImage(dstImg, 0, 0, null);
47
48 //Loop over all pixel, and count the different pixel values encountered.
49 TreeSet<Integer> colorCntSet = new TreeSet<>();
50 for (int x=0; x < validationImg.getWidth(); x++) {
|
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.*;
25 import java.awt.image.*;
26 import java.util.*;
27 import javax.swing.*;
28
29 /**
30 * @test
31 * @key headful
32 * @bug 8024895
33 * @summary tests if changing extra alpha values are honored for transformed blits
34 * @author ceisserer
35 */
36 public class EABlitTest extends Frame {
37 protected void test() {
38 BufferedImage srcImg = createSrcImage();
39 Image dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20, 50);
40
41 //be over-cautious and render twice to avoid BI caching issues
42 renderToVI(srcImg, dstImg);
43 renderToVI(srcImg, dstImg);
44
45 BufferedImage validationImg = new BufferedImage(20, 50, BufferedImage.TYPE_INT_RGB);
46 Graphics2D valG = (Graphics2D) validationImg.getGraphics();
47 valG.drawImage(dstImg, 0, 0, null);
48
49 //Loop over all pixel, and count the different pixel values encountered.
50 TreeSet<Integer> colorCntSet = new TreeSet<>();
51 for (int x=0; x < validationImg.getWidth(); x++) {
|