Package java.awt.image

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


      //TYPE_BYTE_GRAY //13202
      //TYPE_BYTE_BINARY //13812--
      //TYPE_BYTE_INDEXED //24545
      BufferedImage image = new BufferedImage(scaledWidth, scaledHeight,BufferedImage.TYPE_BYTE_BINARY);
     
      Graphics2D biContext = image.createGraphics();
      biContext.drawImage(img, 0, 0, null);
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
     
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
View Full Code Here


         
          //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();
//         
//          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
View Full Code Here

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

     * @return resized image
     */
    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

        TextLayout layout = new TextLayout(text, font, frc);
        Rectangle2D bounds = layout.getBounds();
        int w = (int) Math.ceil(bounds.getWidth());
        int h = (int) Math.ceil(bounds.getHeight()) + 2;
        BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); //for example;
        Graphics2D g = image.createGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, w, h);
        g.setColor(Color.BLACK);
        g.setFont(font);
        Object antiAliased = isAntiAliased
View Full Code Here

     * @return scaled image
     */
    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

      myView.setZoom(0.0625);
    }

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

    width += 2 * SIDE_MARGIN + IMAGE_PAD;
    height += TOP_MARGIN + BOTTOM_MARGIN;
   
    // Create the background sprite
    final BufferedImage image = gc.createCompatibleImage(width, height, Transparency.BITMASK);
    final Graphics2D g2d = image.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setComposite(AlphaComposite.Src);
    BackgroundPainter bp = new BackgroundPainter(BACKGROUND);
    bp.paint(g2d, width, height);
   
View Full Code Here

   
    final int imageHeight = LINE_HEIGHT * numLines + MARGIN_WIDTH;

    final BufferedImage image = gc.createCompatibleImage(imageWidth, imageHeight, Transparency.BITMASK);

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

    if (fillColor != null) {
      if (isTalking) {
        drawBubble(g2d, fillColor, textColor, imageWidth - BUBBLE_OFFSET, imageHeight);
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.