Skip to content

Lightweight library for generating QR code matrices

License

Notifications You must be signed in to change notification settings

SaltifyDev/qr-matrix

Repository files navigation

qr-matrix

Maven Central

Lightweight library for generating QR code matrices in Kotlin.

The code in this library is taken from qrcode-kotlin. It has been refactored to focus solely on generating QR code matrices without any rendering or image generation capabilities, and does not depend on any external libraries.

This could be useful for projects where you want to handle QR code rendering yourself or integrate with other libraries, or CLI applications where minimal dependencies are preferred.

Usage

The library introduces a shorthand API for generating QR code matrices (in the form of a 2D Boolean array) with minimal configuration. Just call the generateMatrix function with the desired content and optional parameters for error correction level and version.

val matrix = generateMatrix("Hello, QR Code!")

With the generated matrix, for example, it is convenient to print the QR code to the console:

for (row in matrix) {
    for (module in row) {
        print(if (module) "██" else "  ")
    }
    println()
}

For a more compact rendering style that takes up less visual space, see the implementation in the test case.

For more advanced usage, you can still use the underlying classes and methods from the original library. See the original documentation for details.

About

Lightweight library for generating QR code matrices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages