Package java.awt.image

Examples of java.awt.image.BufferedImage.createGraphics()


    final int height = template.getHeight();
   
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    final BufferedImage image = gc.createCompatibleImage(width, height, Transparency.OPAQUE);
   
    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();
View Full Code Here


   * @param gc
   * @return image background image
   */
  private static Image createIconBackground(GraphicsConfiguration gc) {
    BufferedImage image = gc.createCompatibleImage(TITLEBAR_HEIGHT, TITLEBAR_HEIGHT, Transparency.OPAQUE);
    Graphics2D g = image.createGraphics();
    /*
     * Use proper style if defined. If someone's using a different theme we
     * don't have a nice background, but the client should not crash anyway.
     * Those get just a white background.
     */
 
View Full Code Here

   */
  private void calculateSizes() {
    this.prefferedSize = new Dimension();
    final BufferedImage image = new BufferedImage(100, 100,
        BufferedImage.TYPE_INT_RGB);
    final Graphics2D g2d = image.createGraphics();
    g2d.setFont(font);
    final FontMetrics metrics = g2d.getFontMetrics();
    this.lineHeight = metrics.getHeight();
    this.prefferedSize.height = this.lineHeight * 8;
    for (String s : text) {
View Full Code Here

    // Image used as the template for the icons
    final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    BufferedImage image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
   
    // Active, not selected
    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();
View Full Code Here

    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);
    g = image2.createGraphics();
    // Copy the old image to the background
    g.drawImage(image, 0, 0, null);
    // Draw the tick
    BasicStroke stroke = new BasicStroke(2);
    g.setStroke(stroke);
View Full Code Here

    g.dispose();
    defaultSelectedIcon = new ImageIcon(image2);
   
    // Inactive, not selected
    image2 = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    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();
View Full Code Here

            h = scaledHeight;
          }
        }

        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;
View Full Code Here

    imageFile.close();

    if (d != null)
    {
      BufferedImage bufferedResizedImage = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
      Graphics2D g2d = bufferedResizedImage.createGraphics();
      g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      g2d.drawImage(image, 0, 0, d.width, d.height, null);
      g2d.dispose();
      image = bufferedResizedImage;
View Full Code Here

            border = DEFAULT_BORDER;
        }

        final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

        final Graphics2D g = image.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        final int startPixel, endPixel;
        if (range.compareTo(new BigDecimal(0)) == 0) {//No range, Min=Max
            //Fill all drawing area:
View Full Code Here

          h = targetHeight;
        }
      }

      BufferedImage tmp = new BufferedImage(w, h, type);
      Graphics2D g2 = tmp.createGraphics();
      g2.setRenderingHint(java.awt.RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
      g2.drawImage(ret, 0, 0, w, h, null);
      g2.dispose();

      ret = tmp;
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.