Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap rotateBitmapDegree(Bitmap bm, int degree) {
        Bitmap returnBm;
        int w = bm.getWidth();
        int h = bm.getHeight();

        Matrix matrix = new Matrix();
        matrix.postRotate(degree);

        returnBm = Bitmap.createBitmap(bm, 0, 0, w, h, matrix, true);

        if (bm != returnBm) {
            bm.recycle();
        }

        return returnBm;
    }
}