Shivam Dhuria
08/13/2025, 8:49 AMAniket Shinde
08/13/2025, 9:07 AMval image = ImageBitmap.imageResource(id = R.drawable.download_demo) // your image
Text(
text = "LION",
fontSize = 100.sp,
fontWeight = FontWeight.ExtraBold,
letterSpacing = (-2).sp, // optional, tighter look
modifier = Modifier
// draw text offscreen so blend mode works correctly
.graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen }
.drawWithCache {
val dst = IntSize(size.width.roundToInt(), size.height.roundToInt())
onDrawWithContent {
// 1) draw the text (destination)
drawContent()
// 2) draw the image using SrcIn so it shows only where text exists
drawImage(
image = image,
dstSize = dst,
blendMode = BlendMode.SrcIn
)
}
}
)
Aniket Shinde
08/13/2025, 9:07 AMAniket Shinde
08/13/2025, 9:08 AMShivam Dhuria
08/13/2025, 9:23 AMAnonymike
08/13/2025, 4:54 PMAniket Shinde
08/17/2025, 5:09 PM