Library for capturing Composable components
-
app module is demo app
-
capture module is Android Library for capturing composable contains and contains
CaptureState
,CaptureResult
,@Composable Capture
To get a Git project into your build:
Add it in your root build.gradle at the end of repositories:
// root level settings.gradle.kts
repositories {
// ...
maven("https://jitpack.io")
}
// module level build.gradle.kts
dependencies {
val latestVersion = "1.0.2"
implementation("com.github.yonghanJu:CaptureComposable:$latestVersion")
}
val captureState = rememberCaptureState()
Capture(
modifier = Modifier
captureState = captureState,
) {
// @Composable content
}
// Captured
Button(onClick = { captureState.capture() })
// ...
// you can use these
captureState.bitmap // captured bitmap
captureState.state // capturedState(Initialized, Success(bitmap), Error(e))