@qr-platform/qr-code.js 0.8.17
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/.github/workflows/publish.yml +18 -0
- package/CHANGELOG.md +233 -0
- package/LICENSE.md +77 -0
- package/README.md +188 -0
- package/docs/advanced-examples.md +523 -0
- package/docs/api-reference-guide.md +254 -0
- package/docs/documentation.md +1592 -0
- package/docs/examples.md +322 -0
- package/docs/license-management.md +501 -0
- package/docs/typescript-types-definitions.md +372 -0
- package/docs/usage-guide.md +622 -0
- package/lib/core/qr-code-js.d.ts +48 -0
- package/lib/core/qr-constant.d.ts +9 -0
- package/lib/core/qr-options-validation.d.ts +13 -0
- package/lib/core/qr-svg.d.ts +76 -0
- package/lib/core/qr-templates.d.ts +6 -0
- package/lib/figures/corner-dot.d.ts +24 -0
- package/lib/figures/corner-square.d.ts +24 -0
- package/lib/figures/dot.d.ts +31 -0
- package/lib/index.d.ts +52 -0
- package/lib/lib/image/GIFImage.d.ts +19 -0
- package/lib/lib/io/Base64.d.ts +10 -0
- package/lib/lib/io/Base64DecodeInputStream.d.ts +15 -0
- package/lib/lib/io/Base64EncodeOutputStream.d.ts +17 -0
- package/lib/lib/io/ByteArrayInputStream.d.ts +12 -0
- package/lib/lib/io/ByteArrayOutputStream.d.ts +12 -0
- package/lib/lib/io/InputStream.d.ts +10 -0
- package/lib/lib/io/OutputStream.d.ts +12 -0
- package/lib/lib/qr-code.d.ts +5 -0
- package/lib/lib/qrcode/BitBuffer.d.ts +11 -0
- package/lib/lib/qrcode/ErrorCorrectLevel.d.ts +23 -0
- package/lib/lib/qrcode/MaskPattern.d.ts +39 -0
- package/lib/lib/qrcode/Mode.d.ts +23 -0
- package/lib/lib/qrcode/Polynomial.d.ts +15 -0
- package/lib/lib/qrcode/QR8BitByte.d.ts +13 -0
- package/lib/lib/qrcode/QRAlphaNum.d.ts +13 -0
- package/lib/lib/qrcode/QRCode.d.ts +22 -0
- package/lib/lib/qrcode/QRCodeMinimal.d.ts +58 -0
- package/lib/lib/qrcode/QRData.d.ts +17 -0
- package/lib/lib/qrcode/QRKanji.d.ts +13 -0
- package/lib/lib/qrcode/QRMath.d.ts +13 -0
- package/lib/lib/qrcode/QRNumber.d.ts +14 -0
- package/lib/lib/qrcode/QRUtil.d.ts +25 -0
- package/lib/lib/qrcode/RSBlock.d.ts +16 -0
- package/lib/lib/text/createStringToBytes.d.ts +9 -0
- package/lib/lib/text/stringToBytes_SJIS.d.ts +8 -0
- package/lib/lib/text/stringToBytes_UTF8.d.ts +7 -0
- package/lib/lib/zbar-wasm/index.d.ts +1 -0
- package/lib/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +410 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeReader.d.ts +29 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeSvgWriter.d.ts +46 -0
- package/lib/lib/zxing-js/src/browser/BrowserSvgCodeWriter.d.ts +49 -0
- package/lib/lib/zxing-js/src/browser/DecodeContinuouslyCallback.d.ts +6 -0
- package/lib/lib/zxing-js/src/browser/HTMLCanvasElementLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/browser/HTMLVisualMediaElement.d.ts +4 -0
- package/lib/lib/zxing-js/src/browser/VideoInputDevice.d.ts +22 -0
- package/lib/lib/zxing-js/src/browser.d.ts +3 -0
- package/lib/lib/zxing-js/src/core/ArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArithmeticException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArrayIndexOutOfBoundsException.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/BarcodeFormat.d.ts +42 -0
- package/lib/lib/zxing-js/src/core/Binarizer.d.ts +53 -0
- package/lib/lib/zxing-js/src/core/BinaryBitmap.d.ts +78 -0
- package/lib/lib/zxing-js/src/core/ChecksumException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/DecodeHintType.d.ts +91 -0
- package/lib/lib/zxing-js/src/core/Dimension.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/EncodeHintType.d.ts +99 -0
- package/lib/lib/zxing-js/src/core/Exception.d.ts +17 -0
- package/lib/lib/zxing-js/src/core/FormatException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/HighContrastLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/core/IllegalArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IllegalStateException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IndexOutOfBoundsException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/InvertedLuminanceSource.d.ts +22 -0
- package/lib/lib/zxing-js/src/core/LuminanceSource.d.ts +84 -0
- package/lib/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/NotFoundException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/NullPointerException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/OutOfMemoryError.d.ts +6 -0
- package/lib/lib/zxing-js/src/core/PlanarYUVLuminanceSource.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/RGBLuminanceSource.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/Reader.d.ts +49 -0
- package/lib/lib/zxing-js/src/core/ReaderException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ReedSolomonException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Result.d.ts +52 -0
- package/lib/lib/zxing-js/src/core/ResultMetadataType.d.ts +68 -0
- package/lib/lib/zxing-js/src/core/ResultPoint.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/ResultPointCallback.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/UniversalLuminanceSource.d.ts +46 -0
- package/lib/lib/zxing-js/src/core/UnsupportedOperationException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Writer.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/WriterException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/common/BitArray.d.ts +111 -0
- package/lib/lib/zxing-js/src/core/common/BitMatrix.d.ts +98 -0
- package/lib/lib/zxing-js/src/core/common/BitSource.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/common/CharacterSetECI.d.ts +89 -0
- package/lib/lib/zxing-js/src/core/common/DecoderResult.d.ts +64 -0
- package/lib/lib/zxing-js/src/core/common/DefaultGridSampler.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/common/DetectorResult.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/common/ECIEncoderSet.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/common/ECIInput.d.ts +79 -0
- package/lib/lib/zxing-js/src/core/common/GlobalHistogramBinarizer.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/common/GridSampler.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/GridSamplerInstance.d.ts +18 -0
- package/lib/lib/zxing-js/src/core/common/HybridBinarizer.d.ts +54 -0
- package/lib/lib/zxing-js/src/core/common/MinimalECIInput.d.ts +123 -0
- package/lib/lib/zxing-js/src/core/common/PerspectiveTransform.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/common/StringUtils.d.ts +48 -0
- package/lib/lib/zxing-js/src/core/common/detector/CornerDetector.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/common/detector/MathUtils.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/detector/WhiteRectangleDetector.d.ts +71 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGF.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGFPoly.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGF.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGFPoly.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonDecoder.d.ts +40 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonEncoder.d.ts +41 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeReader.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeWriter.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/BitMatrixParser.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataBlock.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataMask.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DecodedBitStreamParser.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Decoder.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECB.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECBlocks.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ErrorCorrectionLevel.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/FormatInformation.d.ts +33 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Mode.d.ts +56 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/QRCodeDecoderMetaData.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Version.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPattern.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPatternFinder.d.ts +82 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/Detector.d.ts +87 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPattern.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternFinder.d.ts +114 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternInfo.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/BlockPair.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/ByteMatrix.d.ts +24 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/Encoder.d.ts +85 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MaskUtil.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MatrixUtil.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/QRCode.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/util/Arrays.d.ts +45 -0
- package/lib/lib/zxing-js/src/core/util/ByteArrayOutputStream.d.ts +174 -0
- package/lib/lib/zxing-js/src/core/util/Charset.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/Collections.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/util/Float.d.ts +14 -0
- package/lib/lib/zxing-js/src/core/util/Formatter.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/util/Integer.d.ts +19 -0
- package/lib/lib/zxing-js/src/core/util/Long.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/util/OutputStream.d.ts +106 -0
- package/lib/lib/zxing-js/src/core/util/StandardCharsets.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/StringBuilder.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/util/StringEncoding.d.ts +51 -0
- package/lib/lib/zxing-js/src/core/util/System.d.ts +10 -0
- package/lib/lib/zxing-js/src/customTypings.d.ts +16 -0
- package/lib/lib/zxing-js/src/index.d.ts +5 -0
- package/lib/lib/zxing-js/src/node.d.ts +1 -0
- package/lib/license/LicenseManager.d.ts +69 -0
- package/lib/license/LicenseManagerNode.d.ts +64 -0
- package/lib/node.d.ts +37 -0
- package/lib/options-demo.d.ts +239 -0
- package/lib/plugins/QRBorderHelpers.d.ts +32 -0
- package/lib/plugins/QRBorderPlugin.d.ts +35 -0
- package/lib/plugins/QRValidatorZbar.d.ts +38 -0
- package/lib/plugins/QRValidatorZbarNode.d.ts +60 -0
- package/lib/plugins/QRValidatorZbarNodeSharp.d.ts +83 -0
- package/lib/qr-code-js-node.js +1 -0
- package/lib/qr-code-js.js +1 -0
- package/lib/templates/borders-inner-outter.d.ts +129 -0
- package/lib/templates/borders-inner-scale-offset.d.ts +497 -0
- package/lib/templates/borders-inner.d.ts +129 -0
- package/lib/templates/borders-no-license.d.ts +129 -0
- package/lib/templates/borders-outter.d.ts +129 -0
- package/lib/templates/borders-text-auto-curved.d.ts +129 -0
- package/lib/templates/borders-text-full-curved.d.ts +133 -0
- package/lib/templates/borders.d.ts +129 -0
- package/lib/templates/scales.d.ts +130 -0
- package/lib/templates/scan-validators/index.d.ts +1 -0
- package/lib/templates/scan-validators/tests/cases/basic-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/basic-no-license.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/basic.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/colors-inverted.d.ts +2 -0
- package/lib/templates/scan-validators/tests/cases/colors.d.ts +58 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position.d.ts +3 -0
- package/lib/templates/scan-validators/tests/index.d.ts +27 -0
- package/lib/tools/browser-image-tools.d.ts +7 -0
- package/lib/tools/browser-utils.d.ts +18 -0
- package/lib/types/helper.d.ts +23 -0
- package/lib/utils/canvas-options.d.ts +7 -0
- package/lib/utils/color.d.ts +4 -0
- package/lib/utils/gradient.d.ts +26 -0
- package/lib/utils/image.d.ts +16 -0
- package/lib/utils/merge.d.ts +5 -0
- package/lib/utils/options.d.ts +220 -0
- package/lib/utils/qrcode.d.ts +8 -0
- package/lib/utils/scan-validator-node.d.ts +15 -0
- package/lib/utils/scan-validators/abstract-scan-validator.d.ts +43 -0
- package/lib/utils/scan-validators/zbar-scan-validator.d.ts +8 -0
- package/lib/utils/scan-validators/zxing-canvas-scan-validator.d.ts +10 -0
- package/lib/utils/scan-validators/zxing-scan-validator.d.ts +8 -0
- package/lib/utils/svg.d.ts +2 -0
- package/lib/utils/token-validator.d.ts +19 -0
- package/package.json +80 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
export declare enum CharacterSetValueIdentifiers {
|
2
|
+
Cp437 = 0,
|
3
|
+
ISO8859_1 = 1,
|
4
|
+
ISO8859_2 = 2,
|
5
|
+
ISO8859_3 = 3,
|
6
|
+
ISO8859_4 = 4,
|
7
|
+
ISO8859_5 = 5,
|
8
|
+
ISO8859_6 = 6,
|
9
|
+
ISO8859_7 = 7,
|
10
|
+
ISO8859_8 = 8,
|
11
|
+
ISO8859_9 = 9,
|
12
|
+
ISO8859_10 = 10,
|
13
|
+
ISO8859_11 = 11,
|
14
|
+
ISO8859_13 = 12,
|
15
|
+
ISO8859_14 = 13,
|
16
|
+
ISO8859_15 = 14,
|
17
|
+
ISO8859_16 = 15,
|
18
|
+
SJIS = 16,
|
19
|
+
Cp1250 = 17,
|
20
|
+
Cp1251 = 18,
|
21
|
+
Cp1252 = 19,
|
22
|
+
Cp1256 = 20,
|
23
|
+
UnicodeBigUnmarked = 21,
|
24
|
+
UTF8 = 22,
|
25
|
+
ASCII = 23,
|
26
|
+
Big5 = 24,
|
27
|
+
GB18030 = 25,
|
28
|
+
EUC_KR = 26
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1
|
32
|
+
* of ISO 18004.
|
33
|
+
*
|
34
|
+
* @author Sean Owen
|
35
|
+
*/
|
36
|
+
export default class CharacterSetECI {
|
37
|
+
valueIdentifier: CharacterSetValueIdentifiers;
|
38
|
+
name: string;
|
39
|
+
private static VALUE_IDENTIFIER_TO_ECI;
|
40
|
+
private static VALUES_TO_ECI;
|
41
|
+
private static NAME_TO_ECI;
|
42
|
+
static readonly Cp437: CharacterSetECI;
|
43
|
+
static readonly ISO8859_1: CharacterSetECI;
|
44
|
+
static readonly ISO8859_2: CharacterSetECI;
|
45
|
+
static readonly ISO8859_3: CharacterSetECI;
|
46
|
+
static readonly ISO8859_4: CharacterSetECI;
|
47
|
+
static readonly ISO8859_5: CharacterSetECI;
|
48
|
+
static readonly ISO8859_6: CharacterSetECI;
|
49
|
+
static readonly ISO8859_7: CharacterSetECI;
|
50
|
+
static readonly ISO8859_8: CharacterSetECI;
|
51
|
+
static readonly ISO8859_9: CharacterSetECI;
|
52
|
+
static readonly ISO8859_10: CharacterSetECI;
|
53
|
+
static readonly ISO8859_11: CharacterSetECI;
|
54
|
+
static readonly ISO8859_13: CharacterSetECI;
|
55
|
+
static readonly ISO8859_14: CharacterSetECI;
|
56
|
+
static readonly ISO8859_15: CharacterSetECI;
|
57
|
+
static readonly ISO8859_16: CharacterSetECI;
|
58
|
+
static readonly SJIS: CharacterSetECI;
|
59
|
+
static readonly Cp1250: CharacterSetECI;
|
60
|
+
static readonly Cp1251: CharacterSetECI;
|
61
|
+
static readonly Cp1252: CharacterSetECI;
|
62
|
+
static readonly Cp1256: CharacterSetECI;
|
63
|
+
static readonly UnicodeBigUnmarked: CharacterSetECI;
|
64
|
+
static readonly UTF8: CharacterSetECI;
|
65
|
+
static readonly ASCII: CharacterSetECI;
|
66
|
+
static readonly Big5: CharacterSetECI;
|
67
|
+
static readonly GB18030: CharacterSetECI;
|
68
|
+
static readonly EUC_KR: CharacterSetECI;
|
69
|
+
values: Int32Array;
|
70
|
+
otherEncodingNames: string[];
|
71
|
+
constructor(valueIdentifier: CharacterSetValueIdentifiers, valuesParam: Int32Array | number, name: string, ...otherEncodingNames: string[]);
|
72
|
+
getValueIdentifier(): CharacterSetValueIdentifiers;
|
73
|
+
getName(): string;
|
74
|
+
getValue(): number;
|
75
|
+
/**
|
76
|
+
* @param value character set ECI value
|
77
|
+
* @return {@code CharacterSetECI} representing ECI of given value, or null if it is legal but
|
78
|
+
* unsupported
|
79
|
+
* @throws FormatException if ECI value is invalid
|
80
|
+
*/
|
81
|
+
static getCharacterSetECIByValue(value: number): CharacterSetECI;
|
82
|
+
/**
|
83
|
+
* @param name character set ECI encoding name
|
84
|
+
* @return CharacterSetECI representing ECI for character encoding, or null if it is legal
|
85
|
+
* but unsupported
|
86
|
+
*/
|
87
|
+
static getCharacterSetECIByName(name: string): CharacterSetECI;
|
88
|
+
equals(o: CharacterSetECI): boolean;
|
89
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* <p>Encapsulates the result of decoding a matrix of bits. This typically
|
3
|
+
* applies to 2D barcode formats. For now it contains the raw bytes obtained,
|
4
|
+
* as well as a String interpretation of those bytes, if applicable.</p>
|
5
|
+
*
|
6
|
+
* @author Sean Owen
|
7
|
+
*/
|
8
|
+
export default class DecoderResult {
|
9
|
+
private rawBytes;
|
10
|
+
private text;
|
11
|
+
private byteSegments;
|
12
|
+
private ecLevel;
|
13
|
+
private structuredAppendSequenceNumber;
|
14
|
+
private structuredAppendParity;
|
15
|
+
private numBits;
|
16
|
+
private errorsCorrected;
|
17
|
+
private erasures;
|
18
|
+
private other;
|
19
|
+
constructor(rawBytes: Uint8Array, text: string, byteSegments: Uint8Array[], ecLevel: string, structuredAppendSequenceNumber?: number, structuredAppendParity?: number);
|
20
|
+
/**
|
21
|
+
* @return raw bytes representing the result, or {@code null} if not applicable
|
22
|
+
*/
|
23
|
+
getRawBytes(): Uint8Array;
|
24
|
+
/**
|
25
|
+
* @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
|
26
|
+
* @since 3.3.0
|
27
|
+
*/
|
28
|
+
getNumBits(): number;
|
29
|
+
/**
|
30
|
+
* @param numBits overrides the number of bits that are valid in {@link #getRawBytes()}
|
31
|
+
* @since 3.3.0
|
32
|
+
*/
|
33
|
+
setNumBits(numBits: number): void;
|
34
|
+
/**
|
35
|
+
* @return text representation of the result
|
36
|
+
*/
|
37
|
+
getText(): string;
|
38
|
+
/**
|
39
|
+
* @return list of byte segments in the result, or {@code null} if not applicable
|
40
|
+
*/
|
41
|
+
getByteSegments(): Uint8Array[];
|
42
|
+
/**
|
43
|
+
* @return name of error correction level used, or {@code null} if not applicable
|
44
|
+
*/
|
45
|
+
getECLevel(): string;
|
46
|
+
/**
|
47
|
+
* @return number of errors corrected, or {@code null} if not applicable
|
48
|
+
*/
|
49
|
+
getErrorsCorrected(): number | undefined;
|
50
|
+
setErrorsCorrected(errorsCorrected: number): void;
|
51
|
+
/**
|
52
|
+
* @return number of erasures corrected, or {@code null} if not applicable
|
53
|
+
*/
|
54
|
+
getErasures(): number | undefined;
|
55
|
+
setErasures(erasures: number): void;
|
56
|
+
/**
|
57
|
+
* @return arbitrary additional metadata
|
58
|
+
*/
|
59
|
+
getOther(): any;
|
60
|
+
setOther(other: any): void;
|
61
|
+
hasStructuredAppend(): boolean;
|
62
|
+
getStructuredAppendParity(): number;
|
63
|
+
getStructuredAppendSequenceNumber(): number;
|
64
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import BitMatrix from './BitMatrix';
|
2
|
+
import GridSampler from './GridSampler';
|
3
|
+
import PerspectiveTransform from './PerspectiveTransform';
|
4
|
+
/**
|
5
|
+
* @author Sean Owen
|
6
|
+
*/
|
7
|
+
export default class DefaultGridSampler extends GridSampler {
|
8
|
+
sampleGrid(image: BitMatrix, dimensionX: number, dimensionY: number, p1ToX: number, p1ToY: number, p2ToX: number, p2ToY: number, p3ToX: number, p3ToY: number, p4ToX: number, p4ToY: number, p1FromX: number, p1FromY: number, p2FromX: number, p2FromY: number, p3FromX: number, p3FromY: number, p4FromX: number, p4FromY: number): BitMatrix;
|
9
|
+
sampleGridWithTransform(image: BitMatrix, dimensionX: number, dimensionY: number, transform: PerspectiveTransform): BitMatrix;
|
10
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import ResultPoint from '../ResultPoint';
|
2
|
+
import BitMatrix from './BitMatrix';
|
3
|
+
/**
|
4
|
+
* <p>Encapsulates the result of detecting a barcode in an image. This includes the raw
|
5
|
+
* matrix of black/white pixels corresponding to the barcode, and possibly points of interest
|
6
|
+
* in the image, like the location of finder patterns or corners of the barcode in the image.</p>
|
7
|
+
*
|
8
|
+
* @author Sean Owen
|
9
|
+
*/
|
10
|
+
export default class DetectorResult {
|
11
|
+
private bits;
|
12
|
+
private points;
|
13
|
+
constructor(bits: BitMatrix, points: Array<ResultPoint>);
|
14
|
+
getBits(): BitMatrix;
|
15
|
+
getPoints(): Array<ResultPoint>;
|
16
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* Set of CharsetEncoders for a given input string
|
3
|
+
*
|
4
|
+
* Invariants:
|
5
|
+
* - The list contains only encoders from CharacterSetECI (list is shorter then the list of encoders available on
|
6
|
+
* the platform for which ECI values are defined).
|
7
|
+
* - The list contains encoders at least one encoder for every character in the input.
|
8
|
+
* - The first encoder in the list is always the ISO-8859-1 encoder even of no character in the input can be encoded
|
9
|
+
* by it.
|
10
|
+
* - If the input contains a character that is not in ISO-8859-1 then the last two entries in the list will be the
|
11
|
+
* UTF-8 encoder and the UTF-16BE encoder.
|
12
|
+
*
|
13
|
+
* @author Alex Geller
|
14
|
+
*/
|
15
|
+
import { char } from '../../customTypings';
|
16
|
+
import Charset from '../util/Charset';
|
17
|
+
export declare class ECIEncoderSet {
|
18
|
+
private readonly ENCODERS;
|
19
|
+
private encoders;
|
20
|
+
private priorityEncoderIndex;
|
21
|
+
/**
|
22
|
+
* Constructs an encoder set
|
23
|
+
*
|
24
|
+
* @param stringToEncode the string that needs to be encoded
|
25
|
+
* @param priorityCharset The preferred {@link Charset} or null.
|
26
|
+
* @param fnc1 fnc1 denotes the character in the input that represents the FNC1 character or -1 for a non-GS1 bar
|
27
|
+
* code. When specified, it is considered an error to pass it as argument to the methods canEncode() or encode().
|
28
|
+
*/
|
29
|
+
constructor(stringToEncode: string, priorityCharset: Charset, fnc1: number);
|
30
|
+
length(): number;
|
31
|
+
getCharsetName(index: number): string;
|
32
|
+
getCharset(index: number): Charset;
|
33
|
+
getECIValue(encoderIndex: number): number;
|
34
|
+
getPriorityEncoderIndex(): number;
|
35
|
+
canEncode(c: char, encoderIndex: number): boolean;
|
36
|
+
encode(c: char, encoderIndex: number): Uint8Array;
|
37
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
export default interface ECIInput {
|
2
|
+
/**
|
3
|
+
* Returns the length of this input. The length is the number
|
4
|
+
* of {@code byte}s in or ECIs in the sequence.
|
5
|
+
*
|
6
|
+
* @return the number of {@code char}s in this sequence
|
7
|
+
*/
|
8
|
+
length(): number;
|
9
|
+
/**
|
10
|
+
* Returns the {@code byte} value at the specified index. An index ranges from zero
|
11
|
+
* to {@code length() - 1}. The first {@code byte} value of the sequence is at
|
12
|
+
* index zero, the next at index one, and so on, as for array
|
13
|
+
* indexing.
|
14
|
+
*
|
15
|
+
* @param index the index of the {@code byte} value to be returned
|
16
|
+
*
|
17
|
+
* @return the specified {@code byte} value as character or the FNC1 character
|
18
|
+
*
|
19
|
+
* @throws IndexOutOfBoundsException
|
20
|
+
* if the {@code index} argument is negative or not less than
|
21
|
+
* {@code length()}
|
22
|
+
* @throws IllegalArgumentException
|
23
|
+
* if the value at the {@code index} argument is an ECI (@see #isECI)
|
24
|
+
*/
|
25
|
+
charAt(index: number): number;
|
26
|
+
/**
|
27
|
+
* Returns a {@code CharSequence} that is a subsequence of this sequence.
|
28
|
+
* The subsequence starts with the {@code char} value at the specified index and
|
29
|
+
* ends with the {@code char} value at index {@code end - 1}. The length
|
30
|
+
* (in {@code char}s) of the
|
31
|
+
* returned sequence is {@code end - start}, so if {@code start == end}
|
32
|
+
* then an empty sequence is returned.
|
33
|
+
*
|
34
|
+
* @param start the start index, inclusive
|
35
|
+
* @param end the end index, exclusive
|
36
|
+
*
|
37
|
+
* @return the specified subsequence
|
38
|
+
*
|
39
|
+
* @throws IndexOutOfBoundsException
|
40
|
+
* if {@code start} or {@code end} are negative,
|
41
|
+
* if {@code end} is greater than {@code length()},
|
42
|
+
* or if {@code start} is greater than {@code end}
|
43
|
+
* @throws IllegalArgumentException
|
44
|
+
* if a value in the range {@code start}-{@code end} is an ECI (@see #isECI)
|
45
|
+
*/
|
46
|
+
subSequence(start: number, end: number): string;
|
47
|
+
/**
|
48
|
+
* Determines if a value is an ECI
|
49
|
+
*
|
50
|
+
* @param index the index of the value
|
51
|
+
*
|
52
|
+
* @return true if the value at position {@code index} is an ECI
|
53
|
+
*
|
54
|
+
* @throws IndexOutOfBoundsException
|
55
|
+
* if the {@code index} argument is negative or not less than
|
56
|
+
* {@code length()}
|
57
|
+
*/
|
58
|
+
isECI(index: number): boolean;
|
59
|
+
/**
|
60
|
+
* Returns the {@code int} ECI value at the specified index. An index ranges from zero
|
61
|
+
* to {@code length() - 1}. The first {@code byte} value of the sequence is at
|
62
|
+
* index zero, the next at index one, and so on, as for array
|
63
|
+
* indexing.
|
64
|
+
*
|
65
|
+
* @param index the index of the {@code int} value to be returned
|
66
|
+
*
|
67
|
+
* @return the specified {@code int} ECI value.
|
68
|
+
* The ECI specified the encoding of all bytes with a higher index until the
|
69
|
+
* next ECI or until the end of the input if no other ECI follows.
|
70
|
+
*
|
71
|
+
* @throws IndexOutOfBoundsException
|
72
|
+
* if the {@code index} argument is negative or not less than
|
73
|
+
* {@code length()}
|
74
|
+
* @throws IllegalArgumentException
|
75
|
+
* if the value at the {@code index} argument is not an ECI (@see #isECI)
|
76
|
+
*/
|
77
|
+
getECIValue(index: number): number;
|
78
|
+
haveNCharacters(index: number, n: number): boolean;
|
79
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import Binarizer from '../Binarizer';
|
2
|
+
import LuminanceSource from '../LuminanceSource';
|
3
|
+
import BitArray from './BitArray';
|
4
|
+
import BitMatrix from './BitMatrix';
|
5
|
+
/**
|
6
|
+
* This Binarizer implementation uses the old ZXing global histogram approach. It is suitable
|
7
|
+
* for low-end mobile devices which don't have enough CPU or memory to use a local thresholding
|
8
|
+
* algorithm. However, because it picks a global black point, it cannot handle difficult shadows
|
9
|
+
* and gradients.
|
10
|
+
*
|
11
|
+
* Faster mobile devices and all desktop applications should probably use HybridBinarizer instead.
|
12
|
+
*
|
13
|
+
* @author dswitkin@google.com (Daniel Switkin)
|
14
|
+
* @author Sean Owen
|
15
|
+
*/
|
16
|
+
export default class GlobalHistogramBinarizer extends Binarizer {
|
17
|
+
private static LUMINANCE_BITS;
|
18
|
+
private static LUMINANCE_SHIFT;
|
19
|
+
private static LUMINANCE_BUCKETS;
|
20
|
+
private static EMPTY;
|
21
|
+
private luminances;
|
22
|
+
private buckets;
|
23
|
+
constructor(source: LuminanceSource);
|
24
|
+
getBlackRow(y: number, row: BitArray): BitArray;
|
25
|
+
getBlackMatrix(): BitMatrix;
|
26
|
+
createBinarizer(source: LuminanceSource): Binarizer;
|
27
|
+
private initArrays;
|
28
|
+
private static estimateBlackPoint;
|
29
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import BitMatrix from './BitMatrix';
|
2
|
+
import PerspectiveTransform from './PerspectiveTransform';
|
3
|
+
/**
|
4
|
+
* Implementations of this class can, given locations of finder patterns for a QR code in an
|
5
|
+
* image, sample the right points in the image to reconstruct the QR code, accounting for
|
6
|
+
* perspective distortion. It is abstracted since it is relatively expensive and should be allowed
|
7
|
+
* to take advantage of platform-specific optimized implementations, like Sun's Java Advanced
|
8
|
+
* Imaging library, but which may not be available in other environments such as J2ME, and vice
|
9
|
+
* versa.
|
10
|
+
*
|
11
|
+
* The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)}
|
12
|
+
* with an instance of a class which implements this interface.
|
13
|
+
*
|
14
|
+
* @author Sean Owen
|
15
|
+
*/
|
16
|
+
declare abstract class GridSampler {
|
17
|
+
abstract sampleGrid(image: BitMatrix, dimensionX: number, dimensionY: number, p1ToX: number, p1ToY: number, p2ToX: number, p2ToY: number, p3ToX: number, p3ToY: number, p4ToX: number, p4ToY: number, p1FromX: number, p1FromY: number, p2FromX: number, p2FromY: number, p3FromX: number, p3FromY: number, p4FromX: number, p4FromY: number): BitMatrix;
|
18
|
+
abstract sampleGridWithTransform(image: BitMatrix, dimensionX: number, dimensionY: number, transform: PerspectiveTransform): BitMatrix;
|
19
|
+
/**
|
20
|
+
* Checks a set of points that have been transformed to sample points on an image against
|
21
|
+
* the image's dimensions to see if the points are even within the image.
|
22
|
+
*
|
23
|
+
* This method will actually "nudge" the endpoints back onto the image if they are found to be
|
24
|
+
* barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder
|
25
|
+
* patterns in an image where the QR Code runs all the way to the image border.
|
26
|
+
*
|
27
|
+
* For efficiency, the method will check points from either end of the line until one is found
|
28
|
+
* to be within the image. Because the set of points are assumed to be linear, this is valid.
|
29
|
+
*
|
30
|
+
* @param image image into which the points should map
|
31
|
+
* @param points actual points in x1,y1,...,xn,yn form
|
32
|
+
* @throws NotFoundException if an endpoint lies outside the image boundaries
|
33
|
+
*/
|
34
|
+
protected static checkAndNudgePoints(image: BitMatrix, points: Float32Array): void;
|
35
|
+
}
|
36
|
+
export default GridSampler;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import GridSampler from './GridSampler';
|
2
|
+
export default class GridSamplerInstance {
|
3
|
+
private static gridSampler;
|
4
|
+
/**
|
5
|
+
* Sets the implementation of GridSampler used by the library. One global
|
6
|
+
* instance is stored, which may sound problematic. But, the implementation provided
|
7
|
+
* ought to be appropriate for the entire platform, and all uses of this library
|
8
|
+
* in the whole lifetime of the JVM. For instance, an Android activity can swap in
|
9
|
+
* an implementation that takes advantage of native platform libraries.
|
10
|
+
*
|
11
|
+
* @param newGridSampler The platform-specific object to install.
|
12
|
+
*/
|
13
|
+
static setGridSampler(newGridSampler: GridSampler): void;
|
14
|
+
/**
|
15
|
+
* @return the current implementation of GridSampler
|
16
|
+
*/
|
17
|
+
static getInstance(): GridSampler;
|
18
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import Binarizer from '../Binarizer';
|
2
|
+
import LuminanceSource from '../LuminanceSource';
|
3
|
+
import BitMatrix from './BitMatrix';
|
4
|
+
import GlobalHistogramBinarizer from './GlobalHistogramBinarizer';
|
5
|
+
/**
|
6
|
+
* This class implements a local thresholding algorithm, which while slower than the
|
7
|
+
* GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for
|
8
|
+
* high frequency images of barcodes with black data on white backgrounds. For this application,
|
9
|
+
* it does a much better job than a global blackpoint with severe shadows and gradients.
|
10
|
+
* However it tends to produce artifacts on lower frequency images and is therefore not
|
11
|
+
* a good general purpose binarizer for uses outside ZXing.
|
12
|
+
*
|
13
|
+
* This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,
|
14
|
+
* and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already
|
15
|
+
* inherently local, and only fails for horizontal gradients. We can revisit that problem later,
|
16
|
+
* but for now it was not a win to use local blocks for 1D.
|
17
|
+
*
|
18
|
+
* This Binarizer is the default for the unit tests and the recommended class for library users.
|
19
|
+
*
|
20
|
+
* @author dswitkin@google.com (Daniel Switkin)
|
21
|
+
*/
|
22
|
+
export default class HybridBinarizer extends GlobalHistogramBinarizer {
|
23
|
+
private static BLOCK_SIZE_POWER;
|
24
|
+
private static BLOCK_SIZE;
|
25
|
+
private static BLOCK_SIZE_MASK;
|
26
|
+
private static MINIMUM_DIMENSION;
|
27
|
+
private static MIN_DYNAMIC_RANGE;
|
28
|
+
private matrix;
|
29
|
+
constructor(source: LuminanceSource);
|
30
|
+
/**
|
31
|
+
* Calculates the final BitMatrix once for all requests. This could be called once from the
|
32
|
+
* constructor instead, but there are some advantages to doing it lazily, such as making
|
33
|
+
* profiling easier, and not doing heavy lifting when callers don't expect it.
|
34
|
+
*/
|
35
|
+
getBlackMatrix(): BitMatrix;
|
36
|
+
createBinarizer(source: LuminanceSource): Binarizer;
|
37
|
+
/**
|
38
|
+
* For each block in the image, calculate the average black point using a 5x5 grid
|
39
|
+
* of the blocks around it. Also handles the corner cases (fractional blocks are computed based
|
40
|
+
* on the last pixels in the row/column which are also used in the previous block).
|
41
|
+
*/
|
42
|
+
private static calculateThresholdForBlock;
|
43
|
+
private static cap;
|
44
|
+
/**
|
45
|
+
* Applies a single threshold to a block of pixels.
|
46
|
+
*/
|
47
|
+
private static thresholdBlock;
|
48
|
+
/**
|
49
|
+
* Calculates a single black point for each block of pixels and saves it away.
|
50
|
+
* See the following thread for a discussion of this algorithm:
|
51
|
+
* http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
|
52
|
+
*/
|
53
|
+
private static calculateBlackPoints;
|
54
|
+
}
|
@@ -0,0 +1,123 @@
|
|
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 {};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* <p>This class implements a perspective transform in two dimensions. Given four source and four
|
3
|
+
* destination points, it will compute the transformation implied between them. The code is based
|
4
|
+
* directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.</p>
|
5
|
+
*
|
6
|
+
* @author Sean Owen
|
7
|
+
*/
|
8
|
+
export default class PerspectiveTransform {
|
9
|
+
private a11;
|
10
|
+
private a21;
|
11
|
+
private a31;
|
12
|
+
private a12;
|
13
|
+
private a22;
|
14
|
+
private a32;
|
15
|
+
private a13;
|
16
|
+
private a23;
|
17
|
+
private a33;
|
18
|
+
private constructor();
|
19
|
+
static quadrilateralToQuadrilateral(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x0p: number, y0p: number, x1p: number, y1p: number, x2p: number, y2p: number, x3p: number, y3p: number): PerspectiveTransform;
|
20
|
+
transformPoints(points: Float32Array): void;
|
21
|
+
transformPointsWithValues(xValues: Float32Array, yValues: Float32Array): void;
|
22
|
+
static squareToQuadrilateral(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): PerspectiveTransform;
|
23
|
+
static quadrilateralToSquare(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): PerspectiveTransform;
|
24
|
+
protected buildAdjoint(): PerspectiveTransform;
|
25
|
+
protected times(other: PerspectiveTransform): PerspectiveTransform;
|
26
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { int } from '../../customTypings';
|
2
|
+
import DecodeHintType from '../DecodeHintType';
|
3
|
+
import Charset from '../util/Charset';
|
4
|
+
import CharacterSetECI from './CharacterSetECI';
|
5
|
+
/**
|
6
|
+
* Common string-related functions.
|
7
|
+
*
|
8
|
+
* @author Sean Owen
|
9
|
+
* @author Alex Dupre
|
10
|
+
*/
|
11
|
+
export default class StringUtils {
|
12
|
+
static SHIFT_JIS: string;
|
13
|
+
static GB2312: string;
|
14
|
+
static ISO88591: string;
|
15
|
+
private static EUC_JP;
|
16
|
+
private static UTF8;
|
17
|
+
private static PLATFORM_DEFAULT_ENCODING;
|
18
|
+
private static ASSUME_SHIFT_JIS;
|
19
|
+
static castAsNonUtf8Char(code: number, encoding?: Charset): string;
|
20
|
+
/**
|
21
|
+
* @param bytes bytes encoding a string, whose encoding should be guessed
|
22
|
+
* @param hints decode hints if applicable
|
23
|
+
* @return name of guessed encoding; at the moment will only guess one of:
|
24
|
+
* {@link #SHIFT_JIS}, {@link #UTF8}, {@link #ISO88591}, or the platform
|
25
|
+
* default encoding if none of these can possibly be correct
|
26
|
+
*/
|
27
|
+
static guessEncoding(bytes: Uint8Array, hints: Map<DecodeHintType, any>): string;
|
28
|
+
/**
|
29
|
+
*
|
30
|
+
* @see https://stackoverflow.com/a/13439711/4367683
|
31
|
+
*
|
32
|
+
* @param append The new string to append.
|
33
|
+
* @param args Argumets values to be formated.
|
34
|
+
*/
|
35
|
+
static format(append: string, ...args: any[]): string;
|
36
|
+
/**
|
37
|
+
*
|
38
|
+
*/
|
39
|
+
static getBytes(str: string, encoding: CharacterSetECI): Uint8Array;
|
40
|
+
/**
|
41
|
+
* Returns the charcode at the specified index or at index zero.
|
42
|
+
*/
|
43
|
+
static getCharCode(str: string, index?: number): int;
|
44
|
+
/**
|
45
|
+
* Returns char for given charcode
|
46
|
+
*/
|
47
|
+
static getCharAt(charCode: number): string;
|
48
|
+
}
|
@@ -0,0 +1,35 @@
|
|
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
|
+
}
|