@qr-platform/qr-code.js 0.8.21 → 0.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation.md +5 -4
- package/lib/chunks/zbar-scan-validator-B3GQk_mt.js +1 -0
- package/lib/chunks/zxing-scan-validator-CYcyNnMt.js +1 -0
- package/lib/core/qr-templates.d.ts +1 -0
- package/lib/index.d.ts +18 -4
- package/lib/index.js +1 -0
- package/lib/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +3 -263
- package/lib/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +10 -13
- package/lib/node.d.ts +18 -3
- package/lib/node.js +1 -0
- package/lib/utils/scan-validator-zxing-node.d.ts +18 -0
- package/package.json +8 -8
- package/lib/builder/index.d.ts +0 -13
- package/lib/builder/node.d.ts +0 -13
- package/lib/builder/qr-code-builder.d.ts +0 -25
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeSvgWriter.d.ts +0 -46
- package/lib/lib/zxing-js/src/browser/BrowserSvgCodeWriter.d.ts +0 -49
- package/lib/lib/zxing-js/src/browser/DecodeContinuouslyCallback.d.ts +0 -6
- package/lib/lib/zxing-js/src/browser/VideoInputDevice.d.ts +0 -22
- package/lib/lib/zxing-js/src/core/Dimension.d.ts +0 -13
- package/lib/lib/zxing-js/src/core/EncodeHintType.d.ts +0 -99
- package/lib/lib/zxing-js/src/core/PlanarYUVLuminanceSource.d.ts +0 -35
- package/lib/lib/zxing-js/src/core/RGBLuminanceSource.d.ts +0 -21
- package/lib/lib/zxing-js/src/core/Writer.d.ts +0 -30
- package/lib/lib/zxing-js/src/core/WriterException.d.ts +0 -7
- package/lib/lib/zxing-js/src/core/common/ECIEncoderSet.d.ts +0 -37
- package/lib/lib/zxing-js/src/core/common/ECIInput.d.ts +0 -79
- package/lib/lib/zxing-js/src/core/common/MinimalECIInput.d.ts +0 -123
- package/lib/lib/zxing-js/src/core/common/detector/CornerDetector.d.ts +0 -35
- package/lib/lib/zxing-js/src/core/common/detector/WhiteRectangleDetector.d.ts +0 -71
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGFPoly.d.ts +0 -36
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonEncoder.d.ts +0 -41
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeWriter.d.ts +0 -13
- package/lib/lib/zxing-js/src/core/qrcode/encoder/BlockPair.d.ts +0 -7
- package/lib/lib/zxing-js/src/core/qrcode/encoder/ByteMatrix.d.ts +0 -24
- package/lib/lib/zxing-js/src/core/qrcode/encoder/Encoder.d.ts +0 -85
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MaskUtil.d.ts +0 -47
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MatrixUtil.d.ts +0 -37
- package/lib/lib/zxing-js/src/core/qrcode/encoder/QRCode.d.ts +0 -29
- package/lib/lib/zxing-js/src/core/util/ByteArrayOutputStream.d.ts +0 -174
- package/lib/lib/zxing-js/src/core/util/Collections.d.ts +0 -11
- package/lib/lib/zxing-js/src/core/util/Formatter.d.ts +0 -28
- package/lib/lib/zxing-js/src/core/util/Long.d.ts +0 -12
- package/lib/lib/zxing-js/src/core/util/OutputStream.d.ts +0 -106
- package/lib/lib/zxing-js/src/core/util/StandardCharsets.d.ts +0 -7
- package/lib/qr-code-js-node.js +0 -1
- package/lib/qr-code-js.js +0 -1
@@ -1,123 +0,0 @@
|
|
1
|
-
import Charset from '../util/Charset';
|
2
|
-
import { ECIEncoderSet } from './ECIEncoderSet';
|
3
|
-
import ECIInput from './ECIInput';
|
4
|
-
export declare class MinimalECIInput implements ECIInput {
|
5
|
-
private bytes?;
|
6
|
-
private fnc1;
|
7
|
-
/**
|
8
|
-
* Constructs a minimal input
|
9
|
-
*
|
10
|
-
* @param stringToEncode the character string to encode
|
11
|
-
* @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
|
12
|
-
* chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
|
13
|
-
* charset to encode any character in the input that can be encoded by it if the charset is among the
|
14
|
-
* supported charsets.
|
15
|
-
* @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not GS1
|
16
|
-
* input.
|
17
|
-
*/
|
18
|
-
constructor(stringToEncode: string, priorityCharset: Charset, fnc1: number);
|
19
|
-
getFNC1Character(): number;
|
20
|
-
/**
|
21
|
-
* Returns the length of this input. The length is the number
|
22
|
-
* of {@code byte}s, FNC1 characters or ECIs in the sequence.
|
23
|
-
*
|
24
|
-
* @return the number of {@code char}s in this sequence
|
25
|
-
*/
|
26
|
-
length(): number;
|
27
|
-
haveNCharacters(index: number, n: number): boolean;
|
28
|
-
/**
|
29
|
-
* Returns the {@code byte} value at the specified index. An index ranges from zero
|
30
|
-
* to {@code length() - 1}. The first {@code byte} value of the sequence is at
|
31
|
-
* index zero, the next at index one, and so on, as for array
|
32
|
-
* indexing.
|
33
|
-
*
|
34
|
-
* @param index the index of the {@code byte} value to be returned
|
35
|
-
*
|
36
|
-
* @return the specified {@code byte} value as character or the FNC1 character
|
37
|
-
*
|
38
|
-
* @throws IndexOutOfBoundsException
|
39
|
-
* if the {@code index} argument is negative or not less than
|
40
|
-
* {@code length()}
|
41
|
-
* @throws IllegalArgumentException
|
42
|
-
* if the value at the {@code index} argument is an ECI (@see #isECI)
|
43
|
-
*/
|
44
|
-
charAt(index: number): number;
|
45
|
-
/**
|
46
|
-
* Returns a {@code CharSequence} that is a subsequence of this sequence.
|
47
|
-
* The subsequence starts with the {@code char} value at the specified index and
|
48
|
-
* ends with the {@code char} value at index {@code end - 1}. The length
|
49
|
-
* (in {@code char}s) of the
|
50
|
-
* returned sequence is {@code end - start}, so if {@code start == end}
|
51
|
-
* then an empty sequence is returned.
|
52
|
-
*
|
53
|
-
* @param start the start index, inclusive
|
54
|
-
* @param end the end index, exclusive
|
55
|
-
*
|
56
|
-
* @return the specified subsequence
|
57
|
-
*
|
58
|
-
* @throws IndexOutOfBoundsException
|
59
|
-
* if {@code start} or {@code end} are negative,
|
60
|
-
* if {@code end} is greater than {@code length()},
|
61
|
-
* or if {@code start} is greater than {@code end}
|
62
|
-
* @throws IllegalArgumentException
|
63
|
-
* if a value in the range {@code start}-{@code end} is an ECI (@see #isECI)
|
64
|
-
*/
|
65
|
-
subSequence(start: number, end: number): string;
|
66
|
-
/**
|
67
|
-
* Determines if a value is an ECI
|
68
|
-
*
|
69
|
-
* @param index the index of the value
|
70
|
-
*
|
71
|
-
* @return true if the value at position {@code index} is an ECI
|
72
|
-
*
|
73
|
-
* @throws IndexOutOfBoundsException
|
74
|
-
* if the {@code index} argument is negative or not less than
|
75
|
-
* {@code length()}
|
76
|
-
*/
|
77
|
-
isECI(index: number): boolean;
|
78
|
-
/**
|
79
|
-
* Determines if a value is the FNC1 character
|
80
|
-
*
|
81
|
-
* @param index the index of the value
|
82
|
-
*
|
83
|
-
* @return true if the value at position {@code index} is the FNC1 character
|
84
|
-
*
|
85
|
-
* @throws IndexOutOfBoundsException
|
86
|
-
* if the {@code index} argument is negative or not less than
|
87
|
-
* {@code length()}
|
88
|
-
*/
|
89
|
-
isFNC1(index: number): boolean;
|
90
|
-
/**
|
91
|
-
* Returns the {@code int} ECI value at the specified index. An index ranges from zero
|
92
|
-
* to {@code length() - 1}. The first {@code byte} value of the sequence is at
|
93
|
-
* index zero, the next at index one, and so on, as for array
|
94
|
-
* indexing.
|
95
|
-
*
|
96
|
-
* @param index the index of the {@code int} value to be returned
|
97
|
-
*
|
98
|
-
* @return the specified {@code int} ECI value.
|
99
|
-
* The ECI specified the encoding of all bytes with a higher index until the
|
100
|
-
* next ECI or until the end of the input if no other ECI follows.
|
101
|
-
*
|
102
|
-
* @throws IndexOutOfBoundsException
|
103
|
-
* if the {@code index} argument is negative or not less than
|
104
|
-
* {@code length()}
|
105
|
-
* @throws IllegalArgumentException
|
106
|
-
* if the value at the {@code index} argument is not an ECI (@see #isECI)
|
107
|
-
*/
|
108
|
-
getECIValue(index: number): number;
|
109
|
-
addEdge(edges: InputEdge[][], to: number, edge: InputEdge): void;
|
110
|
-
addEdges(stringToEncode: string, encoderSet: ECIEncoderSet, edges: InputEdge[][], from: number, previous: InputEdge, fnc1: number): void;
|
111
|
-
encodeMinimally(stringToEncode: string, encoderSet: ECIEncoderSet, fnc1: number): number[];
|
112
|
-
}
|
113
|
-
declare class InputEdge {
|
114
|
-
readonly c: char;
|
115
|
-
readonly encoderSet: ECIEncoderSet;
|
116
|
-
readonly encoderIndex: number;
|
117
|
-
readonly previous: InputEdge;
|
118
|
-
readonly fnc1: number;
|
119
|
-
readonly cachedTotalSize: number;
|
120
|
-
constructor(c: char, encoderSet: ECIEncoderSet, encoderIndex: number, previous: InputEdge, fnc1: number);
|
121
|
-
isFNC1(): boolean;
|
122
|
-
}
|
123
|
-
export {};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import BitMatrix from '../../common/BitMatrix';
|
2
|
-
import ResultPoint from '../../ResultPoint';
|
3
|
-
/**
|
4
|
-
* @author Mariusz Dąbrowski
|
5
|
-
*/
|
6
|
-
export default class CornerDetector {
|
7
|
-
private image;
|
8
|
-
private height;
|
9
|
-
private width;
|
10
|
-
private leftInit;
|
11
|
-
private rightInit;
|
12
|
-
private downInit;
|
13
|
-
private upInit;
|
14
|
-
private targetMatrixSize;
|
15
|
-
/**
|
16
|
-
* @throws NotFoundException if image is too small to accommodate {@code initSize}
|
17
|
-
*/
|
18
|
-
constructor(image: BitMatrix, initSize: number, x: number, y: number, targetMatrixSize: number);
|
19
|
-
/**
|
20
|
-
* @throws NotFoundException if no Data Matrix Code can be found
|
21
|
-
*/
|
22
|
-
detect(): ResultPoint[];
|
23
|
-
private findCorners;
|
24
|
-
private getCornerFromArea;
|
25
|
-
/**
|
26
|
-
* Determines whether a segment contains a black point
|
27
|
-
*
|
28
|
-
* @param a min value of the scanned coordinate
|
29
|
-
* @param b max value of the scanned coordinate
|
30
|
-
* @param fixed value of fixed coordinate
|
31
|
-
* @param horizontal set to true if scan must be horizontal, false if vertical
|
32
|
-
* @return true if a black point has been found, else false.
|
33
|
-
*/
|
34
|
-
private containsBlackPoint;
|
35
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
import ResultPoint from '../../ResultPoint';
|
2
|
-
import BitMatrix from '../BitMatrix';
|
3
|
-
/**
|
4
|
-
* <p>
|
5
|
-
* Detects a candidate barcode-like rectangular region within an image. It
|
6
|
-
* starts around the center of the image, increases the size of the candidate
|
7
|
-
* region until it finds a white rectangular region. By keeping track of the
|
8
|
-
* last black points it encountered, it determines the corners of the barcode.
|
9
|
-
* </p>
|
10
|
-
*
|
11
|
-
* @author David Olivier
|
12
|
-
*/
|
13
|
-
export default class WhiteRectangleDetector {
|
14
|
-
private image;
|
15
|
-
private static INIT_SIZE;
|
16
|
-
private static CORR;
|
17
|
-
private height;
|
18
|
-
private width;
|
19
|
-
private leftInit;
|
20
|
-
private rightInit;
|
21
|
-
private downInit;
|
22
|
-
private upInit;
|
23
|
-
/**
|
24
|
-
* @param image barcode image to find a rectangle in
|
25
|
-
* @param initSize initial size of search area around center
|
26
|
-
* @param x x position of search center
|
27
|
-
* @param y y position of search center
|
28
|
-
* @throws NotFoundException if image is too small to accommodate {@code initSize}
|
29
|
-
*/
|
30
|
-
constructor(image: BitMatrix, initSize?: number, x?: number, y?: number);
|
31
|
-
/**
|
32
|
-
* <p>
|
33
|
-
* Detects a candidate barcode-like rectangular region within an image. It
|
34
|
-
* starts around the center of the image, increases the size of the candidate
|
35
|
-
* region until it finds a white rectangular region.
|
36
|
-
* </p>
|
37
|
-
*
|
38
|
-
* @return {@link ResultPoint}[] describing the corners of the rectangular
|
39
|
-
* region. The first and last points are opposed on the diagonal, as
|
40
|
-
* are the second and third. The first point will be the topmost
|
41
|
-
* point and the last, the bottommost. The second point will be
|
42
|
-
* leftmost and the third, the rightmost
|
43
|
-
* @throws NotFoundException if no Data Matrix Code can be found
|
44
|
-
*/
|
45
|
-
detect(): Array<ResultPoint>;
|
46
|
-
private getBlackPointOnSegment;
|
47
|
-
/**
|
48
|
-
* recenters the points of a constant distance towards the center
|
49
|
-
*
|
50
|
-
* @param y bottom most point
|
51
|
-
* @param z left most point
|
52
|
-
* @param x right most point
|
53
|
-
* @param t top most point
|
54
|
-
* @return {@link ResultPoint}[] describing the corners of the rectangular
|
55
|
-
* region. The first and last points are opposed on the diagonal, as
|
56
|
-
* are the second and third. The first point will be the topmost
|
57
|
-
* point and the last, the bottommost. The second point will be
|
58
|
-
* leftmost and the third, the rightmost
|
59
|
-
*/
|
60
|
-
private centerEdges;
|
61
|
-
/**
|
62
|
-
* Determines whether a segment contains a black point
|
63
|
-
*
|
64
|
-
* @param a min value of the scanned coordinate
|
65
|
-
* @param b max value of the scanned coordinate
|
66
|
-
* @param fixed value of fixed coordinate
|
67
|
-
* @param horizontal set to true if scan must be horizontal, false if vertical
|
68
|
-
* @return true if a black point has been found, else false.
|
69
|
-
*/
|
70
|
-
private containsBlackPoint;
|
71
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* <p>Represents a polynomial whose coefficients are elements of a GF.
|
3
|
-
* Instances of this class are immutable.</p>
|
4
|
-
*
|
5
|
-
* <p>Much credit is due to William Rucklidge since portions of this code are an indirect
|
6
|
-
* port of his C++ Reed-Solomon implementation.</p>
|
7
|
-
*
|
8
|
-
* @author Sean Owen
|
9
|
-
*/
|
10
|
-
export default abstract class AbstractGenericGFPoly {
|
11
|
-
protected field: any;
|
12
|
-
protected coefficients: any;
|
13
|
-
getCoefficients(): Int32Array;
|
14
|
-
/**
|
15
|
-
* @return degree of this polynomial
|
16
|
-
*/
|
17
|
-
getDegree(): number;
|
18
|
-
/**
|
19
|
-
* @return true iff this polynomial is the monomial "0"
|
20
|
-
*/
|
21
|
-
isZero(): boolean;
|
22
|
-
/**
|
23
|
-
* @return coefficient of x^degree term in this polynomial
|
24
|
-
*/
|
25
|
-
getCoefficient(degree: number): number;
|
26
|
-
/**
|
27
|
-
* @return evaluation of this polynomial at a given point
|
28
|
-
*/
|
29
|
-
evaluateAt(a: number): number;
|
30
|
-
abstract addOrSubtract(other: AbstractGenericGFPoly): AbstractGenericGFPoly;
|
31
|
-
abstract multiply(other: AbstractGenericGFPoly): AbstractGenericGFPoly;
|
32
|
-
abstract multiplyScalar(scalar: number): AbstractGenericGFPoly;
|
33
|
-
abstract multiplyByMonomial(degree: number, coefficient: number): AbstractGenericGFPoly;
|
34
|
-
abstract divide(other: AbstractGenericGFPoly): AbstractGenericGFPoly[];
|
35
|
-
toString(): string;
|
36
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import GenericGF from './GenericGF';
|
2
|
-
/**
|
3
|
-
* <p>Implements Reed-Solomon encoding, as the name implies.</p>
|
4
|
-
*
|
5
|
-
* @author Sean Owen
|
6
|
-
* @author William Rucklidge
|
7
|
-
*/
|
8
|
-
export default class ReedSolomonEncoder {
|
9
|
-
private field;
|
10
|
-
private cachedGenerators;
|
11
|
-
/**
|
12
|
-
* A reed solomon error-correcting encoding constructor is created by
|
13
|
-
* passing as Galois Field with of size equal to the number of code
|
14
|
-
* words (symbols) in the alphabet (the number of values in each
|
15
|
-
* element of arrays that are encoded/decoded).
|
16
|
-
* @param field A galois field with a number of elements equal to the size
|
17
|
-
* of the alphabet of symbols to encode.
|
18
|
-
*/
|
19
|
-
constructor(field: GenericGF);
|
20
|
-
private buildGenerator;
|
21
|
-
/**
|
22
|
-
* <p>Encode a sequence of code words (symbols) using Reed-Solomon to allow decoders
|
23
|
-
* to detect and correct errors that may have been introduced when the resulting
|
24
|
-
* data is stored or transmitted.</p>
|
25
|
-
*
|
26
|
-
* @param toEncode array used for both and output. Caller initializes the array with
|
27
|
-
* the code words (symbols) to be encoded followed by empty elements allocated to make
|
28
|
-
* space for error-correction code words in the encoded output. The array contains
|
29
|
-
* the encdoded output when encode returns. Code words are encoded as numbers from
|
30
|
-
* 0 to n-1, where n is the number of possible code words (symbols), as determined
|
31
|
-
* by the size of the Galois Field passed in the constructor of this object.
|
32
|
-
* @param ecBytes the number of elements reserved in the array (first parameter)
|
33
|
-
* to store error-correction code words. Thus, the number of code words (symbols)
|
34
|
-
* to encode in the first parameter is thus toEncode.length - ecBytes.
|
35
|
-
* Note, the use of "bytes" in the name of this parameter is misleading, as there may
|
36
|
-
* be more or fewer than 256 symbols being encoded, as determined by the number of
|
37
|
-
* elements in the Galois Field passed as a constructor to this object.
|
38
|
-
* @throws IllegalArgumentException thrown in response to validation errros.
|
39
|
-
*/
|
40
|
-
encode(toEncode: Int32Array, ecBytes: number): void;
|
41
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import BarcodeFormat from '../BarcodeFormat';
|
2
|
-
import BitMatrix from '../common/BitMatrix';
|
3
|
-
import EncodeHintType from '../EncodeHintType';
|
4
|
-
/**
|
5
|
-
* This object renders a QR Code as a BitMatrix 2D array of greyscale values.
|
6
|
-
*
|
7
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
8
|
-
*/
|
9
|
-
export default class QRCodeWriter {
|
10
|
-
private static QUIET_ZONE_SIZE;
|
11
|
-
encode(contents: string, format: BarcodeFormat, width: number, height: number, hints: Map<EncodeHintType, any>): BitMatrix;
|
12
|
-
private static renderResult;
|
13
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned
|
3
|
-
* -1, 0, and 1, I'm going to use less memory and go with bytes.
|
4
|
-
*
|
5
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
6
|
-
*/
|
7
|
-
export default class ByteMatrix {
|
8
|
-
private width;
|
9
|
-
private height;
|
10
|
-
private bytes;
|
11
|
-
constructor(width: number, height: number);
|
12
|
-
getHeight(): number;
|
13
|
-
getWidth(): number;
|
14
|
-
get(x: number, y: number): number;
|
15
|
-
/**
|
16
|
-
* @return an internal representation as bytes, in row-major order. array[y][x] represents point (x,y)
|
17
|
-
*/
|
18
|
-
getArray(): Array<Uint8Array>;
|
19
|
-
setNumber(x: number, y: number, value: number): void;
|
20
|
-
setBoolean(x: number, y: number, value: boolean): void;
|
21
|
-
clear(value: number): void;
|
22
|
-
equals(o: any): boolean;
|
23
|
-
toString(): string;
|
24
|
-
}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
import ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';
|
2
|
-
import Mode from '../decoder/Mode';
|
3
|
-
import Version from '../decoder/Version';
|
4
|
-
import QRCode from './QRCode';
|
5
|
-
/**
|
6
|
-
* @author satorux@google.com (Satoru Takabayashi) - creator
|
7
|
-
* @author dswitkin@google.com (Daniel Switkin) - ported from C++
|
8
|
-
*/
|
9
|
-
export default class Encoder {
|
10
|
-
private static ALPHANUMERIC_TABLE;
|
11
|
-
static DEFAULT_BYTE_MODE_ENCODING: string;
|
12
|
-
private constructor();
|
13
|
-
private static calculateMaskPenalty;
|
14
|
-
/**
|
15
|
-
* @param content text to encode
|
16
|
-
* @param ecLevel error correction level to use
|
17
|
-
* @return {@link QRCode} representing the encoded QR code
|
18
|
-
* @throws WriterException if encoding can't succeed, because of for example invalid content
|
19
|
-
* or configuration
|
20
|
-
*/
|
21
|
-
static encode(content: string, ecLevel: ErrorCorrectionLevel, hints?: Map<EncodeHintType, any>): QRCode;
|
22
|
-
/**
|
23
|
-
* Decides the smallest version of QR code that will contain all of the provided data.
|
24
|
-
*
|
25
|
-
* @throws WriterException if the data cannot fit in any version
|
26
|
-
*/
|
27
|
-
private static recommendVersion;
|
28
|
-
private static calculateBitsNeeded;
|
29
|
-
/**
|
30
|
-
* @return the code point of the table used in alphanumeric mode or
|
31
|
-
* -1 if there is no corresponding code in the table.
|
32
|
-
*/
|
33
|
-
static getAlphanumericCode(code: number): number;
|
34
|
-
/**
|
35
|
-
* Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
|
36
|
-
* if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
|
37
|
-
*/
|
38
|
-
static chooseMode(content: string, encoding?: string): Mode;
|
39
|
-
private static isOnlyDoubleByteKanji;
|
40
|
-
private static chooseMaskPattern;
|
41
|
-
private static chooseVersion;
|
42
|
-
/**
|
43
|
-
* @return true if the number of input bits will fit in a code with the specified version and
|
44
|
-
* error correction level.
|
45
|
-
*/
|
46
|
-
private static willFit;
|
47
|
-
/**
|
48
|
-
* Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).
|
49
|
-
*/
|
50
|
-
static terminateBits(numDataBytes: number, bits: BitArray): void;
|
51
|
-
/**
|
52
|
-
* Get number of data bytes and number of error correction bytes for block id "blockID". Store
|
53
|
-
* the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of
|
54
|
-
* JISX0510:2004 (p.30)
|
55
|
-
*/
|
56
|
-
static getNumDataBytesAndNumECBytesForBlockID(numTotalBytes: number, numDataBytes: number, numRSBlocks: number, blockID: number, numDataBytesInBlock: Int32Array, numECBytesInBlock: Int32Array): void;
|
57
|
-
/**
|
58
|
-
* Interleave "bits" with corresponding error correction bytes. On success, store the result in
|
59
|
-
* "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.
|
60
|
-
*/
|
61
|
-
static interleaveWithECBytes(bits: BitArray, numTotalBytes: number, numDataBytes: number, numRSBlocks: number): BitArray;
|
62
|
-
static generateECBytes(dataBytes: Uint8Array, numEcBytesInBlock: number): Uint8Array;
|
63
|
-
/**
|
64
|
-
* Append mode info. On success, store the result in "bits".
|
65
|
-
*/
|
66
|
-
static appendModeInfo(mode: Mode, bits: BitArray): void;
|
67
|
-
/**
|
68
|
-
* Append length info. On success, store the result in "bits".
|
69
|
-
*/
|
70
|
-
static appendLengthInfo(numLetters: number, version: Version, mode: Mode, bits: BitArray): void;
|
71
|
-
/**
|
72
|
-
* Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
|
73
|
-
*/
|
74
|
-
static appendBytes(content: string, mode: Mode, bits: BitArray, encoding: string): void;
|
75
|
-
private static getDigit;
|
76
|
-
private static isDigit;
|
77
|
-
static appendNumericBytes(content: string, bits: BitArray): void;
|
78
|
-
static appendAlphanumericBytes(content: string, bits: BitArray): void;
|
79
|
-
static append8BitBytes(content: string, bits: BitArray, encoding: string): void;
|
80
|
-
/**
|
81
|
-
* @throws WriterException
|
82
|
-
*/
|
83
|
-
static appendKanjiBytes(content: string, bits: BitArray): void;
|
84
|
-
private static appendECI;
|
85
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import ByteMatrix from './ByteMatrix';
|
2
|
-
/**
|
3
|
-
* @author Satoru Takabayashi
|
4
|
-
* @author Daniel Switkin
|
5
|
-
* @author Sean Owen
|
6
|
-
*/
|
7
|
-
export default class MaskUtil {
|
8
|
-
private static N1;
|
9
|
-
private static N2;
|
10
|
-
private static N3;
|
11
|
-
private static N4;
|
12
|
-
private constructor();
|
13
|
-
/**
|
14
|
-
* Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
|
15
|
-
* give penalty to them. Example: 00000 or 11111.
|
16
|
-
*/
|
17
|
-
static applyMaskPenaltyRule1(matrix: ByteMatrix): number;
|
18
|
-
/**
|
19
|
-
* Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
|
20
|
-
* penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a
|
21
|
-
* penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
|
22
|
-
*/
|
23
|
-
static applyMaskPenaltyRule2(matrix: ByteMatrix): number;
|
24
|
-
/**
|
25
|
-
* Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
|
26
|
-
* starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
|
27
|
-
* find patterns like 000010111010000, we give penalty once.
|
28
|
-
*/
|
29
|
-
static applyMaskPenaltyRule3(matrix: ByteMatrix): number;
|
30
|
-
private static isWhiteHorizontal;
|
31
|
-
private static isWhiteVertical;
|
32
|
-
/**
|
33
|
-
* Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
|
34
|
-
* penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
|
35
|
-
*/
|
36
|
-
static applyMaskPenaltyRule4(matrix: ByteMatrix): number;
|
37
|
-
/**
|
38
|
-
* Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask
|
39
|
-
* pattern conditions.
|
40
|
-
*/
|
41
|
-
static getDataMaskBit(maskPattern: number, x: number, y: number): boolean;
|
42
|
-
/**
|
43
|
-
* Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both
|
44
|
-
* vertical and horizontal orders respectively.
|
45
|
-
*/
|
46
|
-
private static applyMaskPenaltyRule1Internal;
|
47
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import BitArray from '../../common/BitArray';
|
2
|
-
import ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';
|
3
|
-
import Version from '../decoder/Version';
|
4
|
-
import ByteMatrix from './ByteMatrix';
|
5
|
-
/**
|
6
|
-
* @author satorux@google.com (Satoru Takabayashi) - creator
|
7
|
-
* @author dswitkin@google.com (Daniel Switkin) - ported from C++
|
8
|
-
*/
|
9
|
-
export default class MatrixUtil {
|
10
|
-
private constructor();
|
11
|
-
private static POSITION_DETECTION_PATTERN;
|
12
|
-
private static POSITION_ADJUSTMENT_PATTERN;
|
13
|
-
private static POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE;
|
14
|
-
private static TYPE_INFO_COORDINATES;
|
15
|
-
private static VERSION_INFO_POLY;
|
16
|
-
private static TYPE_INFO_POLY;
|
17
|
-
private static TYPE_INFO_MASK_PATTERN;
|
18
|
-
static clearMatrix(matrix: ByteMatrix): void;
|
19
|
-
static buildMatrix(dataBits: BitArray, ecLevel: ErrorCorrectionLevel, version: Version, maskPattern: number, matrix: ByteMatrix): void;
|
20
|
-
static embedBasicPatterns(version: Version, matrix: ByteMatrix): void;
|
21
|
-
static embedTypeInfo(ecLevel: ErrorCorrectionLevel, maskPattern: number, matrix: ByteMatrix): void;
|
22
|
-
static maybeEmbedVersionInfo(version: Version, matrix: ByteMatrix): void;
|
23
|
-
static embedDataBits(dataBits: BitArray, maskPattern: number, matrix: ByteMatrix): void;
|
24
|
-
static findMSBSet(value: number): number;
|
25
|
-
static calculateBCHCode(value: number, poly: number): number;
|
26
|
-
static makeTypeInfoBits(ecLevel: ErrorCorrectionLevel, maskPattern: number, bits: BitArray): void;
|
27
|
-
static makeVersionInfoBits(version: Version, bits: BitArray): void;
|
28
|
-
private static isEmpty;
|
29
|
-
private static embedTimingPatterns;
|
30
|
-
private static embedDarkDotAtLeftBottomCorner;
|
31
|
-
private static embedHorizontalSeparationPattern;
|
32
|
-
private static embedVerticalSeparationPattern;
|
33
|
-
private static embedPositionAdjustmentPattern;
|
34
|
-
private static embedPositionDetectionPattern;
|
35
|
-
private static embedPositionDetectionPatternsAndSeparators;
|
36
|
-
private static maybeEmbedPositionAdjustmentPatterns;
|
37
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';
|
2
|
-
import Mode from '../decoder/Mode';
|
3
|
-
import Version from '../decoder/Version';
|
4
|
-
import ByteMatrix from './ByteMatrix';
|
5
|
-
/**
|
6
|
-
* @author satorux@google.com (Satoru Takabayashi) - creator
|
7
|
-
* @author dswitkin@google.com (Daniel Switkin) - ported from C++
|
8
|
-
*/
|
9
|
-
export default class QRCode {
|
10
|
-
static NUM_MASK_PATTERNS: number;
|
11
|
-
private mode;
|
12
|
-
private ecLevel;
|
13
|
-
private version;
|
14
|
-
private maskPattern;
|
15
|
-
private matrix;
|
16
|
-
constructor();
|
17
|
-
getMode(): Mode;
|
18
|
-
getECLevel(): ErrorCorrectionLevel;
|
19
|
-
getVersion(): Version;
|
20
|
-
getMaskPattern(): number;
|
21
|
-
getMatrix(): ByteMatrix;
|
22
|
-
toString(): string;
|
23
|
-
setMode(value: Mode): void;
|
24
|
-
setECLevel(value: ErrorCorrectionLevel): void;
|
25
|
-
setVersion(version: Version): void;
|
26
|
-
setMaskPattern(value: number): void;
|
27
|
-
setMatrix(value: ByteMatrix): void;
|
28
|
-
static isValidMaskPattern(maskPattern: number): boolean;
|
29
|
-
}
|