本文整理汇总了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);
}
示例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);
}