Horologist 0.8.2-alpha adds a new API for capturin...
# compose-wear
y
Horologist 0.8.2-alpha adds a new API for capturing a Composable to a Bitmap for use in Tiles. Might be useful for reusing assets such as charts, between your App and Tiles.
Copy code
private suspend fun circleCompose(): ImageBitmap? = 
        renderer.renderComposableToBitmap(DpSize(100.dp, 100.dp)) {
            Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
                Canvas(modifier = Modifier.fillMaxSize()) {
                    drawCircle(Color.DarkGray)
                }
                FilledIconButton(onClick = {}) {
                    Text("\uD83D\uDC6A")
                }
            }
        }
...
addIdToImageMapping("circleCompose", circleComposeBitmap.toImageResource())
🎉 1
m
Awesome! Thanks Yuri.