Shivam Dhuria
Aniket Shinde
val 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 ) } } )
Anonymike
A modern programming language that makes developers happier.