當前位置: 首頁>>代碼示例>>Java>>正文


Java DrawableProvider.getReSizeBitmap方法代碼示例

本文整理匯總了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");
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:FastBlur.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:FastBlur.java


注:本文中的com.jess.arms.utils.DrawableProvider.getReSizeBitmap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。