pull/1211/head
gedoor 3 years ago
parent 0994e59d4c
commit bb8ff27b07
  1. 3
      app/build.gradle
  2. 3
      app/src/main/java/io/legado/app/help/ThemeConfig.kt
  3. 4
      app/src/main/java/io/legado/app/utils/BitmapUtils.kt

@ -213,9 +213,6 @@ dependencies {
implementation("io.noties.markwon:ext-tables:$markwonVersion")
implementation("io.noties.markwon:html:$markwonVersion")
// RenderScript库
implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3')
//
implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.1')

@ -6,7 +6,6 @@ import android.graphics.Color
import android.util.DisplayMetrics
import androidx.annotation.Keep
import androidx.appcompat.app.AppCompatDelegate
import com.google.android.renderscript.Toolkit
import io.legado.app.R
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
@ -60,7 +59,7 @@ object ThemeConfig {
val bgImage = BitmapUtils
.decodeBitmap(bgCfg.first!!, metrics.widthPixels, metrics.heightPixels)
?: return null
return Toolkit.blur(bgImage, bgCfg.second)
return BitmapUtils.stackBlur(bgImage, bgCfg.second.toFloat())
}
fun upConfig() {

@ -249,7 +249,7 @@ object BitmapUtils {
/**
* 高斯模糊
*/
fun stackBlur(srcBitmap: Bitmap?): Bitmap? {
fun stackBlur(srcBitmap: Bitmap?, radius: Float = 8f): Bitmap? {
if (srcBitmap == null) return null
val rs = RenderScript.create(appCtx)
val blurredBitmap = srcBitmap.copy(Config.ARGB_8888, true)
@ -268,7 +268,7 @@ object BitmapUtils {
script.setInput(input)
//设置模糊半径
script.setRadius(8f)
script.setRadius(radius)
//启动 ScriptIntrinsicBlur
script.forEach(output)

Loading…
Cancel
Save