List of usage examples for android.graphics Matrix Matrix
public Matrix()
From source file:Main.java
public static Bitmap rotateImage(Bitmap bitmap, int rotate) { if (rotate != 0) { // rotate Matrix m = new Matrix(); m.postRotate(rotate);/*from ww w .java 2 s . c o m*/ Bitmap rotImage = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); bitmap.recycle(); System.gc(); return rotImage; } return bitmap; }
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);//from w ww . ja v a 2 s .c om mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true); } return mBitmap; }
From source file:Main.java
public static Bitmap rotateBitmap(Bitmap bitmap, int degress, boolean needRecycle) { Matrix m = new Matrix(); m.postRotate(degress);// ww w.j av a 2s .co m Bitmap bm = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); if (needRecycle) { bitmap.recycle(); } return bm; }
From source file:Main.java
public static Bitmap scale(Bitmap org, float xRate, float yRate) { final int orgWidth = org.getWidth(); final int orgHeight = org.getHeight(); Matrix matrix = new Matrix(); matrix.postScale(xRate, yRate);/* w ww .j av a 2 s . co m*/ return Bitmap.createBitmap(org, 0, 0, orgWidth, orgHeight, matrix, true); }
From source file:Main.java
public static Bitmap rotateBitmap(Bitmap b, float rotateDegree) { if (b == null) { return null; }//w w w. j a v a 2 s . com 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 big(Bitmap bitmap, float scale) { if (bitmap == null) { return null; }// ww w . ja v a 2 s . com Matrix matrix = new Matrix(); matrix.postScale(scale, scale); Bitmap resizeBmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); if (!bitmap.isRecycled()) { bitmap.recycle(); } return resizeBmp; }
From source file:Main.java
public static Bitmap rotateImage(Bitmap source, float angle) { Bitmap retVal;// w w w .ja v a 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; }
From source file:Main.java
public static Bitmap scaleExistingBitmap(Bitmap bm, float scaleWidth, float scaleHeight) { int width = bm.getWidth(); int height = bm.getHeight(); Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap; }
From source file:Main.java
private static Bitmap getBitmap(Bitmap bitmap) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); Matrix matrix = new Matrix(); matrix.setScale(0.5f, 0.5f);//from ww w . j a v a 2s.c o m bitmap = Bitmap.createBitmap(bitmap, width / 2 - 10, height / 3 - 10, width / 2 + 10, height / 3 + 10, matrix, true); return bitmap; }
From source file:Main.java
private static Bitmap rotate(Bitmap bmp, int rotation) { if (rotation == 0) return bmp; try {//w ww . j a va2s . com Matrix matrix = new Matrix(); matrix.preRotate(rotation); return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true); } finally { bmp.recycle(); } }