exportWithColorMask

abstract suspend fun exportWithColorMask(block: DesignBlock, mimeType: MimeType, maskColor: RGBAColor, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): Pair<ByteBuffer, ByteBuffer>

Exports a design block element as a file of the given mime type. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Return

a pair where first is the exported image data and second is the mask data.

Parameters

block

the design block element to export.

mimeType

the mime type of the output file.

maskColor

the mask color.

options

the options for exporting the block type

onPreExport

the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.

uriResolver

optional async resolution function that accepts both relative and absolute uri and returns an absolute uri.


abstract suspend fun exportWithColorMask(blocks: List<DesignBlock>, mimeType: MimeType, maskColor: RGBAColor, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<Pair<ByteBuffer, ByteBuffer>>

Exports multiple design block elements as files of the given mime type with color masks. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling exportWithColorMask repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Return

a list of pairs where first is the exported image data and second is the mask data, in the same order as the input blocks.

Parameters

blocks

the design block elements to export.

mimeType

the mime type of the output files.

maskColor

the mask color.

options

the options for exporting the block type

onPreExport

the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.

uriResolver

optional async resolution function that accepts both relative and absolute uri and returns an absolute uri.