Package java.awt

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()


    Graphics2D g3 = (Graphics2D) g;
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
    .getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    if (bufferedImage == null)
    bufferedImage = gc.createCompatibleImage(resolution.x,
    resolution.y, Transparency.OPAQUE);

    Graphics2D g2 = bufferedImage.createGraphics();
    g2.setColor(new Color(30, 40, 50));
    Rectangle new_rect = new Rectangle(0, 0, resolution.x, resolution.y);
View Full Code Here


    // GENERATE MERGED TILE IMAGE
    // FIXME: although faster, the following doesn't seem to handle alpha on
    // some platforms...
    GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Image tileImg = config.createCompatibleImage(c.getWidth(), c.getHeight());
    c.render(tileImg.getGraphics());
    tile.setImage(tileImg);

    myTs.addTile(tile);
View Full Code Here

        if (image instanceof BufferedImage)
        return (BufferedImage) image;

        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        // BufferedImage bufferedImage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
        BufferedImage bufferedImage = gc.createCompatibleImage(100, 80, transparency);


        Graphics g = bufferedImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();
View Full Code Here

        if (image instanceof BufferedImage)
        return (BufferedImage) image;

        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        // BufferedImage bufferedImage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
        BufferedImage bufferedImage = gc.createCompatibleImage(100, 80, transparency);


        Graphics g = bufferedImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();
View Full Code Here

    // String l_filename = IMAGE_DIR + File.separator + filename;
    log.debug("Loading image <"+file.getAbsolutePath()+">");
    try {
      BufferedImage bi = ImageIO.read(file);
      int transparency = bi.getColorModel().getTransparency();
      BufferedImage copy = gc.createCompatibleImage(bi.getWidth(), bi.getHeight(), transparency);
      Graphics2D g2d = copy.createGraphics();
      g2d.drawImage(bi,0,0,null);
      g2d.dispose();
      return copy;
    }
View Full Code Here

          clip.y + 10);
    }

    // first draw image in memory and then draw it to the graphics buffer
    GraphicsConfiguration gc = getGraphicsConfiguration();
    BufferedImage image = gc.createCompatibleImage((int) clip.getWidth(),
        (int) clip.getHeight(), Transparency.TRANSLUCENT);
    Graphics gImg = image.getGraphics();

    Set<Point> drawCoords = getDrawCoords(this.currentBlock.getPosition(),
        this.displayedBlocks);
View Full Code Here

  @Override
  public void paint(Graphics g) {
    // create dummy image
    GraphicsConfiguration gc = getGraphicsConfiguration();
    BufferedImage img = gc.createCompatibleImage(getWidth(), getHeight(),
        Transparency.TRANSLUCENT);
    Graphics2D g2d = (Graphics2D) img.getGraphics();
   
    // draw component on image
    super.paint(g2d);
View Full Code Here

  @Override
  protected void paintComponent(Graphics g) {
    // Graphics2D g2d = (Graphics2D) g;

    GraphicsConfiguration gc = getGraphicsConfiguration();
    BufferedImage img = gc.createCompatibleImage(getWidth(), getHeight(),
        Transparency.TRANSLUCENT);
    Graphics2D g2d = (Graphics2D) img.getGraphics();

    super.paintComponent(g2d);
View Full Code Here

    GraphicsConfiguration gc = getGraphicsConfiguration();

    // Create a new buffer image if there is none or the size has changed
    if (image == null || image.getWidth() != clip.width
        || image.getHeight() != clip.height) {
      image = (BufferedImage) gc.createCompatibleImage(clip.width,
          clip.height, Transparency.TRANSLUCENT);
    }

    // Draw the list onto the image
    Graphics2D g2 = image.createGraphics();
View Full Code Here

            paint0(graphics);
        } else {
            boolean freshImage = false;
            if (doubleBufferImage == null) {
                GraphicsConfiguration gc = graphics.getDeviceConfiguration();
                doubleBufferImage = gc.createCompatibleImage(getWidth(), getHeight(),
                        Transparency.OPAQUE);
                doubleBufferedRepaintRequired = true;
                freshImage = true;
            }
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.