Companion

object Companion

Properties

Link copied to clipboard
const val MAX_VERSION: Int = 40

The maximum version number (40) supported in the QR Code Model 2 standard.

Link copied to clipboard
const val MIN_VERSION: Int = 1

The minimum version number (1) supported in the QR Code Model 2 standard.

Functions

Link copied to clipboard

Returns a QR Code representing the specified binary data at the specified error correction level. This function always encodes using the binary segment mode, not any text mode. The maximum number of bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.

Link copied to clipboard
fun encodeSegments(segs: MutableList<QrSegment>, ecl: QrCode.Ecc, minVersion: Int = MIN_VERSION, maxVersion: Int = MAX_VERSION, mask: Int = -1, boostEcl: Boolean = true): QrCode

Returns a QR Code representing the specified segments with the specified encoding parameters. The smallest possible QR Code version within the specified range is automatically chosen for the output. Iff boostEcl is true, then the ECC level of the result may be higher than the ecl argument if it can be done without increasing the version. The mask number is either between 0 to 7 (inclusive) to force that mask, or −1 to automatically choose an appropriate mask (which may be slow).

Link copied to clipboard

Returns a QR Code representing the specified Unicode text string at the specified error correction level. As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.

Link copied to clipboard
fun getBit(x: Int, i: Int): Boolean

Returns true iff the i'th bit of x is set to 1.

Link copied to clipboard

Returns the number of 8-bit data (i.e. not error correction) codewords contained in any QR Code of the given version number and error correction level, with remainder bits discarded. This stateless pure function could be implemented as a (40*4)-cell lookup table.