@sythos/js_barcode_universal 1.5.13 → 1.5.15

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.
Files changed (137) hide show
  1. package/LICENSE +22 -4
  2. package/NOTICE.md +10 -1
  3. package/README.md +416 -22
  4. package/bundle/sythos-barcode.esm.js +22176 -11991
  5. package/bundle/sythos-barcode.js +22059 -11991
  6. package/licenses/README.md +12 -1
  7. package/licenses/codablockf.license +51 -0
  8. package/licenses/code16k.license +52 -0
  9. package/licenses/code25.license +58 -0
  10. package/licenses/code32.license +51 -0
  11. package/licenses/dotcode.license +66 -0
  12. package/licenses/gs1-composite.license +106 -0
  13. package/licenses/gs1-databar.license +21 -14
  14. package/licenses/hanxin.license +95 -0
  15. package/licenses/maxicode.license +62 -0
  16. package/licenses/postal.license +61 -0
  17. package/licenses/pzn.license +53 -0
  18. package/licenses/telepen.license +73 -0
  19. package/llms.txt +62 -6
  20. package/package.json +47 -3
  21. package/src/index.d.ts +111 -6
  22. package/src/index.js +362 -13
  23. package/src/js/codablockf/decoder.js +198 -0
  24. package/src/js/codablockf/encoder.js +97 -0
  25. package/src/js/codablockf/index.js +3 -0
  26. package/src/js/code16k/decoder.js +303 -0
  27. package/src/js/code16k/detector.js +187 -0
  28. package/src/js/code16k/encoder.js +153 -0
  29. package/src/js/code16k/index.js +14 -0
  30. package/src/js/code16k/tables.js +152 -0
  31. package/src/js/composite/index.js +570 -0
  32. package/src/js/core/detection-contract.js +185 -0
  33. package/src/js/core/symbol-layout.js +155 -0
  34. package/src/js/databar/expanded.js +968 -0
  35. package/src/js/databar/index.js +4 -0
  36. package/src/js/databar/layout.js +192 -0
  37. package/src/js/databar/limited.js +533 -0
  38. package/src/js/databar/stacked-omnidirectional.js +548 -0
  39. package/src/js/databar/stacked.js +528 -0
  40. package/src/js/dotcode/decoder.js +548 -0
  41. package/src/js/dotcode/detector.js +251 -0
  42. package/src/js/dotcode/encoder.js +453 -0
  43. package/src/js/dotcode/index.js +34 -0
  44. package/src/js/dotcode/tables.js +168 -0
  45. package/src/js/hanxin/decoder.js +299 -0
  46. package/src/js/hanxin/detector.js +122 -0
  47. package/src/js/hanxin/encoder.js +259 -0
  48. package/src/js/hanxin/index.js +16 -0
  49. package/src/js/hanxin/tables.js +316 -0
  50. package/src/js/image/height-coded.js +164 -0
  51. package/src/js/maxicode/decoder.js +275 -0
  52. package/src/js/maxicode/detector.js +118 -0
  53. package/src/js/maxicode/encoder.js +438 -0
  54. package/src/js/maxicode/index.js +34 -0
  55. package/src/js/maxicode/tables.js +132 -0
  56. package/src/js/oned/code25.js +148 -0
  57. package/src/js/oned/index.js +21 -3
  58. package/src/js/oned/postal.js +889 -0
  59. package/src/js/oned/reader.js +272 -7
  60. package/src/js/oned/telepen.js +361 -0
  61. package/src/js/oned/writers.js +186 -12
  62. package/src/js/stacked128/common.js +208 -0
  63. package/src/ts/codablockf/decoder.ts +212 -0
  64. package/src/ts/codablockf/encoder.ts +128 -0
  65. package/src/ts/codablockf/index.d.ts +31 -0
  66. package/src/ts/codablockf/index.ts +6 -0
  67. package/src/ts/code16k/decoder.d.ts +25 -0
  68. package/src/ts/code16k/decoder.ts +313 -0
  69. package/src/ts/code16k/detector.d.ts +21 -0
  70. package/src/ts/code16k/detector.ts +203 -0
  71. package/src/ts/code16k/encoder.d.ts +26 -0
  72. package/src/ts/code16k/encoder.ts +198 -0
  73. package/src/ts/code16k/index.d.ts +10 -0
  74. package/src/ts/code16k/index.ts +47 -0
  75. package/src/ts/code16k/tables.d.ts +54 -0
  76. package/src/ts/code16k/tables.ts +195 -0
  77. package/src/ts/composite/index.d.ts +74 -0
  78. package/src/ts/composite/index.ts +547 -0
  79. package/src/ts/core/detection-contract.d.ts +119 -0
  80. package/src/ts/core/detection-contract.ts +267 -0
  81. package/src/ts/core/symbol-layout.d.ts +108 -0
  82. package/src/ts/core/symbol-layout.ts +236 -0
  83. package/src/ts/databar/expanded.d.ts +40 -0
  84. package/src/ts/databar/expanded.ts +948 -0
  85. package/src/ts/databar/index.d.ts +48 -0
  86. package/src/ts/databar/index.ts +48 -0
  87. package/src/ts/databar/layout.d.ts +122 -0
  88. package/src/ts/databar/layout.ts +275 -0
  89. package/src/ts/databar/limited.d.ts +85 -0
  90. package/src/ts/databar/limited.ts +553 -0
  91. package/src/ts/databar/stacked-omnidirectional.d.ts +128 -0
  92. package/src/ts/databar/stacked-omnidirectional.ts +559 -0
  93. package/src/ts/databar/stacked.d.ts +96 -0
  94. package/src/ts/databar/stacked.ts +549 -0
  95. package/src/ts/dotcode/decoder.d.ts +58 -0
  96. package/src/ts/dotcode/decoder.ts +467 -0
  97. package/src/ts/dotcode/detector.d.ts +63 -0
  98. package/src/ts/dotcode/detector.ts +263 -0
  99. package/src/ts/dotcode/encoder.d.ts +69 -0
  100. package/src/ts/dotcode/encoder.ts +427 -0
  101. package/src/ts/dotcode/index.d.ts +37 -0
  102. package/src/ts/dotcode/index.ts +72 -0
  103. package/src/ts/dotcode/tables.d.ts +74 -0
  104. package/src/ts/dotcode/tables.ts +174 -0
  105. package/src/ts/hanxin/decoder.d.ts +48 -0
  106. package/src/ts/hanxin/decoder.ts +314 -0
  107. package/src/ts/hanxin/detector.d.ts +45 -0
  108. package/src/ts/hanxin/detector.ts +124 -0
  109. package/src/ts/hanxin/encoder.d.ts +41 -0
  110. package/src/ts/hanxin/encoder.ts +290 -0
  111. package/src/ts/hanxin/index.d.ts +16 -0
  112. package/src/ts/hanxin/index.ts +18 -0
  113. package/src/ts/hanxin/tables.d.ts +80 -0
  114. package/src/ts/hanxin/tables.ts +348 -0
  115. package/src/ts/image/height-coded.d.ts +101 -0
  116. package/src/ts/image/height-coded.ts +227 -0
  117. package/src/ts/index.d.ts +46 -2
  118. package/src/ts/index.ts +380 -13
  119. package/src/ts/maxicode/decoder.ts +265 -0
  120. package/src/ts/maxicode/detector.ts +109 -0
  121. package/src/ts/maxicode/encoder.ts +414 -0
  122. package/src/ts/maxicode/index.d.ts +96 -0
  123. package/src/ts/maxicode/index.ts +44 -0
  124. package/src/ts/maxicode/tables.ts +136 -0
  125. package/src/ts/oned/code25.d.ts +42 -0
  126. package/src/ts/oned/code25.ts +170 -0
  127. package/src/ts/oned/index.d.ts +7 -2
  128. package/src/ts/oned/index.ts +45 -3
  129. package/src/ts/oned/postal.d.ts +44 -0
  130. package/src/ts/oned/postal.ts +819 -0
  131. package/src/ts/oned/reader.d.ts +35 -0
  132. package/src/ts/oned/reader.ts +261 -7
  133. package/src/ts/oned/telepen.d.ts +65 -0
  134. package/src/ts/oned/telepen.ts +368 -0
  135. package/src/ts/oned/writers.d.ts +32 -0
  136. package/src/ts/oned/writers.ts +184 -13
  137. package/src/ts/stacked128/common.ts +225 -0
