@qr-platform/qr-code.js 0.8.21 → 0.8.22
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/index.d.ts +1 -1
- 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.js +1 -0
- package/lib/utils/scan-validator-zxing-node.d.ts +18 -0
- package/package.json +8 -8
- 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
@@ -0,0 +1,18 @@
|
|
1
|
+
import { BinaryBitmap } from '~/lib/zxing-js/src';
|
2
|
+
import { NodeLuminanceSource } from '~/lib/zxing-js/src/node';
|
3
|
+
import { ScanValidatorResponse } from './scan-validators/abstract-scan-validator';
|
4
|
+
export interface PreprocessingOptions {
|
5
|
+
lower?: number;
|
6
|
+
upper?: number;
|
7
|
+
gamma?: number;
|
8
|
+
threshold?: number;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Main QR Validator: attempts to decode the QR code from an SVG string.
|
12
|
+
* It tries the normal decode first, then with inverted luminance.
|
13
|
+
* (Alternative preprocessing attempt removed as it was identical to the first).
|
14
|
+
*/
|
15
|
+
export declare const qrValidatorZxing: {
|
16
|
+
validateZxing: (svgString: string | undefined) => Promise<ScanValidatorResponse>;
|
17
|
+
};
|
18
|
+
export type { NodeLuminanceSource, BinaryBitmap, ScanValidatorResponse };
|
package/package.json
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@qr-platform/qr-code.js",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.22",
|
4
4
|
"description": "QRCode.js is a professional JavaScript/TypeScript library for creating customized QR codes, offering a blend of simplicity and sophistication. With versatile styling options—dot shapes, colors, gradients, embedded images, borders, and text—it enables you to design unique, visually appealing QR codes that work flawlessly with standard scanners. QRCode.js is part of QR-Platform: All-in-One QR Codes Management Solution.",
|
5
5
|
"type": "module",
|
6
|
-
"main": "./lib/
|
7
|
-
"browser": "./lib/
|
6
|
+
"main": "./lib/node.js",
|
7
|
+
"browser": "./lib/index.js",
|
8
8
|
"types": "./lib/index.d.ts",
|
9
9
|
"exports": {
|
10
10
|
".": {
|
11
11
|
"types": "./lib/index.d.ts",
|
12
|
-
"browser": "./lib/
|
13
|
-
"node": "./lib/
|
14
|
-
"default": "./lib/
|
12
|
+
"browser": "./lib/index.js",
|
13
|
+
"node": "./lib/node.js",
|
14
|
+
"default": "./lib/index.js"
|
15
15
|
},
|
16
16
|
"./node": {
|
17
17
|
"types": "./lib/node.d.ts",
|
18
|
-
"import": "./lib/
|
19
|
-
"require": "./lib/
|
18
|
+
"import": "./lib/node.js",
|
19
|
+
"require": "./lib/node.js"
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"peerDependencies": {
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import EncodeHintType from '../core/EncodeHintType';
|
2
|
-
/**
|
3
|
-
* @deprecated Moving to @zxing/browser
|
4
|
-
*/
|
5
|
-
declare class BrowserQRCodeSvgWriter {
|
6
|
-
private static readonly QUIET_ZONE_SIZE;
|
7
|
-
/**
|
8
|
-
* SVG markup NameSpace
|
9
|
-
*/
|
10
|
-
private static readonly SVG_NS;
|
11
|
-
/**
|
12
|
-
* Writes and renders a QRCode SVG element.
|
13
|
-
*
|
14
|
-
* @param contents
|
15
|
-
* @param width
|
16
|
-
* @param height
|
17
|
-
* @param hints
|
18
|
-
*/
|
19
|
-
write(contents: string, width: number, height: number, hints?: Map<EncodeHintType, any>): SVGSVGElement;
|
20
|
-
/**
|
21
|
-
* Renders the result and then appends it to the DOM.
|
22
|
-
*/
|
23
|
-
writeToDom(containerElement: string | HTMLElement, contents: string, width: number, height: number, hints?: Map<EncodeHintType, any>): void;
|
24
|
-
/**
|
25
|
-
* Note that the input matrix uses 0 == white, 1 == black.
|
26
|
-
* The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
|
27
|
-
*/
|
28
|
-
private renderResult;
|
29
|
-
/**
|
30
|
-
* Creates a SVG element.
|
31
|
-
*
|
32
|
-
* @param w SVG's width attribute
|
33
|
-
* @param h SVG's height attribute
|
34
|
-
*/
|
35
|
-
private createSVGElement;
|
36
|
-
/**
|
37
|
-
* Creates a SVG rect element.
|
38
|
-
*
|
39
|
-
* @param x Element's x coordinate
|
40
|
-
* @param y Element's y coordinate
|
41
|
-
* @param w Element's width attribute
|
42
|
-
* @param h Element's height attribute
|
43
|
-
*/
|
44
|
-
private createSvgRectElement;
|
45
|
-
}
|
46
|
-
export { BrowserQRCodeSvgWriter };
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import EncodeHintType from '../core/EncodeHintType';
|
2
|
-
/**
|
3
|
-
* @deprecated Moving to @zxing/browser
|
4
|
-
*/
|
5
|
-
declare abstract class BrowserSvgCodeWriter {
|
6
|
-
/**
|
7
|
-
* Default quiet zone in pixels.
|
8
|
-
*/
|
9
|
-
private static readonly QUIET_ZONE_SIZE;
|
10
|
-
/**
|
11
|
-
* SVG markup NameSpace
|
12
|
-
*/
|
13
|
-
private static readonly SVG_NS;
|
14
|
-
/**
|
15
|
-
* A HTML container element for the image.
|
16
|
-
*/
|
17
|
-
private containerElement;
|
18
|
-
/**
|
19
|
-
* Constructs. 😉
|
20
|
-
*/
|
21
|
-
constructor(containerElement: string | HTMLElement);
|
22
|
-
/**
|
23
|
-
* Writes the QR code to a SVG and renders it in the container.
|
24
|
-
*/
|
25
|
-
write(contents: string, width: number, height: number, hints?: Map<EncodeHintType, any>): SVGSVGElement;
|
26
|
-
/**
|
27
|
-
* Encodes the content to a Barcode type.
|
28
|
-
*/
|
29
|
-
private encode;
|
30
|
-
/**
|
31
|
-
* Renders the SVG in the container.
|
32
|
-
*
|
33
|
-
* @note the input matrix uses 0 == white, 1 == black. The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
|
34
|
-
*/
|
35
|
-
private renderResult;
|
36
|
-
/**
|
37
|
-
* Creates a SVG element.
|
38
|
-
*/
|
39
|
-
protected createSVGElement(w: number, h: number): SVGSVGElement;
|
40
|
-
/**
|
41
|
-
* Creates a SVG rect.
|
42
|
-
*/
|
43
|
-
protected createSvgPathPlaceholderElement(w: number, h: number): SVGPathElement;
|
44
|
-
/**
|
45
|
-
* Creates a SVG rect.
|
46
|
-
*/
|
47
|
-
protected createSvgRectElement(x: number, y: number, w: number, h: number): SVGRectElement;
|
48
|
-
}
|
49
|
-
export { BrowserSvgCodeWriter };
|
@@ -1,22 +0,0 @@
|
|
1
|
-
export declare class VideoInputDevice implements MediaDeviceInfo {
|
2
|
-
deviceId: string;
|
3
|
-
label: string;
|
4
|
-
/** @inheritdoc */
|
5
|
-
readonly kind = "videoinput";
|
6
|
-
/** @inheritdoc */
|
7
|
-
readonly groupId: string;
|
8
|
-
/**
|
9
|
-
* Creates an instance of VideoInputDevice.
|
10
|
-
*
|
11
|
-
* @param {string} deviceId the video input device id
|
12
|
-
* @param {string} label the label of the device if available
|
13
|
-
*/
|
14
|
-
constructor(deviceId: string, label: string, groupId?: string);
|
15
|
-
/** @inheritdoc */
|
16
|
-
toJSON(): {
|
17
|
-
kind: string;
|
18
|
-
groupId: string;
|
19
|
-
deviceId: string;
|
20
|
-
label: string;
|
21
|
-
};
|
22
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Simply encapsulates a width and height.
|
3
|
-
*/
|
4
|
-
export default class Dimension {
|
5
|
-
private width;
|
6
|
-
private height;
|
7
|
-
constructor(width: number, height: number);
|
8
|
-
getWidth(): number;
|
9
|
-
getHeight(): number;
|
10
|
-
equals(other: any): boolean;
|
11
|
-
hashCode(): number;
|
12
|
-
toString(): string;
|
13
|
-
}
|
@@ -1,99 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are a set of hints that you may pass to Writers to specify their behavior.
|
3
|
-
*
|
4
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
5
|
-
*/
|
6
|
-
declare enum EncodeHintType {
|
7
|
-
/**
|
8
|
-
* Specifies what degree of error correction to use, for example in QR Codes.
|
9
|
-
* Type depends on the encoder. For example for QR codes it's type
|
10
|
-
* {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
|
11
|
-
* For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
|
12
|
-
* For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
|
13
|
-
* In all cases, it can also be a {@link String} representation of the desired value as well.
|
14
|
-
* Note: an Aztec symbol should have a minimum of 25% EC words.
|
15
|
-
*/
|
16
|
-
ERROR_CORRECTION = 0,
|
17
|
-
/**
|
18
|
-
* Specifies what character encoding to use where applicable (type {@link String})
|
19
|
-
*/
|
20
|
-
CHARACTER_SET = 1,
|
21
|
-
/**
|
22
|
-
* Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
|
23
|
-
*/
|
24
|
-
DATA_MATRIX_SHAPE = 2,
|
25
|
-
/**
|
26
|
-
* Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
|
27
|
-
* {@link String } value).
|
28
|
-
* The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
|
29
|
-
* character set via ECIs.
|
30
|
-
* Please note that in that case, the most compact character encoding is chosen for characters in
|
31
|
-
* the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
|
32
|
-
* support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
|
33
|
-
* means of the {@link #CHARACTER_SET} encoding hint.
|
34
|
-
* Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
|
35
|
-
* group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
|
36
|
-
* for the purpose of delimiting AIs.
|
37
|
-
* This option and {@link #FORCE_C40} are mutually exclusive.
|
38
|
-
*/
|
39
|
-
DATA_MATRIX_COMPACT = 3,
|
40
|
-
/**
|
41
|
-
* Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
42
|
-
*
|
43
|
-
* @deprecated use width/height params in
|
44
|
-
* {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
|
45
|
-
*/
|
46
|
-
MIN_SIZE = 4,
|
47
|
-
/**
|
48
|
-
* Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
49
|
-
*
|
50
|
-
* @deprecated without replacement
|
51
|
-
*/
|
52
|
-
MAX_SIZE = 5,
|
53
|
-
/**
|
54
|
-
* Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
|
55
|
-
* by format; for example it controls margin before and after the barcode horizontally for
|
56
|
-
* most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
|
57
|
-
*/
|
58
|
-
MARGIN = 6,
|
59
|
-
/**
|
60
|
-
* Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
|
61
|
-
* {@link String} value).
|
62
|
-
*/
|
63
|
-
PDF417_COMPACT = 7,
|
64
|
-
/**
|
65
|
-
* Specifies what compaction mode to use for PDF417 (type
|
66
|
-
* {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
|
67
|
-
* enum values).
|
68
|
-
*/
|
69
|
-
PDF417_COMPACTION = 8,
|
70
|
-
/**
|
71
|
-
* Specifies the minimum and maximum number of rows and columns for PDF417 (type
|
72
|
-
* {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
|
73
|
-
*/
|
74
|
-
PDF417_DIMENSIONS = 9,
|
75
|
-
/**
|
76
|
-
* Specifies the required number of layers for an Aztec code.
|
77
|
-
* A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
|
78
|
-
* 0 indicates to use the minimum number of layers (the default).
|
79
|
-
* A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
|
80
|
-
* (Type {@link Integer}, or {@link String} representation of the integer value).
|
81
|
-
*/
|
82
|
-
AZTEC_LAYERS = 10,
|
83
|
-
/**
|
84
|
-
* Specifies the exact version of QR code to be encoded.
|
85
|
-
* (Type {@link Integer}, or {@link String} representation of the integer value).
|
86
|
-
*/
|
87
|
-
QR_VERSION = 11,
|
88
|
-
/**
|
89
|
-
* Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
|
90
|
-
* {@link String } value).
|
91
|
-
*/
|
92
|
-
GS1_FORMAT = 12,
|
93
|
-
/**
|
94
|
-
* Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
|
95
|
-
* option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
|
96
|
-
*/
|
97
|
-
FORCE_C40 = 13
|
98
|
-
}
|
99
|
-
export default EncodeHintType;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import LuminanceSource from './LuminanceSource';
|
2
|
-
/**
|
3
|
-
* This object extends LuminanceSource around an array of YUV data returned from the camera driver,
|
4
|
-
* with the option to crop to a rectangle within the full data. This can be used to exclude
|
5
|
-
* superfluous pixels around the perimeter and speed up decoding.
|
6
|
-
*
|
7
|
-
* It works for any pixel format where the Y channel is planar and appears first, including
|
8
|
-
* YCbCr_420_SP and YCbCr_422_SP.
|
9
|
-
*
|
10
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
11
|
-
*/
|
12
|
-
export default class PlanarYUVLuminanceSource extends LuminanceSource {
|
13
|
-
private yuvData;
|
14
|
-
private dataWidth;
|
15
|
-
private dataHeight;
|
16
|
-
private left;
|
17
|
-
private top;
|
18
|
-
private static THUMBNAIL_SCALE_FACTOR;
|
19
|
-
constructor(yuvData: Uint8ClampedArray, dataWidth: number, dataHeight: number, left: number, top: number, width: number, height: number, reverseHorizontal: boolean);
|
20
|
-
getRow(y: number, row?: Uint8ClampedArray): Uint8ClampedArray;
|
21
|
-
getMatrix(): Uint8ClampedArray;
|
22
|
-
isCropSupported(): boolean;
|
23
|
-
crop(left: number, top: number, width: number, height: number): LuminanceSource;
|
24
|
-
renderThumbnail(): Int32Array;
|
25
|
-
/**
|
26
|
-
* @return width of image from {@link #renderThumbnail()}
|
27
|
-
*/
|
28
|
-
getThumbnailWidth(): number;
|
29
|
-
/**
|
30
|
-
* @return height of image from {@link #renderThumbnail()}
|
31
|
-
*/
|
32
|
-
getThumbnailHeight(): number;
|
33
|
-
private reverseHorizontal;
|
34
|
-
invert(): LuminanceSource;
|
35
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import LuminanceSource from './LuminanceSource';
|
2
|
-
/**
|
3
|
-
* This class is used to help decode images from files which arrive as RGB data from
|
4
|
-
* an ARGB pixel array. It does not support rotation.
|
5
|
-
*
|
6
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
7
|
-
* @author Betaminos
|
8
|
-
*/
|
9
|
-
export default class RGBLuminanceSource extends LuminanceSource {
|
10
|
-
private dataWidth?;
|
11
|
-
private dataHeight?;
|
12
|
-
private left?;
|
13
|
-
private top?;
|
14
|
-
private luminances;
|
15
|
-
constructor(luminances: Uint8ClampedArray | Int32Array, width: number, height: number, dataWidth?: number | undefined, dataHeight?: number | undefined, left?: number | undefined, top?: number | undefined);
|
16
|
-
getRow(y: number, row?: Uint8ClampedArray): Uint8ClampedArray;
|
17
|
-
getMatrix(): Uint8ClampedArray;
|
18
|
-
isCropSupported(): boolean;
|
19
|
-
crop(left: number, top: number, width: number, height: number): LuminanceSource;
|
20
|
-
invert(): LuminanceSource;
|
21
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import BarcodeFormat from './BarcodeFormat';
|
2
|
-
import BitMatrix from './common/BitMatrix';
|
3
|
-
import EncodeHintType from './EncodeHintType';
|
4
|
-
/**
|
5
|
-
* The base class for all objects which encode/generate a barcode image.
|
6
|
-
*
|
7
|
-
* @author dswitkin@google.com (Daniel Switkin)
|
8
|
-
*/
|
9
|
-
export interface Writer {
|
10
|
-
/**
|
11
|
-
* Encode a barcode using the default settings.
|
12
|
-
*
|
13
|
-
* @param contents The contents to encode in the barcode
|
14
|
-
* @param format The barcode format to generate
|
15
|
-
* @param width The preferred width in pixels
|
16
|
-
* @param height The preferred height in pixels
|
17
|
-
* @return {@link BitMatrix} representing encoded barcode image
|
18
|
-
* @throws WriterException if contents cannot be encoded legally in a format
|
19
|
-
*/
|
20
|
-
/**
|
21
|
-
* @param contents The contents to encode in the barcode
|
22
|
-
* @param format The barcode format to generate
|
23
|
-
* @param width The preferred width in pixels
|
24
|
-
* @param height The preferred height in pixels
|
25
|
-
* @param hints Additional parameters to supply to the encoder
|
26
|
-
* @returns BitMatrix representing encoded barcode image
|
27
|
-
* @throws WriterException if contents cannot be encoded legally in a format
|
28
|
-
*/
|
29
|
-
encode(contents: string, format: BarcodeFormat, width: number, height: number, hints: Map<EncodeHintType, any>): BitMatrix;
|
30
|
-
}
|
@@ -1,37 +0,0 @@
|
|
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
|
-
}
|
@@ -1,79 +0,0 @@
|
|
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
|
-
}
|
@@ -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
|
-
}
|