encodeToPng

actual fun encodeToPng(bitmap: ImageBitmap): ByteArray?

Encode an ImageBitmap as PNG bytes, or null if encoding fails. The inverse of decodeImageBitmap; used by io.ak1.drawbox.domain.usecase.PngExporter to turn a rasterized scene into a file-ready payload. Implementations are platform-specific because the host graphics stack drives encoding:

  • Android: Bitmap.compress(PNG, ...)

  • JVM / iOS / Web: org.jetbrains.skia.Image.encodeToData(PNG) via skiko

actual fun encodeToPng(bitmap: ImageBitmap): ByteArray?

Encode an ImageBitmap as PNG bytes, or null if encoding fails. The inverse of decodeImageBitmap; used by io.ak1.drawbox.domain.usecase.PngExporter to turn a rasterized scene into a file-ready payload. Implementations are platform-specific because the host graphics stack drives encoding:

  • Android: Bitmap.compress(PNG, ...)

  • JVM / iOS / Web: org.jetbrains.skia.Image.encodeToData(PNG) via skiko

actual fun encodeToPng(bitmap: ImageBitmap): ByteArray?

Encode an ImageBitmap as PNG bytes, or null if encoding fails. The inverse of decodeImageBitmap; used by io.ak1.drawbox.domain.usecase.PngExporter to turn a rasterized scene into a file-ready payload. Implementations are platform-specific because the host graphics stack drives encoding:

  • Android: Bitmap.compress(PNG, ...)

  • JVM / iOS / Web: org.jetbrains.skia.Image.encodeToData(PNG) via skiko

actual fun encodeToPng(bitmap: ImageBitmap): ByteArray?

Shared between the js and wasmJs targets — both run on Skiko, so the ImageBitmap → PNG-bytes path is identical. Mirrors decodeImageBitmap's single shared web actual to avoid two files drifting apart.