Package java.awt.image

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


           // create a BufferedImage of only 1 pixel height for fetching the rows
           // of the image in the correct format (ARGB)
           // This speeds up things by more than factor 2, compared to the standard
           // BufferedImage.getRGB solution
           BufferedImage row = new BufferedImage(width, 1, BufferedImage.TYPE_INT_ARGB);
           Graphics2D g2d = row.createGraphics();
           int pixels[] = ((DataBufferInt) row.getRaster().getDataBuffer()).getData();
           // make sure alpha values do not add up for each row:
           g2d.setComposite(AlphaComposite.Src);
           // calculate scanline by scanline in order to safe memory.
           // It also seems to run faster like that
View Full Code Here


               // create a BufferedImage of only 1 pixel height for fetching
               // the rows of the image in the correct format (ARGB)
               // This speeds up things by more than factor 2, compared to the
               // standard BufferedImage.getRGB solution
               BufferedImage row = new BufferedImage(width, 1, BufferedImage.TYPE_INT_ARGB);
               Graphics2D g2d = row.createGraphics();
               int pixels[] = ((DataBufferInt) row.getRaster().getDataBuffer()).getData();
               // make sure alpha values do not add up for each row:
               g2d.setComposite(AlphaComposite.Src);
               // calculate scanline by scanline in order to safe memory.
               // It also seems to run faster like that
View Full Code Here

    InputStream inImg = saver.read(ctx, imgURL);
    BufferedImage old_img = (BufferedImage)ImageIO.read(inImg)
    int width = old_img.getWidth();
    int height = old_img.getHeight();
    BufferedImage new_img = new BufferedImage(height,width,BufferedImage.TYPE_INT_RGB);       
        Graphics2D g2d =new_img.createGraphics();
       
        AffineTransform origXform = g2d.getTransform();
        AffineTransform newXform = (AffineTransform)(origXform.clone());
        // center of rotation is center of the panel
    double radian = 0;
View Full Code Here

    BufferedImage old_img = (BufferedImage)ImageIO.read(img)
    int width = old_img.getWidth();
    int height = old_img.getHeight();
   
    BufferedImage new_img = new BufferedImage(height,width,BufferedImage.TYPE_INT_BGR);       
        Graphics2D g2d =new_img.createGraphics();
       
        AffineTransform origXform = g2d.getTransform();
        AffineTransform newXform = (AffineTransform)(origXform.clone());
        // center of rotation is center of the panel
        double xRot = width/2.0;
View Full Code Here

  public LineButton() {
    super();
   
    BufferedImage image = new BufferedImage(22, 22, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    g2.setColor(new Color(255,0,0,0));
    g2.fillRect(0, 0, 22, 22);
   
    g2.setColor(getForeground());
    g2.drawLine(0, 11, 22, 11);
View Full Code Here

  throws IOException {
    boolean opaqueValue = component.isOpaque();
    component.setOpaque( true );
    BufferedImage image = new BufferedImage(region.width,
        region.height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = image.createGraphics();
    g2d.translate(-region.getX(), -region.getY());
    //g2d.setClip( region );
    component.paint( g2d );
    g2d.dispose();
    component.setOpaque( opaqueValue );
View Full Code Here

            BufferedImage bufImage = new BufferedImage(
                    image.getWidth(null),
                    image.getHeight(null),
                    BufferedImage.TYPE_INT_ARGB);

            Graphics g = bufImage.createGraphics();
            g.drawImage(image, 0, 0, null);
            return bufImage;
        }
    }
}
View Full Code Here

    // Create a buffered image in which to draw
    BufferedImage bufferedImage = new BufferedImage(width, height,
        BufferedImage.TYPE_INT_ARGB);

    // Create a graphics contents on the buffered image
    Graphics2D g2d = bufferedImage.createGraphics();

    g2d.drawImage(img, 0, 0, null);

    // Graphics context no longer needed so dispose it
    g2d.dispose();
View Full Code Here

    }
    try {
      // Create Image with Icon
      BufferedImage iconImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(),
          BufferedImage.TYPE_INT_ARGB);
      Graphics2D g2 = iconImage.createGraphics();
      g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
          RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      g2.setRenderingHint(RenderingHints.KEY_RENDERING,
          RenderingHints.VALUE_RENDER_QUALITY);
      AffineTransform z = g2.getTransform();
View Full Code Here

    // Scale Image
    Image image = img.getScaledInstance(width, height, Image.SCALE_SMOOTH);

    BufferedImage im = new BufferedImage(width, height, type);

    Graphics2D g2 = im.createGraphics();
    if (backgroundColor != null) {
      g2.setColor(backgroundColor);
      g2.fillRect(0, 0 , width, height);
    }
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.