Rafs
11/12/2020, 9:38 AMBitmap
Just like what we do with View.drawToBitmap()
Peter Fortuin
11/12/2020, 9:47 AMRafs
11/12/2020, 9:51 AMComposeView
as the content of my Activity/Fragment. I haven't had any success manually inflating a ComposeView
in isolationPeter Fortuin
11/12/2020, 9:53 AMRafs
11/12/2020, 9:53 AMComposeView
Peter Fortuin
11/12/2020, 9:57 AMRafs
11/12/2020, 10:00 AMNader Jawad
11/12/2020, 3:48 PMRafs
11/12/2020, 3:50 PMNader Jawad
11/12/2020, 3:52 PMfun drawToImageAsset() {
val density = Density(1.0f)
val width = 100
val height = 100
val canvas = Canvas(ImageAsset(width, height))
val size = Size(width.toFloat(), height.toFloat())
CanvasDrawScope().draw(density, LayoutDirection.Ltr, canvas, size) {
drawRect(Color.Red)
}
// Code to save ImageAsset to file
}
Rafs
11/12/2020, 4:04 PMCanvas
wrapped inside a Box
so that I can add Modifier.dragGestureFilter
and Modifier.tapGestureFilter
to each individual item separately.Nader Jawad
11/12/2020, 4:06 PMImage
composable instead of trying to output the composable content to a bitmapRafs
11/12/2020, 4:08 PMNader Jawad
11/12/2020, 4:08 PMRafs
11/12/2020, 4:09 PMNader Jawad
11/12/2020, 4:11 PMcaptureToImage
from outside ComposeTestRule?Filip Pavlis
11/12/2020, 4:47 PM