当前位置: 首页>>代码示例>>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;未经允许,请勿转载。