Draw content blurred with the specified radii.
BlurSample
@Composable
fun BlurSample() {
Box(
Modifier.size(300.dp)
// Blur content allowing the result to extend beyond the bounds of the original content
.blur(30.dp, edgeTreatment = BlurredEdgeTreatment.Unbounded)
.background(Color.Red, CircleShape)
)
}
ImageBlurSample
@Composable
fun ImageBlurSample() {
Image(
painter = painterResource(R.drawable.circus),
contentDescription = "sample blurred image",
// Blur content within the original bounds, clipping the result to a rounded rectangle
modifier = Modifier.blur(30.dp, BlurredEdgeTreatment(RoundedCornerShape(5.dp))),
)
}