Examples of GraphicsConfiguration


Examples of java.awt.GraphicsConfiguration

  // 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

Examples of java.awt.GraphicsConfiguration

            (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

Examples of java.awt.GraphicsConfiguration

    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

Examples of java.awt.GraphicsConfiguration

    public static Rectangle getDestinationBounds(Graphics2D g2d) {
        BufferedImage bi = getDestination(g2d);
        if (bi != null)
            return new Rectangle(0, 0, bi.getWidth(), bi.getHeight());

        GraphicsConfiguration gc = g2d.getDeviceConfiguration();

        // We are going to a BufferedImage but no hint was provided
        // so we can't determine the destination bounds.
        if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER)
            return null;

        // This is a JDK 1.3ism, so we will just return null...
        // return gc.getBounds();
        return null;
View Full Code Here

Examples of java.awt.GraphicsConfiguration

  }

  public static void saveScreenShot(final int modifiers)
  {
    final Component component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    final GraphicsConfiguration graphicsConfiguration = component.getGraphicsConfiguration();
    final GraphicsDevice graphicsDevice = graphicsConfiguration.getDevice();
    try
    {
      final Robot robot = new Robot(graphicsDevice);
      final BufferedImage image;
      if ((modifiers & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK)
      {
        image = robot.createScreenCapture(graphicsConfiguration.getBounds());
      }
      else
      {
        image = robot.createScreenCapture(component.getBounds());
      }
View Full Code Here

Examples of java.awt.GraphicsConfiguration

        }
    }

    public void run() {
        // Must find a graphics configuration with a depth of 32 bits
        GraphicsConfiguration gconfig = WindowUtils.getAlphaCompatibleGraphicsConfiguration();
        frame = new JFrame("Alpha Mask Demo");
        alphaWindow = new JWindow(frame, gconfig);
        icon = new JLabel();
        icon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        alphaWindow.getContentPane().add(icon);
View Full Code Here

Examples of java.awt.GraphicsConfiguration

        update(true, false);
    }
   
    public void run() {
        // Must find a graphics configuration with a depth of 32 bits
        GraphicsConfiguration gconfig = WindowUtils.getAlphaCompatibleGraphicsConfiguration();
        frame = new JFrame("Alpha Mask Demo");
        alphaWindow = new JWindow(frame, gconfig);
        MouseInputAdapter handler = new MouseInputAdapter() {
            private Point offset;
            public void mousePressed(MouseEvent e) {
View Full Code Here

Examples of java.awt.GraphicsConfiguration

         */
        private boolean paintBuffered(Graphics2D graphics) {
            boolean painted = false;

            // Paint the display into an offscreen buffer
            GraphicsConfiguration gc = graphics.getDeviceConfiguration();
            java.awt.Rectangle clipBounds = graphics.getClipBounds();

            if (bufferedImage == null
                || bufferedImageGC != gc
                || bufferedImage.getWidth() < clipBounds.width
                || bufferedImage.getHeight() < clipBounds.height) {

                bufferedImage = gc.createCompatibleImage(clipBounds.width,
                    clipBounds.height, Transparency.OPAQUE);
                bufferedImageGC = gc;
            }

            if (bufferedImage != null) {
View Full Code Here

Examples of java.awt.GraphicsConfiguration

         */
        private boolean paintVolatileBuffered(Graphics2D graphics) {
            boolean painted = false;

            // Paint the display into a volatile offscreen buffer
            GraphicsConfiguration gc = graphics.getDeviceConfiguration();
            java.awt.Rectangle gcBounds = gc.getBounds();
            if (volatileImage == null || volatileImageGC != gc) {
                if (volatileImage != null) {
                    volatileImage.flush();
                }
                volatileImage = gc.createCompatibleVolatileImage(gcBounds.width, gcBounds.height,
                    Transparency.OPAQUE);
                // we need to create a new volatile if the GC changes
                volatileImageGC = gc;
            }

View Full Code Here

Examples of java.awt.GraphicsConfiguration

          r.x += i.left;
          r.y += i.top;
          r.width -= (i.left + i.right);
          r.height -= (i.top + i.bottom);

          GraphicsConfiguration gc = parent.getGraphicsConfiguration();
          Rectangle popupArea = getContainerPopupArea(gc);
          return r.intersection(popupArea).contains(x, y, width, height);

        } else if (parent instanceof JApplet) {
          Rectangle r = parent.getBounds();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.