毛玻璃效果算法c语言,毛玻璃之android.support.v8.renderscript.RSRuntimeException

最近看到bilibili的番剧详情页面下的背景图有高斯模糊的效果,很好看,于是也将自己个人项目的某个背景图调成模糊的效果,用的是500px的500px-android-blur

地址:https://github.com/500px/500px-android-blur

a805cbb16d20

500px效果

在集成的时候,android.support.v8库找不到。这个renderscript-v8.jar包需要从sdk的目录下手动拷贝到工程的libs下面,因为用androidstudio2.1.1版本,sdk编译工具是23.0.3的版本

a805cbb16d20

renderscript所在目录

然后将jar包导入到androidstudio工程libs下面,出现了下面的错误:

Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.papi.player-2/lib/arm/librsjni.so" Support lib API: 2301

at android.support.v8.renderscript.RenderScript.internalCreate(RenderScript.java:1358)

at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1529)

at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1479)

at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1455)

at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1442)

at com.fivehundredpx.android.blur.BlurringView.initializeRenderScript(BlurringView.java:98)

at com.fivehundredpx.android.blur.BlurringView.(BlurringView.java:37)

at java.lang.reflect.Constructor.newInstance(Native Method)

at java.lang.reflect.Constructor.newInstance(Constructor.java:288)

at android.view.LayoutInflater.createView(LayoutInflater.java:626)

at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:825)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)

at android.view.LayoutInflater.inflate(LayoutInflater.java:523)

at android.view.LayoutInflater.inflate(LayoutInflater.java:425)

at android.view.LayoutInflater.inflate(LayoutInflater.java:368)

at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)

at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)

网上搜答案,说是兼容问题,然后把so库也靠近了libs下面,总应该匹配了吧

a805cbb16d20

版本1

但是上面的异常还是发生了,想了想,最关键的一句提示Support lib API: 2301,我的手机是5.0.1的系统,应该是用了高版本的api,归根结底是库版本不该用这么高的,然后找到eclipse的sdk路径

a805cbb16d20

版本2

然后把这个4.4版本下的jar文件替换掉之前的23版本,然后运行,正常!!!好开心~~~

常用模糊方式:

RenderScript

调用 Android 自带的 RenderScript 类进行图片模糊

其模糊速度一般,与直接在Java层模糊区别不大

我这边调试只能在 4.4 以上运行,理论上是 Android 17 以上都行

Fast Blur

Java层进行模糊

Fast Blur 是国外一位开发者发明的模糊方法

Fast Blur 原名是 堆栈模糊

JniArray

其模糊规则是 堆栈模糊 的 C 语言实现

在 JNI 层进行模糊,然后传回模糊后的数据

在 Java 层对图片类解析得到 像素点 数组传入到 JNI 层

JNI 层对像素点集合进行模糊,模糊后传回

JniBitMap

其模糊规则是 堆栈模糊 的 C 语言实现

在 JNI 层进行模糊,然后传回模糊后的数据

在 JNI 层直接对图片模糊,模糊后传回

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值