Skip to content

iankoex/compose-capturable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

compose-capturable

Demo of how to convert A composable to Bitmap

Usage

    var controller by remember { mutableStateOf(CaptureController()) }
    var bitmap: ImageBitmap? by remember { mutableStateOf<ImageBitmap?>(null) }

    Capturable(controller) {
        Column {
            Text("All of this will be Captured")
            Text("Event this button and the divider")
            Divider(thickness = 3.dp)
            Button(onClick = {
                controller.captureBitmap()?.let {
                    bitmap = it.asImageBitmap()
                }
            }) {
                Text(text = "Capture")
            }
            bitmap?.let {
                Image(
                    bitmap = it,
                    contentDescription = null,
                    modifier = Modifier.size(300.dp)
                )
            }
        }
    }

About

Demo of how to convert A composable to Bitmap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages