Example usage for android.graphics Matrix postRotate

List of usage examples for android.graphics Matrix postRotate

Introduction

In this page you can find the example usage for android.graphics Matrix postRotate.

Prototype

public boolean postRotate(float degrees) 

Source Link

Document

Postconcats the matrix with the specified rotation.

Usage

From source file:Main.java

public static WeakReference<Bitmap> rotateBitmap(WeakReference<Bitmap> bitmap, int degress) {
    if (bitmap == null || bitmap.get() == null)
        return null;
    Matrix m = new Matrix();
    m.postRotate(degress);
    return new WeakReference<Bitmap>(Bitmap.createBitmap(bitmap.get(), 0, 0, bitmap.get().getWidth(),
            bitmap.get().getHeight(), m, true));
}

From source file:Main.java

public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);//from  w  w w . j  ava 2 s.c  o  m
    return resizedBitmap;
}

From source file:Main.java

public static Bitmap rotateImage(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);/*from  w w  w.  j a  va 2  s . c om*/
    return resizedBitmap;
}

From source file:Main.java

/**
 * Post rotates the matrix and bounds for the given bounds and degrees.
 *///from   w  ww  .  java  2  s .  c  o m
public static void postRotateMatrix(float degrees, RectF bounds, Matrix matrix) {
    matrix.postRotate(degrees);
    matrix.mapRect(bounds);
    matrix.postTranslate(-bounds.left, -bounds.top);
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, int degress, boolean needRecycle) {
    Matrix m = new Matrix();
    m.postRotate(degress);
    Bitmap bm = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
    if (needRecycle) {
        bitmap.recycle();/*from ww w.  j  a v a  2  s . c  o m*/
    }
    return bm;
}

From source file:Main.java

public static Bitmap rotaingBitmap(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);/*www . j a  va  2 s .  com*/
    return resizedBitmap;
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, int rotation) {
    Matrix matrix = new Matrix();
    matrix.postRotate(rotation);
    Bitmap rotatedbitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);// w  w  w .j a v  a2 s. c o  m
    return rotatedbitmap;
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap srcBitmap, int rotate) {
    Bitmap rotateBitmap = null;/*from w  w  w.  j  av  a 2 s.  c om*/
    Matrix matrix = new Matrix();
    matrix.postRotate(rotate);
    rotateBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), matrix,
            true);
    return rotateBitmap;
}

From source file:Main.java

public static Bitmap flipBitmap(Bitmap bm) {
    Matrix matrix = new Matrix();
    matrix.postRotate(90);
    int width = bm.getWidth();
    int height = bm.getHeight();
    bm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);
    return bm;//from w w w . j av  a2s . co  m
}

From source file:Main.java

private static Bitmap rotateBitmap(Bitmap bmp, int degrees) {
    Matrix matrix = new Matrix();
    matrix.postRotate(degrees);

    Bitmap newBmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
    bmp.recycle();//from  w  w w  .j  a va2s  .  c o  m

    return newBmp;
}