Android中实现毛玻璃效果的3种方法
最近在做一款叫叽叽的App(男银懂的),其中有一个功能需要对图片处理实现毛玻璃的特效
进过一番预研,找到了3中实现方案,其中各有优缺点:
1、如果系统的api在16以上,可以使用系统提供的方法直接处理图片
if(VERSION.SDK_INT>16){
Bitmapbitmap=sentBitmap.copy(sentBitmap.getConfig(),true);
finalRenderScriptrs=RenderScript.create(context); finalAllocationinput=Allocation.createFromBitmap(rs,sentBitmap,Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); finalAllocationoutput=Allocation.createTyped(rs,input.getType()); finalScriptIntrinsicBlurscript=ScriptIntrinsicBlur.create(rs,Element.U8_4(rs)); script.setRadius(radius/*e.g.3.f*/); script.setInput(input); script.forEach(output); output.copyTo(bitmap); returnbitmap; }
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短