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


Java FastBlur類代碼示例

本文整理匯總了Java中jp.wasabeef.fresco.processors.internal.FastBlur的典型用法代碼示例。如果您正苦於以下問題:Java FastBlur類的具體用法?Java FastBlur怎麽用?Java FastBlur使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FastBlur類屬於jp.wasabeef.fresco.processors.internal包,在下文中一共展示了FastBlur類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: process

import jp.wasabeef.fresco.processors.internal.FastBlur; //導入依賴的package包/類
@Override public void process(Bitmap dest, Bitmap source) {

    int width = source.getWidth();
    int height = source.getHeight();
    int scaledWidth = width / sampling;
    int scaledHeight = height / sampling;

    Bitmap blurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(blurredBitmap);
    canvas.scale(1 / (float) sampling, 1 / (float) sampling);
    Paint paint = new Paint();
    paint.setFlags(Paint.FILTER_BITMAP_FLAG);
    canvas.drawBitmap(source, 0, 0, paint);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      try {
        blurredBitmap = RSBlur.blur(context, blurredBitmap, radius);
      } catch (android.renderscript.RSRuntimeException e) {
        blurredBitmap = FastBlur.blur(blurredBitmap, radius, true);
      }
    } else {
      blurredBitmap = FastBlur.blur(blurredBitmap, radius, true);
    }

    Bitmap scaledBitmap =
        Bitmap.createScaledBitmap(blurredBitmap, dest.getWidth(), dest.getHeight(), true);
    blurredBitmap.recycle();

    super.process(dest, scaledBitmap);
  }
 
開發者ID:CarGuo,項目名稱:FrescoUtils,代碼行數:32,代碼來源:BlurPostprocessor.java

示例2: process

import jp.wasabeef.fresco.processors.internal.FastBlur; //導入依賴的package包/類
@Override public void process(Bitmap dest, Bitmap source) {

    int width = source.getWidth();
    int height = source.getHeight();
    int scaledWidth = width / sampling;
    int scaledHeight = height / sampling;

    Bitmap blurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(blurredBitmap);
    canvas.scale(1 / (float) sampling, 1 / (float) sampling);
    Paint paint = new Paint();
    paint.setFlags(Paint.FILTER_BITMAP_FLAG);
    canvas.drawBitmap(source, 0, 0, paint);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      try {
        blurredBitmap = RSBlur.blur(context, blurredBitmap, radius);
      } catch (android.renderscript.RSRuntimeException e) {
        blurredBitmap = FastBlur.blur(blurredBitmap, radius, true);
      }
    } else {
      blurredBitmap = FastBlur.blur(blurredBitmap, radius, true);
    }

    Bitmap scaledBitmap =
        Bitmap.createScaledBitmap(blurredBitmap, dest.getWidth(), dest.getHeight(), true);
    blurredBitmap.recycle();

    super.process(dest, scaledBitmap);
  }
 
開發者ID:wasabeef,項目名稱:fresco-processors,代碼行數:32,代碼來源:BlurPostprocessor.java


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