List of usage examples for android.graphics Bitmap createBitmap
public static Bitmap createBitmap(@NonNull DisplayMetrics display, @NonNull @ColorInt int[] colors, int offset, int stride, int width, int height, @NonNull Config config)
From source file:Main.java
public static Bitmap getRotateBitmap(Bitmap b, float rotateDegree) { Matrix matrix = new Matrix(); matrix.postRotate((float) rotateDegree); Bitmap rotaBitmap = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(), matrix, false); //add// w w w . ja v a 2 s .co m if (b != null && !b.isRecycled()) { b.recycle(); b = null; } return rotaBitmap; }
From source file:Main.java
public static Bitmap handRotateBitmap(Bitmap bitmap, int degree) { if (null != bitmap) { Matrix m = new Matrix(); m.postRotate(degree);/*w ww .java 2s .co m*/ bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); return bitmap; } return bitmap; }
From source file:Main.java
private static Bitmap rotate(Bitmap bm, int rotation) { if (rotation != 0) { Matrix matrix = new Matrix(); matrix.postRotate(rotation);//from w w w .j a v a2 s .com 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 rotateImageView(int angle, Bitmap bitmap) { if (bitmap == null) return null; Matrix matrix = new Matrix(); matrix.postRotate(angle);/*from w w w. ja v a 2 s . com*/ 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 rotateBitmap(Bitmap srcBitmap, int rotate) { Bitmap rotateBitmap = null;/*from w w w . j a va2 s. c om*/ Matrix matrix = new Matrix(); matrix.postRotate(rotate); rotateBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), matrix, true); return rotateBitmap; }
From source file:Main.java
public static Bitmap flipBitmap(Bitmap bm) { Matrix matrix = new Matrix(); matrix.postRotate(90);/*from w w w.j a v a 2s . 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 scale(Bitmap bitmap, float scale) { Matrix matrix = new Matrix(); matrix.postScale(scale, scale);//from w ww . ja v a 2s. c o m 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 scale(Bitmap src, float scale) { if (src == null) { return null; }//from w w w.j ava 2s . co m Matrix m = new Matrix(); m.setScale(scale, scale); return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, true); }
From source file:Main.java
public static Bitmap rotaingBitmap(int angle, Bitmap bitmap) { Matrix matrix = new Matrix(); matrix.postRotate(angle);//from ww w . j a va2s . co m Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); return resizedBitmap; }
From source file:Main.java
public static Bitmap rotateImage(Bitmap input, int rotation) { // rotate Image Matrix rotateMatrix = new Matrix(); rotateMatrix.postRotate(rotation);/* www .ja va2 s . c om*/ Bitmap rotatedBitmap = Bitmap.createBitmap(input, 0, 0, input.getWidth(), input.getHeight(), rotateMatrix, false); return rotatedBitmap; }