本文整理匯總了Java中com.jess.arms.utils.DrawableProvider.getReSizeBitmap方法的典型用法代碼示例。如果您正苦於以下問題:Java DrawableProvider.getReSizeBitmap方法的具體用法?Java DrawableProvider.getReSizeBitmap怎麽用?Java DrawableProvider.getReSizeBitmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jess.arms.utils.DrawableProvider
的用法示例。
在下文中一共展示了DrawableProvider.getReSizeBitmap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: blur
import com.jess.arms.utils.DrawableProvider; //導入方法依賴的package包/類
public static void blur(Bitmap bkg, View view) {
long startMs = System.currentTimeMillis();
float radius = 15;
float scaleFactor = 8;
//放大到整個view的大小
bkg = DrawableProvider.getReSizeBitmap(bkg, view.getMeasuredWidth(), view.getMeasuredHeight());
Bitmap overlay = Bitmap.createBitmap((int) (view.getMeasuredWidth() / scaleFactor)
, (int) (view.getMeasuredHeight() / scaleFactor), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(overlay);
canvas.translate(-view.getLeft() / scaleFactor, -view.getTop() / scaleFactor);
canvas.scale(1 / scaleFactor, 1 / scaleFactor);
Paint paint = new Paint();
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
canvas.drawBitmap(bkg, 0, 0, paint);
overlay = FastBlur.doBlur(overlay, (int) radius, true);
view.setBackgroundDrawable(new BitmapDrawable(UiUtils.getResources(), overlay));
Log.w("test", "cost " + (System.currentTimeMillis() - startMs) + "ms");
}
示例2: blurBitmap
import com.jess.arms.utils.DrawableProvider; //導入方法依賴的package包/類
public static Bitmap blurBitmap(Bitmap bkg, int width, int height) {
long startMs = System.currentTimeMillis();
float radius = 15;//越大模糊效果越大
float scaleFactor = 8;
//放大到整個view的大小
bkg = DrawableProvider.getReSizeBitmap(bkg, width, height);
Bitmap overlay = Bitmap.createBitmap((int) (width / scaleFactor)
, (int) (height / scaleFactor), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(overlay);
canvas.scale(1 / scaleFactor, 1 / scaleFactor);
Paint paint = new Paint();
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
canvas.drawBitmap(bkg, 0, 0, paint);
overlay = FastBlur.doBlur(overlay, (int) radius, true);
Log.w("test", "cost " + (System.currentTimeMillis() - startMs) + "ms");
return overlay;
}