Example usage for java.awt GraphicsConfiguration getImageCapabilities

List of usage examples for java.awt GraphicsConfiguration getImageCapabilities

Introduction

In this page you can find the example usage for java.awt GraphicsConfiguration getImageCapabilities.

Prototype

public ImageCapabilities getImageCapabilities() 

Source Link

Document

Returns the image capabilities of this GraphicsConfiguration .

Usage

From source file:Main.java

public static void main(String[] argv) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();
    System.out.println(gc.getImageCapabilities());
}

From source file:Main.java

public static BufferedImage toBufferedImage(Image image) {
    if (image instanceof BufferedImage) {
        return (BufferedImage) image;
    }/*from  w ww .  j  a  v a2 s .  com*/

    // This code ensures that all the pixels in the image are loaded
    image = new ImageIcon(image).getImage();
    // Create a buffered image with a format that's compatible with the screen
    BufferedImage bimage = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try {
        GraphicsDevice gs = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gs.getDefaultConfiguration();
        VolatileImage vbimage = gc.createCompatibleVolatileImage(200, 200, gc.getImageCapabilities());
    } catch (Exception e) {
        // The system does not have a screen
    }
    return bimage;
}

From source file:Main.java

public static BufferedImage toBufferedImage(Image image) {
    if (image instanceof BufferedImage) {
        return (BufferedImage) image;
    }/*from w  ww .  j ava  2s. co m*/

    // This code ensures that all the pixels in the image are loaded
    image = new ImageIcon(image).getImage();
    // Create a buffered image with a format that's compatible with the screen
    BufferedImage bimage = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try {
        GraphicsDevice gs = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gs.getDefaultConfiguration();
        VolatileImage vbimage = gc.createCompatibleVolatileImage(200, 200, gc.getImageCapabilities(),
                Transparency.BITMASK);
    } catch (Exception e) {
        // The system does not have a screen
    }
    return bimage;
}

From source file:GCWrapper.java

private void gcChanged() {
    GCWrapper wrap = (GCWrapper) gcSelection.getSelectedItem();
    // assert wrap != null;
    GraphicsConfiguration gc = wrap.getGC();
    // assert gc != null;
    // Image Caps
    ImageCapabilities imageCaps = gc.getImageCapabilities();
    imageAccelerated.setSelected(imageCaps.isAccelerated());
    imageTrueVolatile.setSelected(imageCaps.isTrueVolatile());
    // Buffer Caps
    BufferCapabilities bufferCaps = gc.getBufferCapabilities();
    flipping.setSelected(bufferCaps.isPageFlipping());
    flippingMethod.setText(getFlipText(bufferCaps.getFlipContents()));
    fullScreen.setSelected(bufferCaps.isFullScreenRequired());
    multiBuffer.setSelected(bufferCaps.isMultiBufferAvailable());
    // Front buffer caps
    imageCaps = bufferCaps.getFrontBufferCapabilities();
    fbAccelerated.setSelected(imageCaps.isAccelerated());
    fbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
    imageCaps = bufferCaps.getFrontBufferCapabilities();
    // Back buffer caps
    imageCaps = bufferCaps.getBackBufferCapabilities();
    bbAccelerated.setSelected(imageCaps.isAccelerated());
    bbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
}

From source file:GCWrapper.java

private void gcChanged() {
    GCWrapper wrap = (GCWrapper) gcSelection.getSelectedItem();
    //assert wrap != null;
    GraphicsConfiguration gc = wrap.getGC();
    //assert gc != null;
    //Image Caps//from w ww  . j  av a 2s  .c  o  m
    ImageCapabilities imageCaps = gc.getImageCapabilities();
    imageAccelerated.setSelected(imageCaps.isAccelerated());
    imageTrueVolatile.setSelected(imageCaps.isTrueVolatile());
    // Buffer Caps
    BufferCapabilities bufferCaps = gc.getBufferCapabilities();
    flipping.setSelected(bufferCaps.isPageFlipping());
    flippingMethod.setText(getFlipText(bufferCaps.getFlipContents()));
    fullScreen.setSelected(bufferCaps.isFullScreenRequired());
    multiBuffer.setSelected(bufferCaps.isMultiBufferAvailable());
    // Front buffer caps
    imageCaps = bufferCaps.getFrontBufferCapabilities();
    fbAccelerated.setSelected(imageCaps.isAccelerated());
    fbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
    imageCaps = bufferCaps.getFrontBufferCapabilities();
    // Back buffer caps
    imageCaps = bufferCaps.getBackBufferCapabilities();
    bbAccelerated.setSelected(imageCaps.isAccelerated());
    bbTrueVolatile.setSelected(imageCaps.isTrueVolatile());
}

From source file:net.sf.maltcms.chromaui.charts.FastHeatMapPlot.java

/**
 *
 * @param width/*from w w w .  jav  a2s.  c o m*/
 * @param height
 * @param transparency
 * @return
 */
public BufferedImage createCompatibleImage(int width, int height, int transparency) {
    GraphicsConfiguration gc = getGraphicsConfiguration();
    gc.getImageCapabilities().isAccelerated();
    return gc.createCompatibleImage(width, height, transparency);

}

From source file:net.sf.maltcms.chromaui.charts.FastHeatMapPlot.java

/**
 *
 * @param width/* www.j a  va 2s  .  c o m*/
 * @param height
 * @param transparency
 * @return
 */
public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency) {
    GraphicsConfiguration gc = getGraphicsConfiguration();
    VolatileImage img = gc.createCompatibleVolatileImage(width, height, transparency);
    Logger.getLogger(getClass().getName()).log(Level.INFO, "Using accelerated images: {0}",
            gc.getImageCapabilities().isAccelerated());
    Logger.getLogger(getClass().getName()).log(Level.INFO, "Using true volatile images: {0}",
            gc.getImageCapabilities().isTrueVolatile());
    return img;
}