captureAsyncAndSave

expect suspend fun CaptureController.captureAsyncAndSave(fileName: String = "capture_shared", imageType: CapturableSaveImageType = CapturableSaveImageType.PNG(100), saveType: CapturableSaveType = CapturableSaveType.Auto)

Capture and save Image To Gallery

also see CaptureController.captureAsync

Example usage:

val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()

// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndSave(
fileName = "Ticket",
imageType = CapturableSaveImageType.PNG(100),
saveType = CapturableSaveType.Auto
)
}
}) { ... }

Parameters

fileName

Do not add an extension with a dot ('.'), the appropriate extension will be automatically applied based on the ImageType.

imageType

Share Type PNG or JPEG CapturableSaveImageType

saveType

Share Type Auto,Pick and Gallery CapturableSaveType

actual suspend fun CaptureController.captureAsyncAndSave(fileName: String, imageType: CapturableSaveImageType, saveType: CapturableSaveType)

Capture and save Image To Gallery

also see CaptureController.captureAsync

Example usage:

val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()

// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndSave(
fileName = "Ticket",
imageType = CapturableSaveImageType.PNG(100),
saveType = CapturableSaveType.Auto
)
}
}) { ... }

Parameters

fileName

Do not add an extension with a dot ('.'), the appropriate extension will be automatically applied based on the ImageType.

imageType

Share Type PNG or JPEG CapturableSaveImageType

saveType

Share Type Auto,Pick and Gallery CapturableSaveType

actual suspend fun CaptureController.captureAsyncAndSave(fileName: String, imageType: CapturableSaveImageType, saveType: CapturableSaveType)

Capture and save Image To Gallery

also see CaptureController.captureAsync

Example usage:

val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()

// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndSave(
fileName = "Ticket",
imageType = CapturableSaveImageType.PNG(100),
saveType = CapturableSaveType.Auto
)
}
}) { ... }

Parameters

fileName

Do not add an extension with a dot ('.'), the appropriate extension will be automatically applied based on the ImageType.

imageType

Share Type PNG or JPEG CapturableSaveImageType

saveType

Share Type Auto,Pick and Gallery CapturableSaveType