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 Bitmap showPicture(Bitmap myBitmap, int rot) {
    Matrix matrix = new Matrix();
    matrix.postRotate(rot);

    Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, 320, 320, true);
    return Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix,
            true);/* w ww . ja v  a2  s.c  om*/
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, int degrees) {
    if (degrees == 0) {
        return bitmap;
    }//w w w .  j a v  a  2 s .com

    Matrix matrix = new Matrix();
    matrix.postRotate(degrees);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

/**
 *
 * @param source//w ww . jav a2 s  .  co  m
 * @param angle
 * @return
 */
private static Bitmap rotateImage(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

public static Bitmap rotateBitmap(Bitmap sourceBitmap, float angleInDegrees) {
    if (angleInDegrees == 0)
        return sourceBitmap;
    Matrix matrix = new Matrix();
    matrix.postRotate(angleInDegrees);
    return Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(), matrix,
            true);//from w  ww  .j  a  v  a2  s.c  om
}

From source file:Main.java

public static Bitmap getRotatedBitmap(byte[] bildDaten) {
    Bitmap result = BitmapFactory.decodeByteArray(bildDaten, 0, bildDaten.length);
    if (result.getWidth() > result.getHeight()) {
        Matrix m = new Matrix();
        m.postRotate(90);
        result = Bitmap.createBitmap(result, 0, 0, result.getWidth(), result.getHeight(), m, true);
    }//  www .  j  av  a  2  s  . c  o  m
    return result;
}

From source file:Main.java

public static Bitmap rotate(@NonNull final Bitmap bitmap, final float angle) {
    final 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 handRotateBitmap(Bitmap bitmap, int degree) {
    if (null != bitmap) {
        Matrix m = new Matrix();
        m.postRotate(degree);
        bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
        return bitmap;
    }/*from   w  w  w. j  av a  2s.  c o  m*/
    return bitmap;
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap b, float rotateDegree) {
    if (b == null) {
        return null;
    }/*from   w  w  w  . j  a v a2s  . c  o  m*/
    Matrix matrix = new Matrix();
    matrix.postRotate(rotateDegree);
    Bitmap rotaBitmap = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(), matrix, true);
    return rotaBitmap;
}

From source file:Main.java

public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    System.out.println("angle2=" + angle);
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);/* ww  w .  j  a v a 2s  .  c  om*/
    bitmap.recycle();
    return resizedBitmap;
}

From source file:Main.java

public static Bitmap rotateImage(Bitmap source, float angle) {
    Bitmap retVal;/* w ww.  j ava 2s .  c o  m*/

    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    retVal = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);

    return retVal;
}