) = this.drawBehind { drawIntoCanvas { ContextCompat.getDrawable(context, ninePatchRes)?.let { ninePatch -> ninePatch.run { bounds = Rect(0, 0, size.width.toInt(), size.height.toInt()) draw(it.nativeCanvas) } } } } @Composable fun DynamicSpeechBubble( text: String, @DrawableRes bubbleImageRes: Int, paddingValues: PaddingValues, ) { val context = LocalContext.current Box( Modifier.draw9Patch(context = context, ninePatchRes = bubbleImageRes), ) { Text( text = text, color = Color.Black, modifier = Modifier.padding(paddingValues), ) } }