Package java.awt

Examples of java.awt.Graphics2D.dispose()


    final Dimension d = myView.getSize();
    final BufferedImage i = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB);
    final Graphics2D g = i.createGraphics();
    g.setClip(0, 0, d.width, d.height);
    myView.paint(g);
    g.dispose();
   

    try {
      ImageIO.write(i, "png", new File(filename));
    } catch (final java.io.IOException e) {
View Full Code Here


   
    // Adjust the coordinates so that the actual player image gets
    // drawn to the image area
    g2d.translate(0, IMAGE_HEIGHT % 32);
    view.draw(g2d);
    g2d.dispose();
   
    return image;
  }
 
  /**
 
View Full Code Here

    // Draw the image (the usable height starts right from the top)
    int y = (height - BOTTOM_MARGIN - categoryImage.getHeight()) / 2 + TOP_MARGIN;
    g2d.setComposite(AlphaComposite.SrcOver);
    g2d.drawImage(categoryImage, SIDE_MARGIN, y, null);
   
    g2d.dispose();
   
    return new ImageSprite(image);
  }

}
View Full Code Here

    Graphics2D g = image.createGraphics();
    g.setColor(style.getForeground());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
    g.setClip(0, 0, ICON_WIDTH, ICON_WIDTH);
    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
    g.dispose();
    defaultIcon = new ImageIcon(image);
   
    // Active, selected
    // Icon does not copy the image, so we need a new one
    BufferedImage image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
View Full Code Here

    // Draw the tick
    BasicStroke stroke = new BasicStroke(2);
    g.setStroke(stroke);
    g.setColor(style.getShadowColor());
    drawTick(g, insets);
    g.dispose();
    defaultSelectedIcon = new ImageIcon(image2);
   
    // Inactive, not selected
    image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image2.createGraphics();
View Full Code Here

    g = image2.createGraphics();
    g.setColor(style.getShadowColor());
    g.fillRect(0, 0, ICON_WIDTH, ICON_WIDTH);
    g.setClip(0, 0, ICON_WIDTH, ICON_WIDTH);
    border.paintBorder(null, g, 0, 0, ICON_WIDTH, ICON_WIDTH);
    g.dispose();
    disabledIcon = new ImageIcon(image2);
   
    // Inactive, selected
    image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image.createGraphics();
View Full Code Here

    // Copy unselected image
    g.drawImage(image2, 0, 0, null);
    g.setStroke(stroke);
    g.setColor(style.getHighLightColor());
    drawTick(g, insets);
    g.dispose();
    disabledSelectedIcon = new ImageIcon(image);
  }
 
  /**
   * Draw selection marker.
View Full Code Here

    Graphics2D g = image.createGraphics();
    template.draw(g, 0, 0);
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
    g.setColor(color);
    g.fillRect(0, 0, width, height);
    g.dispose();
   
    return image;
  }
 
  public Insets getBorderInsets(Component component) {
View Full Code Here

      style.getBackground().draw(g, 0, 0);
      g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
    }
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, TITLEBAR_HEIGHT, TITLEBAR_HEIGHT);
    g.dispose();
   
    return image;
  }
 
  /**
 
View Full Code Here

        BufferedImage tmp = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = tmp.createGraphics();
        g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g2.drawImage(ret, 0, 0, w, h, null);
        g2.dispose();

        ret = tmp;
       
       
      } while (w != scaledWidth || h != scaledHeight);
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.