Status Update
Comments
ma...@google.com <ma...@google.com> #2
Alex, leaving to you to triage as it seems like a reasonable request in general for ui layer
pe...@ns.nl <pe...@ns.nl> #3
go...@umito.nl <go...@umito.nl> #4
Ideally this would be possible without adding the Composable to the screen, but a real offline render to bitmap. For example, we would like to use Compose views for Google Map markers, that requires bitmaps. In the xml world we can just measure and layout a view and render it to a canvas backed by a bitmap, but ComposeView for example won't render content this way.
40...@qq.com <40...@qq.com> #5
ou...@gmail.com <ou...@gmail.com> #6
br...@16cards.com <br...@16cards.com> #7
It seems other use cases here are for single shot output. For my use case, I need to consume the resulting bitmaps over recompositions across time and send the bitmap data to a device driver.
no...@gmail.com <no...@gmail.com> #8
wa...@gmail.com <wa...@gmail.com> #9
Any updates ? Use Case : I need to export user created Mind Maps as PNG or PDF but if I redraw it on canvas , It makes the exported version look different than it was created in Composables. Since canvas doesn't offer the same text input functionalities , We depend on compose to do this.
mo...@google.com <mo...@google.com> #10
No updates here. We use the system Canvas for drawing content and it is a hardware Canvas. Many features are not supported on software canvas, so supporting this is quite difficult.
Description
Description
In ADB Backstage there is talk about rendering compose trees directly to bitmaps (around the 25 minute mark) and there are screenshot comparing capabilities in the Compose test library.
It would be great if there was a way to straightforwardly render a composable to a bitmap. right from the composable environment without explicitly referencing the semantic node.
Currently the way to go seems like the Composable must be wrapped in a
View
, retrieved usingLocalView.current
, and drawn into aCanvas
. This feels roundabout at best and brittle at worst.Use Case
One example would be a simple photo editing app, where text elements can be superimposed on an image, and the app provides a way to export the result to PNG.
For proof of notability, see the question on Stack Overflow which has been upvoted quite often: Jetpack Compose take screenshot of composable function?