jdk/test/sun/java2d/AcceleratedXORModeTest.java
author sla
Mon, 07 Apr 2014 08:09:55 +0200
changeset 23723 46b29c0e9656
parent 20417 d7fe919adefb
child 25204 65c62411e10f
permissions -rw-r--r--
8039256: Add sun/jvmstat/monitor/MonitoredVm/CR6672135.java to ProblemList.txt Reviewed-by: mgronlun, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20417
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     1
/*
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     4
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     8
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    13
 * accompanied this code).
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    14
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    18
 *
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    21
 * questions.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    22
 */
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    23
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    24
/*
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    25
* @test
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    26
* @bug     8024343
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    27
* @summary Test verifies that accelerated pipelines
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    28
*          correctly draws primitives in XOR mode.
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    29
* @run main/othervm -Dsun.java2d.xrender=True AcceleratedXORModeTest
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    30
*/
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    31
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    32
import java.awt.Color;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    33
import java.awt.Graphics2D;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    34
import java.awt.GraphicsConfiguration;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    35
import java.awt.GraphicsEnvironment;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    36
import java.awt.image.BufferedImage;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    37
import java.awt.image.VolatileImage;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    38
import java.io.File;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    39
import java.io.IOException;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    40
import javax.imageio.ImageIO;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    41
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    42
public class AcceleratedXORModeTest {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    43
    public static void main(String argv[]) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    44
        String fileName = argv.length > 0 ? argv[0] : null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    45
        new AcceleratedXORModeTest(fileName).test();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    46
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    47
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    48
    static final Color backColor = Color.red;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    49
    static final Color color1 = Color.green;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    50
    static final Color color2 = Color.yellow;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    51
    static final Color xorColor1 = Color.blue;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    52
    static final Color xorColor2 = Color.white;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    53
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    54
    static final int width = 700, height = 300;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    55
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    56
    VolatileImage vImg = null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    57
    String fileName;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    58
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    59
    public AcceleratedXORModeTest(String fileName) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    60
        this.fileName = fileName;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    61
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    62
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    63
    void draw(Graphics2D g) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    64
        g.setColor(backColor);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    65
        g.fillRect(0, 0, width, height);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    66
        g.setXORMode(xorColor1);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    67
        drawPattern(g, 100);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    68
        g.setXORMode(xorColor2);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    69
        drawPattern(g, 400);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    70
        g.dispose();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    71
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    72
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    73
    void test(BufferedImage bi) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    74
        comparePattern(bi, 150, xorColor1.getRGB());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    75
        comparePattern(bi, 450, xorColor2.getRGB());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    76
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    77
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    78
    void comparePattern(BufferedImage bi, int startX, int xorColor) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    79
        int[] expectedColors = {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    80
            backColor.getRGB() ^ color1.getRGB() ^ xorColor,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    81
            backColor.getRGB() ^ color1.getRGB() ^ xorColor ^
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    82
                color2.getRGB() ^ xorColor,
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    83
            backColor.getRGB() ^ color2.getRGB() ^ xorColor
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    84
        };
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    85
        for (int i = 0; i < 3; i++) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    86
            int x = startX + 100 * i;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    87
            int rgb = bi.getRGB(x, 150);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    88
            if (rgb != expectedColors[i]) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    89
                String msg = "Colors mismatch: x = " + x +
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    90
                        ", got " + new Color(rgb) + ", expected " +
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    91
                        new Color(expectedColors[i]);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    92
                System.err.println(msg);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    93
                write(bi);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    94
                throw new RuntimeException("FAILED: " + msg);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    95
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    96
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    97
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    98
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
    99
    void drawPattern(Graphics2D g, int x) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   100
        g.setColor(color1);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   101
        g.fillRect(x, 0, 200, 300);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   102
        g.setColor(color2);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   103
        g.fillRect(x+100, 0, 200, 300);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   104
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   105
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   106
    GraphicsConfiguration getDefaultGC() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   107
        return GraphicsEnvironment.getLocalGraphicsEnvironment().
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   108
                getDefaultScreenDevice().getDefaultConfiguration();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   109
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   110
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   111
    void createVImg() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   112
        if (vImg != null) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   113
            vImg.flush();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   114
            vImg = null;
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   115
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   116
        vImg = getDefaultGC().createCompatibleVolatileImage(width, height);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   117
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   118
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   119
    void write(BufferedImage bi) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   120
        if (fileName != null) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   121
            try {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   122
                ImageIO.write(bi, "png", new File(fileName));
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   123
            } catch (IOException e) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   124
                System.err.println("Can't write image file " + fileName);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   125
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   126
        }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   127
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   128
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   129
    void test() {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   130
        createVImg();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   131
        do {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   132
            int valCode = vImg.validate(getDefaultGC());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   133
            if (valCode == VolatileImage.IMAGE_INCOMPATIBLE) {
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   134
                createVImg();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   135
            }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   136
            Graphics2D g = vImg.createGraphics();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   137
            draw(g);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   138
            BufferedImage bi = vImg.getSnapshot();
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   139
            test(bi);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   140
            write(bi);
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   141
        } while (vImg.contentsLost());
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   142
    }
d7fe919adefb 8024343: Change different color with the "The XOR alternation color" combobox, the color of the image can not shown immediately.
vadim
parents:
diff changeset
   143
}