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


Java RSBlur類代碼示例

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


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

示例1: transform

import jp.wasabeef.glide.transformations.internal.RSBlur; //導入依賴的package包/類
@Override
public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) {
  Bitmap source = resource.get();

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

  Bitmap bitmap = mBitmapPool.get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
  if (bitmap == null) {
    bitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
  }

  Canvas canvas = new Canvas(bitmap);
  canvas.scale(1 / (float) mSampling, 1 / (float) mSampling);
  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 {
      bitmap = RSBlur.blur(mContext, bitmap, mRadius);
    } catch (RSRuntimeException e) {
      bitmap = FastBlur.blur(bitmap, mRadius, true);
    }
  } else {
    bitmap = FastBlur.blur(bitmap, mRadius, true);
  }

  return BitmapResource.obtain(bitmap, mBitmapPool);
}
 
開發者ID:open-android,項目名稱:Glide-transformations,代碼行數:33,代碼來源:BlurTransformation.java

示例2: transform

import jp.wasabeef.glide.transformations.internal.RSBlur; //導入依賴的package包/類
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
    @NonNull Bitmap toTransform, int outWidth, int outHeight) {

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

  Bitmap bitmap = pool.get(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);

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

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

  return bitmap;
}
 
開發者ID:wasabeef,項目名稱:glide-transformations,代碼行數:29,代碼來源:BlurTransformation.java


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