List of usage examples for android.graphics Matrix Matrix
public Matrix()
From source file:Main.java
private static Bitmap rotate(Bitmap bm, int rotation) { if (rotation != 0) { Matrix matrix = new Matrix(); matrix.postRotate(rotation);/*from ww w . j av a 2 s . co m*/ Bitmap bmOut = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true); return bmOut; } return bm; }
From source file:Main.java
public static Bitmap rotateImage(Bitmap bmp, int degrees) { if (degrees != 0) { Matrix matrix = new Matrix(); matrix.postRotate(degrees);/* ww w .j a va2s .co m*/ return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true); } return bmp; }
From source file:Main.java
public static Bitmap rotateBitmap(Bitmap bitmap, int degrees) { if (degrees == 0) { return bitmap; }/*from ww w . java 2s . c o m*/ Matrix matrix = new Matrix(); matrix.postRotate(degrees); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); }
From source file:Main.java
public static Bitmap rotateImage(Bitmap input, int rotation) { // rotate Image Matrix rotateMatrix = new Matrix(); rotateMatrix.postRotate(rotation);/*from w w w .jav a2 s.c om*/ Bitmap rotatedBitmap = Bitmap.createBitmap(input, 0, 0, input.getWidth(), input.getHeight(), rotateMatrix, false); return rotatedBitmap; }
From source file:Main.java
public static Bitmap rotateImageView(int angle, Bitmap bitmap) { if (bitmap == null) return null; Matrix matrix = new Matrix(); matrix.postRotate(angle);// w w w . ja v a2s .c o m Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); if (bitmap != null && !bitmap.isRecycled()) { bitmap = null; } // bitmap.recycle(); return resizedBitmap; }
From source file:Main.java
public static Bitmap scale(Bitmap bitmap, float scale) { Matrix matrix = new Matrix(); matrix.postScale(scale, scale);/*from w w w. j a v a2s . c om*/ Bitmap outBitmap = Bitmap.createBitmap(bitmap, 0, 0, (int) (bitmap.getWidth()), (int) (bitmap.getHeight()), matrix, true); bitmap.recycle(); return outBitmap; }
From source file:Main.java
public static Bitmap ScaleAndRotateBitmap(Bitmap bitmap, int rotation, int flipHorizontal) { Matrix m = new Matrix(); if (flipHorizontal != 0) { m.postScale(-1, 1);// w ww . j a va 2s . c o m } if (rotation != 0) { m.postRotate(rotation); } Bitmap finalBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); if (finalBitmap != bitmap) { bitmap.recycle(); } return finalBitmap; }
From source file:Main.java
public static Bitmap handRotateBitmap(Bitmap bitmap, int degree) { if (null != bitmap) { Matrix m = new Matrix(); m.postRotate(degree);//from w ww .j av a 2 s . com bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); return bitmap; } return bitmap; }
From source file:Main.java
public static Bitmap rotateImage(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle);// w w w . j ava2 s . c o m return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); }
From source file:Main.java
public static Matrix getRotateMatrix(String s) { Matrix matrix = new Matrix(); String s1 = getPicOrientation(s); if (s1.equals("3")) matrix.setRotate(180F);//from w w w . j a v a2s . c o m else if (s1.equals("6")) matrix.setRotate(90F); else if (s1.equals("8")) matrix.setRotate(270F); else matrix.setRotate(0.0F); return matrix; }