Java Code Examples for java.awt.Toolkit#prepareImage()

The following examples show how to use java.awt.Toolkit#prepareImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LUTCompareTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 2
Source File: MultiResolutionImageObserverTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 3
Source File: LUTCompareTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 4
Source File: LUTCompareTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 5
Source File: MultiResolutionImageObserverTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 6
Source File: LUTCompareTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 7
Source File: MultiResolutionImageObserverTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 8
Source File: MultiResolutionImageObserverTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 9
Source File: MultiResolutionImageObserverTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 10
Source File: LUTCompareTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 11
Source File: MultiResolutionImageObserverTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 12
Source File: LUTCompareTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 13
Source File: MultiResolutionImageObserverTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 14
Source File: LUTCompareTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 15
Source File: LUTCompareTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 16
Source File: LUTCompareTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 17
Source File: MultiResolutionImageObserverTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        generateImages();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);

        LoadImageObserver sizeObserver
                = new LoadImageObserver(WIDTH | HEIGHT);
        toolkit.prepareImage(image, -1, -1, sizeObserver);
        waitForImageLoading(sizeObserver, "The first observer is not called");

        LoadImageObserver bitsObserver
                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);

        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
        g2d.scale(2, 2);
        g2d.drawImage(image, 0, 0, bitsObserver);
        waitForImageLoading(bitsObserver, "The second observer is not called!");
        g2d.dispose();
    }
 
Example 18
Source File: LUTCompareTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
Example 19
Source File: MultiResolutionImageTest.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT,
            new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 20
Source File: MultiResolutionImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT,
            new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }