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

public static Matrix getScaleMatrix(float toWidth, int fromWidth, float toHeight, int fromHeight) {
    Matrix matrix = new Matrix();
    matrix.postScale(toWidth / fromWidth, toHeight / fromHeight);
    return matrix;
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, float angle) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);/*from  w w w  .j  a v a  2  s.c  o m*/
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap rotateImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);//  w w w .j a v a 2  s.  com
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap showPicture(Bitmap myBitmap, int rot) {
    Matrix matrix = new Matrix();
    matrix.postRotate(rot);//from   w w  w  .j  a v a2  s . co  m

    Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, 320, 320, true);
    return Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix,
            true);
}

From source file:Main.java

public static Bitmap zoom(Bitmap source, float wf, float hf) {
    Matrix matrix = new Matrix();
    float sx = wf / source.getWidth();
    float sy = hf / source.getHeight();
    matrix.postScale(sx, sy);/*ww  w.j  av a 2s  .  c  o  m*/
    return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
}

From source file:Main.java

private static Bitmap rotateImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);//  ww  w  .j  a  v  a 2  s  . com
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap rotaingBitmap(float degree, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(degree);/*ww  w. j  a  va  2 s . c  om*/
    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}

From source file:Main.java

public static Bitmap rotateBitmap(Bitmap bitmap, int rotation) {
    Matrix matrix = new Matrix();
    matrix.preRotate(rotation);//  w  w  w.j  av  a2s. c  o  m
    Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);
    return rotatedBitmap;
}

From source file:Main.java

public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);/* w  w w. j  ava2s .  c om*/
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix,
            true);
    return resizedBitmap;
}

From source file:Main.java

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