高斯模糊(一)

高斯模糊(一)

1.在最外面的project的build里添加
allprojects {
repositories {
google()
jcenter()
maven { url ‘https://jitpack.io’ } //添加内容
}
}

2.在项目的build里添加
dependencies {
implementation fileTree(dir: ‘libs’, include: [’*.jar’])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.github.javaexception:FuzzyBackground:v1.0'  //添加内容

}

defaultConfig {
applicationId “com.bw.qgs.mo
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName “1.0”

renderscriptTargetApi 25    //添加内容
renderscriptSupportModeEnabled true  //添加内容

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

//activity
image = findViewById(R.id.imageView);
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.mo);
Bitmap blur = Fuzzy_Background.with(getApplication())
.bitmap(bitmap)
.radius(5)
.blur();
image.setImageBitmap(blur);
}
});

猜你喜欢

转载自blog.csdn.net/weixin_42791904/article/details/84555285