QrCode

class QrCode(val version: Int, val errorCorrectionLevel: QrCode.Ecc, dataCodewords: ByteArray, msk: Int)

A QR Code symbol, which is a type of two-dimension barcode. Invented by Denso Wave and described in the ISO/IEC 18004 standard.

Instances of this class represent an immutable square grid of dark and light cells. The class provides static factory functions to create a QR Code from text or binary data. The class covers the QR Code Model 2 specification, supporting all versions (sizes) from 1 to 40, all 4 error correction levels, and 4 character encoding modes.

Ways to create a QR Code object:

(Note that all ways require supplying the desired error correction level.)

Parameters

version

The version number of this QR Code, which is between 1 and 40 (inclusive). This determines the size of this barcode.

errorCorrectionLevel

The error correction level used in this QR Code.

See also

Constructors

Link copied to clipboard
constructor(version: Int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: ByteArray, msk: Int)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

The error correction level in a QR Code symbol.

Properties

Link copied to clipboard
Link copied to clipboard
val mask: Int

The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).

Link copied to clipboard
val size: Int

The width and height of this QR Code, measured in modules, between 21 and 177 (inclusive). This is equal to version × 4 + 17.

Link copied to clipboard

Functions

Link copied to clipboard
fun getModule(x: Int, y: Int): Boolean

Returns the color of the module (pixel) at the specified coordinates, which is false for light or true for dark. The top left corner has the coordinates (x=0, y=0). If the specified coordinates are out of bounds, then false (light) is returned.