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

/**
 * @param b/*from ww  w.  j a  va 2  s .c  o  m*/
 * @param rotateDegree
 * @return
 */
public static Bitmap getRotateBitmap(Bitmap b, float rotateDegree) {
    Matrix matrix = new Matrix();
    matrix.postRotate(rotateDegree);
    int width = b.getWidth();
    int height = b.getHeight();
    return Bitmap.createBitmap(b, 0, 0, width, height, matrix, false);
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, int rotate) {
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();

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

    return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, false);
}

From source file:Main.java

/**
 * Method to rotate a Bitmap specifying the angle.
 *
 * @param source The original Bitmap.//from  w  ww  .  ja v a 2s .  c om
 * @param angle  float that represents the rotation angle.
 * @return The rotated Bitmap.
 */
public static Bitmap rotate(Bitmap source, float angle) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
}

From source file:Main.java

private static Bitmap rotateBitmap(Bitmap bitmap, int rotate) {
    if (bitmap == null) {
        return null;
    }//from  w  w w .j a  v  a 2 s. co  m
    int w = bitmap.getWidth();
    int h = bitmap.getHeight();

    Matrix mtx = new Matrix();
    mtx.postRotate(rotate);
    return Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, true);
}

From source file:Main.java

public static Bitmap rotateImage(Bitmap bmp, int degrees) {
    if (degrees != 0) {
        Matrix matrix = new Matrix();
        matrix.postRotate(degrees);
        return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
    }/*from   w w w.j  ava 2s  .  c o m*/
    return bmp;
}

From source file:Main.java

/**
 * Method using rotate photo.//w w w. j  a  v  a 2 s. c om
 *
 * @param bitmap Value bitmap current.
 * @param angle  Value angle.
 * @return Bitmap.
 */
private static Bitmap rotateImage(Bitmap bitmap, float angle) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);

    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap roateImage(Bitmap mBitmap, float degree) {
    if (mBitmap.getWidth() > mBitmap.getHeight()) {
        Matrix matrix = new Matrix();
        matrix.postRotate(degree);
        mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);
    }/*ww  w.ja  v a2s.  co m*/
    return mBitmap;
}

From source file:Main.java

/**
 * Rotate the bitmap with the specif angle
 *
 * @param angle//  w w w  . ja  v a 2  s.  c o  m
 * @param bitmap
 * @return Bitmap
 */
public static Bitmap rotateImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    System.out.println("angle2=" + angle);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap postRotateBitamp(Bitmap bmp, float degree) {

    int bmpWidth = bmp.getWidth();
    int bmpHeight = bmp.getHeight();

    Matrix matrix = new Matrix();
    matrix.postRotate(degree);
    Bitmap resizeBmp = Bitmap.createBitmap(bmp, 0, 0, bmpWidth, bmpHeight, matrix, true);
    return resizeBmp;
}

From source file:Main.java

public static Bitmap rotate(final Bitmap bitmap, final float winkel) {
    final Matrix matrix = new Matrix();
    matrix.postRotate(winkel);
    final Bitmap rotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);/*from  w w w.j  ava 2  s  . c o m*/
    return rotated;
}