Created
September 6, 2023 14:06
-
-
Save chiragthummar/7377f135627511308cb18c231fd85b05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val picture = remember { Picture() } | |
Column( | |
modifier = Modifier | |
.padding(padding) | |
.fillMaxSize() | |
.drawWithCache { | |
// Example that shows how to redirect rendering to an Android Picture and then | |
// draw the picture into the original destination | |
val width = this.size.width.toInt() | |
val height = this.size.height.toInt() | |
onDrawWithContent { | |
val pictureCanvas = | |
androidx.compose.ui.graphics.Canvas( | |
picture.beginRecording( | |
width, | |
height | |
) | |
) | |
draw(this, this.layoutDirection, pictureCanvas, this.size) { | |
this@onDrawWithContent.drawContent() | |
} | |
picture.endRecording() | |
drawIntoCanvas { canvas -> canvas.nativeCanvas.drawPicture(picture) } | |
} | |
} | |
) { | |
ScreenContentToCapture() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment