Java Draw Image drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)

Here you can find the source of drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)

Description

draw Image

License

Apache License

Declaration

public static void drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;

public class Main {
    public static void drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h) {
        if (w == -1)
            w = (int) (srcImg.getWidth() / 2);
        if (h == -1)
            h = (int) (srcImg.getHeight() / 2);
        System.out.println("AWT Image Wt: " + w + " And Ht: " + h);
        Graphics2D g2 = srcImg.createGraphics();
        g2.drawImage(img2Draw, w, h, null);
        g2.dispose();//from ww  w.j  a v a  2 s  . com
    }
}

Related

  1. drawCenterCrop(Graphics2D g, BufferedImage source, Rectangle dstRect)
  2. drawCenteredImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer, int imageWidth, int imageHeight, boolean shrink)
  3. DrawCross(BufferedImage bi, Point pt)
  4. drawImage(BufferedImage bi, RenderedImage im)
  5. drawImage(BufferedImage originalImage, BufferedImage scaledImage, int width, int height)
  6. drawImage(BufferedImage target, Point targetPoint, BufferedImage source)
  7. drawImage(final Graphics2D graphics, final Image image, final Rectangle rectangle)
  8. drawImage(Graphics g, BufferedImage im, Rectangle dst, Rectangle src)
  9. drawImage(Graphics graphics, Component comp, Image image)