Java Draw Image drawImage(final Graphics2D graphics, final Image image, final Rectangle rectangle)

Here you can find the source of drawImage(final Graphics2D graphics, final Image image, final Rectangle rectangle)

Description

draw Image

License

Open Source License

Declaration

public static void drawImage(final Graphics2D graphics, final Image image, final Rectangle rectangle) 

Method Source Code

//package com.java2s;
/*/*  ww w.ja  v  a  2 s  .c  o  m*/
 * Copyright ? 2016 spypunk <spypunk@gmail.com>
 *
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 */

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;

public class Main {
    public static void drawImage(final Graphics2D graphics, final Image image, final Rectangle rectangle) {
        final int imageWidth = image.getWidth(null);
        final int imageHeight = image.getHeight(null);

        graphics.drawImage(image, rectangle.x, rectangle.y, rectangle.x + rectangle.width,
                rectangle.y + rectangle.height, 0, 0, imageWidth, imageHeight, null);
    }
}

Related

  1. DrawCross(BufferedImage bi, Point pt)
  2. drawImage(BufferedImage bi, RenderedImage im)
  3. drawImage(BufferedImage originalImage, BufferedImage scaledImage, int width, int height)
  4. drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)
  5. drawImage(BufferedImage target, Point targetPoint, BufferedImage source)
  6. drawImage(Graphics g, BufferedImage im, Rectangle dst, Rectangle src)
  7. drawImage(Graphics graphics, Component comp, Image image)
  8. drawImage(Graphics2D g, BufferedImage image, int x, int y)
  9. drawImage(Graphics2D g2d, BufferedImage image, Rectangle dispArea)