Compose binding¶
kiteqr-compose draws a BitMatrix onto a Compose Multiplatform surface. The
core engine stays UI-free. Everything Compose-specific lives in this opt-in
artifact.
Add it alongside the core:
It builds for fewer targets than the core, and its Android minSdk is 24 rather
than 21. See Supported platforms before you add it.
The QrCode composable¶
import io.github.yuroyami.kiteqr.Qr
import io.github.yuroyami.kiteqr.compose.QrCode
@Composable
fun Ticket() {
val matrix = remember { Qr.encode("TICKET-12345") }
QrCode(
matrix,
modifier = Modifier.size(240.dp),
dark = Color.Black,
light = Color.White,
quietZone = 4,
)
}
It fills the modifier's bounds and stays square and centered. It merges adjacent dark modules into horizontal runs, so there are no anti-aliasing seams.
Drawing yourself¶
For a custom canvas, DrawScope.drawQrCode puts the symbol wherever you want:
An ImageBitmap¶
For Image(bitmap = ...), sharing, or saving, rasterize to an ImageBitmap: