Example usage for android.graphics Matrix Matrix

List of usage examples for android.graphics Matrix Matrix

Introduction

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

Prototype

public Matrix() 

Source Link

Document

Create an identity matrix

Usage

From source file:Main.java

private static Bitmap rotateBitmap(Bitmap bmp, int degrees) {
    Matrix matrix = new Matrix();
    matrix.postRotate(degrees);/* w w w  .  ja  v a 2 s  .  c om*/

    Bitmap newBmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
    bmp.recycle();

    return newBmp;
}

From source file:Main.java

public static Bitmap flip(Bitmap src) {
    Matrix m = new Matrix();
    m.preScale(-1, 1);/*from   w  ww . j  av  a 2  s  .  c o m*/
    Bitmap dst = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);
    return dst;
}

From source file:Main.java

private static Matrix configureMatrix(int rotation, int rotationDegrees) {
    Matrix matrix = new Matrix();
    if (rotation != 0f) {
        matrix.preRotate(rotationDegrees);
    }//from w ww. j a va 2s.c o  m
    return matrix;
}

From source file:Main.java

public static Bitmap LoadFliped(Bitmap src) {
    Matrix matrix = new Matrix();
    matrix.preScale(-1.0f, 1.0f);/*from   ww  w.  jav a2  s  .c  o m*/

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

From source file:Main.java

private static Bitmap small(Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postScale(0.8f, 0.8f);/*  w ww .j  av a 2s.  c  o m*/
    Bitmap resizeBmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
    return resizeBmp;
}

From source file:Main.java

public static Bitmap LoadFlipedVertical(Bitmap src) {
    Matrix matrix = new Matrix();
    matrix.preScale(1.0f, -1.0f);/*from  www.j  a va2s .  co  m*/
    return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
}

From source file:Main.java

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

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap) {

    Matrix matrix = new Matrix();
    matrix.postRotate(90f);//from   ww w.  jav a 2s  .  c o m

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

From source file:Main.java

public static Bitmap doScale(Bitmap b, float scale) {
    Matrix matrix = new Matrix();
    matrix.postScale(scale, scale);/*from w  w w  .  ja  v  a2s.c om*/
    b = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(), matrix, true);
    return b;
}

From source file:Main.java

public static Bitmap rotate(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate((float) angle);
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}