android实时高斯模糊

以前自己写过一个高斯模糊的工具类,是把bitmap进行处理,最近要用结果找不到了,写起来有麻烦,还好现在有相关开源框架,特此记录一下。

框架地址

使用方法

Adding to project

Add dependencies in your build.gradle:

	dependencies {
	    implementation 'com.github.mmin18:realtimeblurview:1.2.1'
	}

Support API level < 19

The following step is only required if your minSdkVersion < 19, or you use renderscript support mode.

Both AndroidX and Android Support Library is supported.

	android {
		buildToolsVersion '24.0.2'                 // Use 23.0.3 or higher
		defaultConfig {
			minSdkVersion 15
			renderscriptTargetApi 19
			renderscriptSupportModeEnabled true    // Enable RS support
		}
	}

Add proguard rules if necessary: 

-keep class android.support.v8.renderscript.** { *; }
-keep class androidx.renderscript.** { *; }

 只需要在你的布局上盖一层下面的view,就能实时高斯模糊了

<com.github.mmin18.widget.RealtimeBlurView
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	app:realtimeBlurRadius="20dp"
	app:realtimeOverlayColor="#8000" />

版权声明:本文为weixin_40998254原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。