Skip to content

Getting started

Requirements

  • minSdk 29 (Android 10) or higher.
  • Hardware acceleration, which is on by default.
  • For Compose: blur-compose is built with Compose BOM 2026.11.01 (Compose 1.13) and Kotlin 2.4, and brings in Compose 1.13. That requires compileSdk 37.1 or later in your app. Newer versions work.

Install

The artifacts are on Maven Central:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}
// app/build.gradle.kts
dependencies {
    implementation("io.github.mrsluffy:blur-view:1.0.1")     // Android Views
    implementation("io.github.mrsluffy:blur-compose:1.0.1")  // Jetpack Compose (includes blur-view)
}

Add only blur-view for a View-only app; it doesn't pull in Compose. All packages are under dev.blurengine.mrsluffy.

Installing from GitHub Packages instead

Every release is also published to GitHub Packages, under the same coordinates. GitHub requires a token to download packages, even public ones: create a personal access token with the read:packages scope, then add the repository:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/MrSluffy/blur-engine")
            credentials {
                username = providers.gradleProperty("gpr.user").get()
                password = providers.gradleProperty("gpr.key").get()
            }
        }
    }
}

Put gpr.user and gpr.key in ~/.gradle/gradle.properties, never in the project. Maven Central needs none of this, so prefer it.

The demo app is attached to each GitHub Release as an APK.

Your first blur

A blur surface blurs whatever is drawn behind it in the window. Place it on top of the content you want blurred, for example as the last child of a FrameLayout or Box.

import dev.blurengine.mrsluffy.view.BlurView

val density = resources.displayMetrics.density
val bar = BlurView(context).apply {
    blurRadius = 24 * density          // pixels
    setTint(Color.WHITE, 0.2f)
    cornerRadius = 20 * density
}
root.addView(bar, FrameLayout.LayoutParams(MATCH_PARENT, (96 * density).toInt(), Gravity.TOP))

Or in XML:

<FrameLayout ...>
    <androidx.recyclerview.widget.RecyclerView ... />

    <dev.blurengine.mrsluffy.view.BlurView
        android:layout_width="match_parent"
        android:layout_height="96dp"
        app:blurRadius="24dp"
        app:blurTintColor="#FFFFFF"
        app:blurTintAlpha="0.2"
        app:blurCornerRadius="20dp">
        <!-- children draw on top, sharp -->
    </dev.blurengine.mrsluffy.view.BlurView>
</FrameLayout>
import dev.blurengine.mrsluffy.compose.blurSurface

Box(Modifier.fillMaxSize()) {
    LazyColumn { /* content */ }

    Box(
        Modifier.fillMaxWidth().height(96.dp).blurSurface {
            radius = 24.dp
            tint(Color.White.copy(alpha = 0.2f))
            cornerRadius(20.dp)
        }
    ) {
        Text("Title")   // drawn on top, sharp
    }
}

Choosing settings

Setting Default Notes
Radius 20 px (View), 20 dp (Compose) Blur strength; sigma = radius / 2. 16 to 40 dp suits most UI.
Tint none A translucent color over the blur. Light themes: white at 0.1 to 0.3. Dark themes: a dark color at 0.3 to 0.5.
Saturation 1 Above 1 makes the blur more vivid, a common glass look (1.2 to 1.4).
Downsample 4 The capture is blurred at 1/4 size. Higher is faster and softer. Keep the default unless the radius is very small.
Algorithm AUTO Leave it on AUTO. See How it works for the others.

Next steps