Kyant
03/01/2025, 11:29 AMDrawModifierNode
. The problem is that the ContentDrawScope.draw()
won't be called when scrolling or clicking children (displaying ripples), unless recomposition happens.
Is my way correct to get the bitmap? I want to get the bitmap when the view changes every time.Kyant
03/01/2025, 11:31 AMoverride fun ContentDrawScope.draw() {
println("draw")
val graphicsContext = requireGraphicsContext()
val layer = graphicsContext.createGraphicsLayer()
layer.record {
drawRect(Color.White)
this@draw.drawContent()
}
coroutineScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
val bitmap = layer.toImageBitmap().asAndroidBitmap()
graphicsContext.releaseGraphicsLayer(layer)
}
drawContent()
}
Sergey Y.
03/01/2025, 7:56 PMSergey Y.
03/01/2025, 8:04 PMKyant
03/02/2025, 2:11 AM