@nuintun/qrcode
Version:
A pure JavaScript QRCode encode and decode library.
36 lines (33 loc) • 655 B
JavaScript
/**
* @module QRCode
* @package @nuintun/qrcode
* @license MIT
* @version 5.0.2
* @author nuintun <nuintun@qq.com>
* @description A pure JavaScript QRCode encode and decode library.
* @see https://github.com/nuintun/qrcode#readme
*/
/**
* @module ByteMatrix
*/
class ByteMatrix {
#size;
#bytes;
constructor(size) {
this.#size = size;
this.#bytes = new Int8Array(size * size);
}
get size() {
return this.#size;
}
set(x, y, value) {
this.#bytes[y * this.#size + x] = value;
}
get(x, y) {
return this.#bytes[y * this.#size + x];
}
clear(value) {
this.#bytes.fill(value);
}
}
export { ByteMatrix };