Package java.awt

Examples of java.awt.Graphics2D.drawImage()


          //BufferedImage.TYPE_INT_RGB
          //TYPE_3BYTE_BGR
          BufferedImage image = new BufferedImage(scaledWidth, scaledHeight,BufferedImage.TYPE_3BYTE_BGR);
         
          Graphics2D biContext = image.createGraphics();
          biContext.drawImage(img, 0, 0, null);
         
          ByteArrayOutputStream out = new ByteArrayOutputStream();
         
          ImageWriter writer = ImageIO.getImageWritersByFormatName( "gif" ).next();
            ImageOutputStream ios = ImageIO.createImageOutputStream( out );
View Full Code Here


            BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
           
            Image img = imageScreen.getScaledInstance(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue() ,Image.SCALE_SMOOTH);
            BufferedImage image = new BufferedImage(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue(),BufferedImage.TYPE_INT_RGB);
            Graphics2D biContext = image.createGraphics();
            biContext.drawImage(img, 0, 0, null);
           
            ByteArrayOutputStream out = new ByteArrayOutputStream();
           
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
            JPEGEncodeParam encpar = encoder.getDefaultJPEGEncodeParam(image);
View Full Code Here

                              BufferedImage image_raw = new BufferedImage(width_new, height_new, BufferedImage.TYPE_INT_RGB);   
                             
                             
                              Graphics2D graphics2D = image_raw.createGraphics();
                              graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                              graphics2D.drawImage(image, 0, 0, width_new, height_new, null);
                              graphics2D.dispose();
                               
                              //End resize
                               
                                int scaledWidth = width;
View Full Code Here

     */
    public static BufferedImage resizeImage(BufferedImage image, int width, int height) {
        BufferedImage resizedImage = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g = resizedImage.createGraphics();
        g.drawImage(image, 0, 0, width, height, null);
        g.dispose();

        return resizedImage;
    }

View Full Code Here

     */
    private BufferedImage resizeImage(BufferedImage image, int width, int height) {
        BufferedImage resizedImage = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g = resizedImage.createGraphics();
        g.drawImage(image, 0, 0, width, height, null);
        g.dispose();

        return resizedImage;
    }

View Full Code Here

    g2d.drawString(description, SIDE_MARGIN + IMAGE_PAD + categoryImage.getWidth(), height - BOTTOM_MARGIN);
   
    // 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

    // 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);
    g.setColor(style.getShadowColor());
    drawTick(g, insets);
View Full Code Here

   
    // Inactive, selected
    image = gc.createCompatibleImage(ICON_WIDTH, ICON_WIDTH, Transparency.OPAQUE);
    g = image.createGraphics();
    // 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);
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;
       
       
View Full Code Here

    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;

    }
    if (color != null)
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.