本文整理匯總了Java中jp.wasabeef.fresco.processors.internal.FastBlur.blur方法的典型用法代碼示例。如果您正苦於以下問題:Java FastBlur.blur方法的具體用法?Java FastBlur.blur怎麽用?Java FastBlur.blur使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jp.wasabeef.fresco.processors.internal.FastBlur
的用法示例。
在下文中一共展示了FastBlur.blur方法的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);
}