Android Utililty Methods Bitmap Rotate

List of utility methods to do Bitmap Rotate

Description

The list of methods to do Bitmap Rotate are organized into topic(s).

Method

BitmapgetRotatedBitmap(Bitmap bitmap, int degrees)
get Rotated Bitmap
if (degrees != 0 && bitmap != null) {
    Matrix m = new Matrix();
    m.setRotate(degrees, (float) bitmap.getWidth() / 2,
            (float) bitmap.getHeight() / 2);
    try {
        Bitmap b2 = Bitmap.createBitmap(bitmap, 0, 0,
                bitmap.getWidth(), bitmap.getHeight(), m, true);
        if (bitmap.equals(b2)) {
...
BitmaprotateBitmap(Bitmap bitmap, float degrees)
rotate Bitmap
Bitmap mBitmap = null;
try {
    Matrix m = new Matrix();
    m.setRotate(degrees % 360);
    mBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(),
            bitmap.getHeight(), m, false);
} catch (Exception e) {
    e.printStackTrace();
...
BitmaprotateBitmapTranslate(Bitmap bitmap, float degrees)
rotate Bitmap Translate
Bitmap mBitmap = null;
int width;
int height;
try {
    Matrix matrix = new Matrix();
    if ((degrees / 90) % 2 != 0) {
        width = bitmap.getWidth();
        height = bitmap.getHeight();
...
BitmapcreateRotatedBitmap(Bitmap bm, float degree)
create Rotated Bitmap
Bitmap bitmap = null;
if (degree != 0) {
    Matrix matrix = new Matrix();
    matrix.preRotate(degree);
    bitmap = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),
            bm.getHeight(), matrix, true);
return bitmap;
...
BitmapRotateBitmap(Bitmap source, float angle)
Rotate Bitmap
Matrix matrix = new Matrix();
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(),
        source.getHeight(), matrix, true);