Package java.awt

Examples of java.awt.GraphicsConfiguration$DefaultBufferCapabilities


public class Java2dHelper {

    public static BufferedImage createCompatibleImage(int width, int height) {
        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice screenDevice = environment.getDefaultScreenDevice();
        GraphicsConfiguration configuration = screenDevice.getDefaultConfiguration();
        return configuration.createCompatibleImage(width, height);
    }
View Full Code Here


        }
    }

    private synchronized void paintBuffered(Graphics g) {
        do {
            GraphicsConfiguration config = getGraphicsConfiguration();
            int width = getWidth();
            int height = getHeight();
            if (backBuffer == null || width != backBuffer.getWidth() || height != backBuffer.getHeight() || backBuffer.validate(config) == VolatileImage.IMAGE_INCOMPATIBLE) {
                if (backBuffer != null) {
                    backBufferGraphics.dispose();
                    backBufferGraphics = null;
                    backBuffer.flush();
                    backBuffer = null;
                }
                backBuffer = config.createCompatibleVolatileImage(width, height);
                backBufferGraphics = backBuffer.createGraphics();
            }
            backBufferGraphics.setClip(g.getClip());
            paintUnbuffered(backBufferGraphics);
            g.drawImage(backBuffer, 0, 0, this);
View Full Code Here

    oldDisplayMode = graphicsDevice.getDisplayMode();
    if (!graphicsDevice.isFullScreenSupported()) {
      System.out.println("Full screen mode failed");
      System.exit(1);
    } else {
      GraphicsConfiguration gc = graphicsDevice.getDefaultConfiguration();
      window = new Frame(gc);
    }
  }
View Full Code Here

    }

    public GraphicsConfiguration getDeviceConfiguration() {
        Graphics2D g2d = getBogusGraphics2D();

        GraphicsConfiguration gConf = g2d.getDeviceConfiguration();

        g2d.dispose();

        return gConf;
    }
View Full Code Here

    }

    public GraphicsConfiguration getDeviceConfiguration() {
        Graphics2D g2d = getBogusGraphics2D(true);

        GraphicsConfiguration gConf = g2d.getDeviceConfiguration();

        g2d.dispose();

        return gConf;
    }
View Full Code Here

    if (ge.isHeadlessInstance()) {
      img = new BufferedImage(w, h,
          layerId.equals("backing") ? BufferedImage.TYPE_INT_RGB
              : BufferedImage.TYPE_INT_ARGB);
    } else {
      GraphicsConfiguration gc = ge.getDefaultScreenDevice()
          .getDefaultConfiguration();
//        int imageType = layerId.equals("backing") && false ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
//        img = new BufferedImage((int)b.width, (int)b.height, imageType);
      img = gc.createCompatibleImage(w, h,
          layerId.equals("backing") ? Transparency.OPAQUE
              : Transparency.TRANSLUCENT);
    }
    ctx = (Graphics2D) img.createGraphics();
    ctx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
View Full Code Here

            GraphicsDevice[] gs = ge.getScreenDevices();
            if (gs.length > 1) {
                LOGGER.warning("Fullscreen using size of first screen");
            }

            GraphicsConfiguration gc = gs[0].getDefaultConfiguration();
            Rectangle size = gc.getBounds();

            setBounds(size);
        } else {
            // user-specified size. Try to set the size of the 3d canvas to
            // the size the user specified
View Full Code Here

  // Create the Canvas3D (both on-screen and off-screen)
  private void createCanvas3D(BranchGroup scene,int w,int h) {
    // Create Canvas3D
    GraphicsConfiguration config =
      SimpleUniverse.getPreferredConfiguration();

    canvas3D = new Canvas3D(config);
    canvas3D.setSize(w, h);
View Full Code Here

            (RenderingHintsKeyExt.KEY_BUFFERED_IMAGE);
        if (o != null)
            return (BufferedImage)(((Reference)o).get());

        // Check if this is a BufferedImage G2d if so throw an error...
        GraphicsConfiguration gc = g2d.getDeviceConfiguration();
        GraphicsDevice gd = gc.getDevice();
        if (WARN_DESTINATION &&
            (gd.getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) &&
            (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) !=
                RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING))
            // throw new IllegalArgumentException
View Full Code Here

    public static ColorModel getDestinationColorModel(Graphics2D g2d) {
        BufferedImage bi = getDestination(g2d);
        if (bi != null)
            return bi.getColorModel();

        GraphicsConfiguration gc = g2d.getDeviceConfiguration();

        // We are going to a BufferedImage but no hint was provided
        // so we can't determine the destination Color Model.
        if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) {
            if (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) ==
                RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING)
                return sRGB_Unpre;

            // System.out.println("CM: " + gc.getColorModel());
            // System.out.println("CS: " + gc.getColorModel().getColorSpace());
            return null;
        }

        return gc.getColorModel();
    }
View Full Code Here

TOP

Related Classes of java.awt.GraphicsConfiguration$DefaultBufferCapabilities

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.