@@ -0,0 +1,263 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-License-Identifier: MIT
27
+ *
28
+ * Original work. No code from any other barcode implementation.
29
+ */
30
+
31
+ /** Clean-raster DotCode detector. @module dotcode/detector */
32
+
33
+ import { BitMatrix } from '../core/bit-matrix.js';
34
+ import { FormatError, NotFoundError } from '../core/errors.js';
35
+ import { decodeDotCode } from './decoder.js';
36
+ import type { DotCodeDecodeResult, DotCodeRotation } from './decoder.js';
37
+
38
+ export interface DotCodeDetectOptions {
39
+ /** Restrict the search to one known integer module size. */
40
+ moduleSize?: number;
41
+ /** Maximum scale searched when moduleSize is not supplied. */
42
+ maxModuleSize?: number;
43
+ /** Candidate source orientations. Defaults to all quarter turns. */
44
+ rotations?: readonly DotCodeRotation[];
45
+ /** Search normal, inverted, or both polarities. */
46
+ inverted?: boolean | 'auto';
47
+ }
48
+
49
+ export interface DotCodePoint { readonly x: number; readonly y: number; }
50
+
51
+ export interface DotCodeDetection extends DotCodeDecodeResult {
52
+ readonly matrix: BitMatrix;
53
+ readonly corners: readonly [DotCodePoint, DotCodePoint, DotCodePoint, DotCodePoint];
54
+ readonly moduleSize: number;
55
+ }
56
+
57
+ type Bounds = { x: number; y: number; width: number; height: number };
58
+ type Candidate = { x: number; y: number; width: number; height: number; scale: number; inverted: boolean };
59
+
60
+ const MAX_RASTER_PIXELS = 16_777_216;
61
+
62
+ function validateImage(image: BitMatrix): void {
63
+ if (!image || !Number.isInteger(image.width) || !Number.isInteger(image.height) || typeof image.get !== 'function') {
64
+ throw new NotFoundError('DotCode detector: no binary image supplied');
65
+ }
66
+ if (image.width < 1 || image.height < 1 || image.width * image.height > MAX_RASTER_PIXELS) {
67
+ throw new FormatError(`DotCode detector: raster must contain at most ${MAX_RASTER_PIXELS} pixels`);
68
+ }
69
+ }
70
+
71
+ function boundsFor(image: BitMatrix, dark: boolean): Bounds | null {
72
+ let minX = image.width;
73
+ let minY = image.height;
74
+ let maxX = -1;
75
+ let maxY = -1;
76
+ for (let y = 0; y < image.height; y++) for (let x = 0; x < image.width; x++) {
77
+ if (image.get(x, y) !== dark) continue;
78
+ if (x < minX) minX = x;
79
+ if (x > maxX) maxX = x;
80
+ if (y < minY) minY = y;
81
+ if (y > maxY) maxY = y;
82
+ }
83
+ return maxX < 0 ? null : { x: minX, y: minY, width: maxX - minX + 1, height: maxY - minY + 1 };
84
+ }
85
+
86
+ function rotateImage(image: BitMatrix, degrees: DotCodeRotation): BitMatrix {
87
+ if (degrees === 0) return image.clone();
88
+ const result = degrees === 90 || degrees === 270 ? new BitMatrix(image.height, image.width) : new BitMatrix(image.width, image.height);
89
+ for (let y = 0; y < image.height; y++) for (let x = 0; x < image.width; x++) {
90
+ let nx = x;
91
+ let ny = y;
92
+ if (degrees === 90) { nx = image.height - 1 - y; ny = x; }
93
+ else if (degrees === 180) { nx = image.width - 1 - x; ny = image.height - 1 - y; }
94
+ else { nx = y; ny = image.width - 1 - x; }
95
+ result.setValue(nx, ny, image.get(x, y));
96
+ }
97
+ return result;
98
+ }
99
+
100
+ function sampleCandidate(image: BitMatrix, candidate: Candidate): BitMatrix | null {
101
+ const { x, y, width, height, scale, inverted } = candidate;
102
+ if (x < 0 || y < 0 || x + width * scale > image.width || y + height * scale > image.height) return null;
103
+ const matrix = new BitMatrix(width, height);
104
+ const threshold = Math.ceil(scale * scale / 2);
105
+ for (let row = 0; row < height; row++) for (let column = 0; column < width; column++) {
106
+ let dark = 0;
107
+ for (let py = 0; py < scale; py++) for (let px = 0; px < scale; px++) {
108
+ if (image.get(x + column * scale + px, y + row * scale + py) === !inverted) dark++;
109
+ }
110
+ if (dark >= threshold) matrix.set(column, row);
111
+ }
112
+ return matrix;
113
+ }
114
+
115
+ function validDimension(width: number, height: number): boolean {
116
+ return Number.isInteger(width) && Number.isInteger(height) && width >= 5 && height >= 5 && ((width + height) & 1) === 1;
117
+ }
118
+
119
+ function addCandidate(list: Candidate[], seen: Set<string>, candidate: Candidate): void {
120
+ if (!validDimension(candidate.width, candidate.height) || candidate.scale < 1) return;
121
+ const key = `${candidate.x},${candidate.y},${candidate.width},${candidate.height},${candidate.scale},${candidate.inverted ? 1 : 0}`;
122
+ if (seen.has(key)) return;
123
+ seen.add(key);
124
+ list.push(candidate);
125
+ }
126
+
127
+ function candidateList(image: BitMatrix, bounds: Bounds, scale: number, inverted: boolean): Candidate[] {
128
+ const candidates: Candidate[] = [];
129
+ const seen = new Set<string>();
130
+ const frameWidth = Math.floor(image.width / scale);
131
+ const frameHeight = Math.floor(image.height / scale);
132
+
133
+ // Most generated matrices have a known integer quiet-zone margin. Trying a
134
+ // few margins first keeps the detector fast and deterministic.
135
+ for (let margin = 0; margin <= 4; margin++) {
136
+ addCandidate(candidates, seen, {
137
+ x: margin * scale, y: margin * scale,
138
+ width: frameWidth - margin * 2, height: frameHeight - margin * 2,
139
+ scale, inverted,
140
+ });
141
+ }
142
+
143
+ // A cropped camera ROI may not include the quiet zone. Estimate the logical
144
+ // dimensions from the dark bounding box and permit a small border slack.
145
+ const estimateWidth = Math.round(bounds.width / scale);
146
+ const estimateHeight = Math.round(bounds.height / scale);
147
+ for (let extraWidth = -2; extraWidth <= 6; extraWidth++) for (let extraHeight = -2; extraHeight <= 6; extraHeight++) {
148
+ const width = estimateWidth + extraWidth;
149
+ const height = estimateHeight + extraHeight;
150
+ if (!validDimension(width, height)) continue;
151
+ for (let left = 0; left <= 4; left++) for (let top = 0; top <= 4; top++) {
152
+ addCandidate(candidates, seen, {
153
+ x: bounds.x - left * scale, y: bounds.y - top * scale,
154
+ width, height, scale, inverted,
155
+ });
156
+ }
157
+ }
158
+ return candidates;
159
+ }
160
+
161
+ function inversePoint(point: DotCodePoint, originalWidth: number, originalHeight: number, rotation: DotCodeRotation): DotCodePoint {
162
+ if (rotation === 0) return point;
163
+ if (rotation === 90) return { x: point.y, y: originalHeight - 1 - point.x };
164
+ if (rotation === 180) return { x: originalWidth - 1 - point.x, y: originalHeight - 1 - point.y };
165
+ return { x: originalWidth - 1 - point.y, y: point.x };
166
+ }
167
+
168
+ function cornersFor(candidate: Candidate, source: BitMatrix, rotation: DotCodeRotation): [DotCodePoint, DotCodePoint, DotCodePoint, DotCodePoint] {
169
+ const right = candidate.x + candidate.width * candidate.scale;
170
+ const bottom = candidate.y + candidate.height * candidate.scale;
171
+ return [
172
+ inversePoint({ x: candidate.x, y: candidate.y }, source.width, source.height, rotation),
173
+ inversePoint({ x: right, y: candidate.y }, source.width, source.height, rotation),
174
+ inversePoint({ x: right, y: bottom }, source.width, source.height, rotation),
175
+ inversePoint({ x: candidate.x, y: bottom }, source.width, source.height, rotation),
176
+ ];
177
+ }
178
+
179
+ /**
180
+ * Detect clean, axis-aligned DotCode rasters at integer module scale.
181
+ *
182
+ * DotCode has no finder pattern. This detector therefore treats geometry and
183
+ * the strict decoder as one gate: a bounding-box hypothesis is returned only
184
+ * after checkerboard structure, legal patterns, padding, and Reed-Solomon all
185
+ * pass. It intentionally does not claim perspective or arbitrary-angle camera
186
+ * support; callers should rectify those images before invoking this API.
187
+ */
188
+ export function detectDotCode(binaryImage: BitMatrix, options: DotCodeDetectOptions = {}): DotCodeDetection[] {
189
+ validateImage(binaryImage);
190
+ if (options.moduleSize !== undefined && (!Number.isInteger(options.moduleSize) || options.moduleSize < 1 || options.moduleSize > 128)) {
191
+ throw new FormatError('DotCode detector: moduleSize must be an integer in 1..128');
192
+ }
193
+ if (options.maxModuleSize !== undefined && (!Number.isInteger(options.maxModuleSize) || options.maxModuleSize < 1 || options.maxModuleSize > 128)) {
194
+ throw new FormatError('DotCode detector: maxModuleSize must be an integer in 1..128');
195
+ }
196
+ const rotations = options.rotations ?? [0, 90, 180, 270];
197
+ if (!Array.isArray(rotations) || rotations.some((value) => value !== 0 && value !== 90 && value !== 180 && value !== 270)) {
198
+ throw new FormatError('DotCode detector: rotations must contain quarter-turns only');
199
+ }
200
+ const polarities = options.inverted === undefined || options.inverted === 'auto'
201
+ ? [false, true] : [options.inverted];
202
+ const detections: DotCodeDetection[] = [];
203
+ const seen = new Set<string>();
204
+
205
+ for (const rotation of rotations) {
206
+ const oriented = rotateImage(binaryImage, rotation);
207
+ for (const inverted of polarities) {
208
+ const bounds = boundsFor(oriented, !inverted);
209
+ if (!bounds) continue;
210
+ const maxScale = options.moduleSize ?? Math.min(
211
+ options.maxModuleSize ?? 32,
212
+ 128,
213
+ Math.max(1, Math.floor(Math.min(oriented.width, oriented.height) / 5)),
214
+ );
215
+ const scales = options.moduleSize ? [options.moduleSize] : Array.from({ length: maxScale }, (_, index) => index + 1);
216
+ for (const scale of scales) {
217
+ const candidates = candidateList(oriented, bounds, scale, inverted);
218
+ for (const candidate of candidates) {
219
+ const matrix = sampleCandidate(oriented, candidate);
220
+ if (!matrix) continue;
221
+ let decoded: DotCodeDecodeResult;
222
+ try {
223
+ decoded = decodeDotCode(matrix, { rotation: 0, inverted: false });
224
+ } catch {
225
+ continue;
226
+ }
227
+ const detectionCorners = cornersFor(candidate, binaryImage, rotation);
228
+ const centre = detectionCorners.reduce(
229
+ (sum, point) => ({ x: sum.x + point.x / 4, y: sum.y + point.y / 4 }),
230
+ { x: 0, y: 0 },
231
+ );
232
+ const shape = [decoded.width, decoded.height].sort((left, right) => left - right).join('x');
233
+ const key = `${decoded.text}\u0000${shape}\u0000${Math.round(centre.x / (scale * 2))},${Math.round(centre.y / (scale * 2))}`;
234
+ if (seen.has(key)) continue;
235
+ seen.add(key);
236
+ detections.push({
237
+ ...decoded,
238
+ rotation,
239
+ inverted,
240
+ matrix,
241
+ moduleSize: scale,
242
+ corners: detectionCorners,
243
+ });
244
+ // The first strict hit for a given orientation and scale is the
245
+ // highest-quality hypothesis; later dimensions are usually margin
246
+ // variants of the same symbol.
247
+ break;
248
+ }
249
+ }
250
+ }
251
+ }
252
+ detections.sort((left, right) => left.corrections - right.corrections || right.moduleSize - left.moduleSize);
253
+ return detections;
254
+ }
255
+
256
+ /** Return the first strictly decoded DotCode result, or an empty array. */
257
+ export function detectAndDecodeDotCode(binaryImage: BitMatrix, options: DotCodeDetectOptions = {}): DotCodeDetection[] {
258
+ try {
259
+ return detectDotCode(binaryImage, options);
260
+ } catch {
261
+ return [];
262
+ }
263
+ }
@@ -0,0 +1,69 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-License-Identifier: MIT
27
+ *
28
+ * Original work. No code from any other barcode implementation.
29
+ */
30
+ /** Original dependency-free DotCode encoder. @module dotcode/encoder */
31
+ import { BitMatrix } from '../core/bit-matrix.js';
32
+ export type DotCodeInput = string | Uint8Array | number[];
33
+ export type DotCodeEncoding = 'utf8' | 'latin1' | 'binary';
34
+ export type DotCodeMask = 0 | 1 | 2 | 3;
35
+ export interface DotCodeEncodeOptions {
36
+ /** Exact logical width. Must be paired with height, or used with auto height. */
37
+ width?: number;
38
+ /** Exact logical height. Must be paired with width, or used with auto width. */
39
+ height?: number;
40
+ /** Aliases for width and height used by other matrix format APIs. */
41
+ columns?: number;
42
+ rows?: number;
43
+ /** 0..3. The default chooses the least pathological of the four masks. */
44
+ mask?: DotCodeMask;
45
+ /** Interpret ASCII 29 as FNC1 and preserve GS1 semantics. */
46
+ gs1?: boolean;
47
+ /** String input encoding. UTF-8 is the default; byte arrays are unchanged. */
48
+ encoding?: DotCodeEncoding;
49
+ /** Target width/height ratio for automatic sizing. Defaults to 1.5. */
50
+ aspectRatio?: number;
51
+ }
52
+ export interface DotCodeMetadata {
53
+ readonly format: 'dotcode';
54
+ readonly width: number;
55
+ readonly height: number;
56
+ readonly mask: DotCodeMask;
57
+ readonly dataCodewords: number;
58
+ readonly errorCodewords: number;
59
+ readonly modulePositions: number;
60
+ readonly gs1: boolean;
61
+ readonly encoding: DotCodeEncoding;
62
+ }
63
+ export type DotCodeMatrix = BitMatrix & {
64
+ dotcode?: DotCodeMetadata;
65
+ };
66
+ /** Encode a string or byte payload into a DotCode module matrix. */
67
+ export declare function encodeDotCode(value: DotCodeInput, options?: DotCodeEncodeOptions): DotCodeMatrix;
68
+ /** Encode an explicit set of unmasked data codewords for conformance fixtures. */
69
+ export declare function encodeDotCodeCodewords(codewords: readonly number[], options?: DotCodeEncodeOptions): DotCodeMatrix;