Android Bitmap Rotate rotate(Bitmap bitmap, int degree)

Here you can find the source of rotate(Bitmap bitmap, int degree)

Description

rotate

Declaration

public static Bitmap rotate(Bitmap bitmap, int degree) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.Matrix;

public class Main {
    public static Bitmap rotate(Bitmap bitmap, int degree) {
        int w = bitmap.getWidth();
        int h = bitmap.getHeight();

        Matrix mtx = new Matrix();
        mtx.postRotate(degree);// w  w w.  ja  v  a2 s  . c  om

        Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx,
                true);
        bitmap.recycle();
        return rotatedBitmap;
    }
}

Related

  1. fixBitmapOrientation(Uri uri, Bitmap bmp)
  2. rotate(Bitmap b, int degrees)
  3. rotateAndMirror(Bitmap b, int degrees, boolean mirror)
  4. rotateBitmap(Bitmap b, int degrees)
  5. rotateBitmap(Bitmap source, float angle)
  6. rotateBitmap(Bitmap source, int rotation, boolean recycle)