exportPng

fun exportPng(scale: Float = 1.0f, background: Color? = null, textMeasurer: TextMeasurer? = null)

Export the current drawing as a rasterized PNG.

Emits Event.PngExported with the encoded bytes so the platform layer can persist or share the file, or Event.Error when the scene is empty or encoding fails.

Parameters

scale

device-pixel multiplier over world units (2f for a crisp HiDPI export), automatically clamped so neither side exceeds the exporter's pixel cap.

background

fill behind the scene; null keeps it transparent.

textMeasurer

supply one from a composable (rememberTextMeasurer()) for real text layout; when null, text elements render as placeholder boxes. See PngExporter.