Java BufferedImage Rotate rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY)

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)

Description

rotate

License

Open Source License

Declaration

public static void rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle,
            int originX, int originY) 

Method Source Code


//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);
    }
}

Related

  1. rotate(BufferedImage img, int angle)
  2. rotate(BufferedImage img, int b, int a, int angle)
  3. rotate(BufferedImage source, int angle)
  4. rotate(BufferedImage src)
  5. rotate(final BufferedImage image, final int angle)
  6. rotate90(BufferedImage bi)
  7. rotate90(BufferedImage img, boolean left)
  8. rotate90ToRight(BufferedImage inputImage)
  9. rotateAndFlipSwappingRowsAndColumns(BufferedImage srcImage)