Android examples for Graphics:Bitmap Transform
transform Bitmap
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; import android.support.annotation.NonNull; import android.util.Log; public class Main { private static final String TAG = "BitmapLoadUtils"; public static Bitmap transformBitmap(@NonNull Bitmap bitmap, @NonNull Matrix transformMatrix) { try {// w w w . j av a2 s .c om Bitmap converted = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), transformMatrix, true); if (bitmap != converted) { bitmap.recycle(); bitmap = converted; } } catch (OutOfMemoryError error) { Log.e(TAG, "transformBitmap: ", error); } return bitmap; } }