alaershov
05/07/2024, 5:35 AMbitmap.setContent { myComposableStuff }
yschimke
05/07/2024, 8:01 PMyschimke
05/07/2024, 8:02 PMalaershov
05/15/2024, 6:41 AMalaershov
05/15/2024, 6:47 AMit has to be in your compositionI want to create some kind of Composable scope, but without any connection to UI. For instance, I can create a Bitmap anywhere, even in data layer or business logic layer. And I can draw on Canvas on this Bitmap anywhere. And I want to use Compose to draw on said Bitmap or Canvas. My use-case is building a Google Map marker image with some non-trivial layout. It doesn't need to be interactive, so currently I draw on Bitmap using Canvas, which is hard when it comes to layout. I want to: • create a Bitmap • create some kind of Composition that is not attached to my UI, but that can draw on this Bitmap's Canvas • use all powers of Compose to build my map icon
yschimke
05/15/2024, 4:56 PMNader Jawad
05/15/2024, 5:39 PMGraphicsLayer#record
and call GraphicsLayer#toImageBitmap
.
If you don't want to draw the content to the screen you can avoid calling drawLayer
within the onDrawWithContent
call.