Bitmap Rotate - Android Graphics

Android examples for Graphics:Bitmap Rotate

Description

Bitmap Rotate

Demo Code


//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Matrix;

public class Main {
    public static Bitmap BitmapRotate(Bitmap bm, int rotate) {
        Bitmap bitmap = null;/*from ww  w . j a v a2s  .c o  m*/
        Matrix matrix = new Matrix();
        matrix.postRotate(rotate);
        final int widthOrig = bm.getWidth();
        final int heightOrig = bm.getHeight();
        bitmap = Bitmap.createBitmap(bm, 0, 0, widthOrig, heightOrig,
                matrix, true);
        return bitmap;
    }
}

Related Tutorials