Java BufferedImage Rotate rotate(BufferedImage img, int b, int a, int angle)

Here you can find the source of rotate(BufferedImage img, int b, int a, int angle)

Description

rotate

License

Open Source License

Declaration

public static Image rotate(BufferedImage img, int b, int a, int angle) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;
import java.awt.image.*;

public class Main {
    public static Image rotate(BufferedImage img, int b, int a, int angle) {
        int w = img.getWidth();
        int h = img.getHeight();
        BufferedImage dimg = new BufferedImage(w, h, img.getType());
        Graphics2D g = dimg.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
                RenderingHints.VALUE_ANTIALIAS_ON);
        g.rotate(Math.toRadians(angle), w / 2, h / 2);
        g.drawImage(img, null, 0, 0);/*w  ww .j a va2s.  c o m*/
        return dimg;
    }
}

Related

  1. rotate(BufferedImage image, int degrees)
  2. rotate(BufferedImage img, int angle)
  3. rotate(BufferedImage img, int angle)
  4. rotate(BufferedImage img, int angle)
  5. rotate(BufferedImage img, int angle)
  6. rotate(BufferedImage source, int angle)
  7. rotate(BufferedImage src)
  8. rotate(final BufferedImage image, final int angle)
  9. rotate(Graphics2D g, BufferedImage newImg, int x, int y, int width, int height, int angle, int originX, int originY)