Here you can find the source of rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY)
public static void rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; public class Main { public static void rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY) { AffineTransform tmp = g.getTransform(); AffineTransform trans = new AffineTransform(); trans.rotate(angle, x + originX, y + originY); g.transform(trans);/*from ww w .j a va 2s. c o m*/ g.drawImage(newImg, x, y, width, height, null); g.setTransform(tmp); } }