export To Png
fun exportToPng(elements: List<Element>, scale: Float = 1.0f, padding: Float = 20.0f, background: Color? = null, maxDimension: Int = 4096, textMeasurer: TextMeasurer? = null): ByteArray?
Return
PNG bytes, or null when elements is empty or encoding fails.
Parameters
elements
scene to render, drawn in ascending zIndex order.
scale
device-pixel multiplier over world units (e.g. 2f for a HiDPI-crisp export). Automatically reduced if it would push either side past maxDimension.
padding
world-unit margin added on every side, matching SvgExporter's 20 px default.
background
fill drawn behind the scene; null leaves a fully transparent backdrop.
max Dimension
hard cap (in pixels) on either output side, guarding against multi-gigabyte bitmaps from a large scene × large scale.
text Measurer
optional measurer for real text layout; see class doc.