Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    /**
     * Rotate the image
     * @param bm source bitmap
     * @param rotation degree of rotation
     * @return return the rotated bitmap
     */
    public static Bitmap rotateImage(Bitmap bm, int rotation) {
        Matrix matrix = new Matrix();
        matrix.postRotate(rotation);
        return Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
    }
}