@qr-platform/qr-code.js 0.8.20 → 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/CHANGELOG.md +6 -0
- package/docs/documentation.md +5 -4
- package/docs/examples.md +62 -0
- package/docs/usage-guide.md +20 -0
- package/lib/builder/index.d.ts +13 -0
- package/lib/builder/node.d.ts +13 -0
- package/lib/builder/qr-code-builder.d.ts +25 -0
- package/lib/chunks/zbar-scan-validator-B3GQk_mt.js +1 -0
- package/lib/chunks/zxing-scan-validator-CYcyNnMt.js +1 -0
- package/lib/core/qr-code-js.d.ts +2 -0
- package/lib/core/qr-templates.d.ts +3 -0
- package/lib/index.d.ts +9 -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.d.ts +8 -0
- 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
@@ -2,9 +2,7 @@ import BinaryBitmap from '../core/BinaryBitmap';
|
|
2
2
|
import DecodeHintType from '../core/DecodeHintType';
|
3
3
|
import Reader from '../core/Reader';
|
4
4
|
import Result from '../core/Result';
|
5
|
-
import { DecodeContinuouslyCallback } from './DecodeContinuouslyCallback';
|
6
5
|
import { HTMLVisualMediaElement } from './HTMLVisualMediaElement';
|
7
|
-
import { VideoInputDevice } from './VideoInputDevice';
|
8
6
|
/**
|
9
7
|
*
|
10
8
|
* Base class for browser code reader.
|
@@ -25,14 +23,6 @@ export declare class BrowserCodeReader {
|
|
25
23
|
* If enumerateDevices under navigator is supported.
|
26
24
|
*/
|
27
25
|
get canEnumerateDevices(): boolean;
|
28
|
-
/**
|
29
|
-
* This will break the loop.
|
30
|
-
*/
|
31
|
-
private _stopContinuousDecode;
|
32
|
-
/**
|
33
|
-
* This will break the loop.
|
34
|
-
*/
|
35
|
-
private _stopAsyncDecode;
|
36
26
|
/**
|
37
27
|
* Delay time between decode attempts made by the scanner.
|
38
28
|
*/
|
@@ -62,29 +52,6 @@ export declare class BrowserCodeReader {
|
|
62
52
|
* used to unregister that listener when needed.
|
63
53
|
*/
|
64
54
|
protected imageLoadedListener: EventListener;
|
65
|
-
/**
|
66
|
-
* The stream output from camera.
|
67
|
-
*/
|
68
|
-
protected stream: MediaStream;
|
69
|
-
/**
|
70
|
-
* The HTML video element, used to display the camera stream.
|
71
|
-
*/
|
72
|
-
protected videoElement: HTMLVideoElement;
|
73
|
-
/**
|
74
|
-
* Should contain the current registered listener for video loaded-metadata,
|
75
|
-
* used to unregister that listener when needed.
|
76
|
-
*/
|
77
|
-
protected videoCanPlayListener: EventListener;
|
78
|
-
/**
|
79
|
-
* Should contain the current registered listener for video play-ended,
|
80
|
-
* used to unregister that listener when needed.
|
81
|
-
*/
|
82
|
-
protected videoEndedListener: EventListener;
|
83
|
-
/**
|
84
|
-
* Should contain the current registered listener for video playing,
|
85
|
-
* used to unregister that listener when needed.
|
86
|
-
*/
|
87
|
-
protected videoPlayingEventListener: EventListener;
|
88
55
|
/**
|
89
56
|
* Sets the hints.
|
90
57
|
*/
|
@@ -101,144 +68,6 @@ export declare class BrowserCodeReader {
|
|
101
68
|
* @memberOf BrowserCodeReader
|
102
69
|
*/
|
103
70
|
constructor(reader: Reader, timeBetweenScansMillis?: number, _hints?: Map<DecodeHintType, any> | undefined);
|
104
|
-
/**
|
105
|
-
* Lists all the available video input devices.
|
106
|
-
*/
|
107
|
-
listVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
108
|
-
/**
|
109
|
-
* Obtain the list of available devices with type 'videoinput'.
|
110
|
-
*
|
111
|
-
* @returns {Promise<VideoInputDevice[]>} an array of available video input devices
|
112
|
-
*
|
113
|
-
* @memberOf BrowserCodeReader
|
114
|
-
*
|
115
|
-
* @deprecated Use `listVideoInputDevices` instead.
|
116
|
-
*/
|
117
|
-
getVideoInputDevices(): Promise<VideoInputDevice[]>;
|
118
|
-
/**
|
119
|
-
* Let's you find a device using it's Id.
|
120
|
-
*/
|
121
|
-
findDeviceById(deviceId: string): Promise<MediaDeviceInfo>;
|
122
|
-
/**
|
123
|
-
* Decodes the barcode from the device specified by deviceId while showing the video in the specified video element.
|
124
|
-
*
|
125
|
-
* @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
|
126
|
-
* @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
127
|
-
* @returns The decoding result.
|
128
|
-
*
|
129
|
-
* @memberOf BrowserCodeReader
|
130
|
-
*
|
131
|
-
* @deprecated Use `decodeOnceFromVideoDevice` instead.
|
132
|
-
*/
|
133
|
-
decodeFromInputVideoDevice(deviceId?: string, videoSource?: string | HTMLVideoElement): Promise<Result>;
|
134
|
-
/**
|
135
|
-
* In one attempt, tries to decode the barcode from the device specified by deviceId while showing the video in the specified video element.
|
136
|
-
*
|
137
|
-
* @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
|
138
|
-
* @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
139
|
-
* @returns The decoding result.
|
140
|
-
*
|
141
|
-
* @memberOf BrowserCodeReader
|
142
|
-
*/
|
143
|
-
decodeOnceFromVideoDevice(deviceId?: string, videoSource?: string | HTMLVideoElement): Promise<Result>;
|
144
|
-
/**
|
145
|
-
* In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
|
146
|
-
*
|
147
|
-
* @param constraints the media stream constraints to get s valid media stream to decode from
|
148
|
-
* @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
149
|
-
* @returns The decoding result.
|
150
|
-
*
|
151
|
-
* @memberOf BrowserCodeReader
|
152
|
-
*/
|
153
|
-
decodeOnceFromConstraints(constraints: MediaStreamConstraints, videoSource?: string | HTMLVideoElement): Promise<Result>;
|
154
|
-
/**
|
155
|
-
* In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
|
156
|
-
*
|
157
|
-
* @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
|
158
|
-
* @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
159
|
-
* @returns {Promise<Result>} The decoding result.
|
160
|
-
*
|
161
|
-
* @memberOf BrowserCodeReader
|
162
|
-
*/
|
163
|
-
decodeOnceFromStream(stream: MediaStream, videoSource?: string | HTMLVideoElement): Promise<Result>;
|
164
|
-
/**
|
165
|
-
* Continuously decodes the barcode from the device specified by device while showing the video in the specified video element.
|
166
|
-
*
|
167
|
-
* @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
|
168
|
-
* @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
169
|
-
* @returns {Promise<void>}
|
170
|
-
*
|
171
|
-
* @memberOf BrowserCodeReader
|
172
|
-
*
|
173
|
-
* @deprecated Use `decodeFromVideoDevice` instead.
|
174
|
-
*/
|
175
|
-
decodeFromInputVideoDeviceContinuously(deviceId: string | null, videoSource: string | HTMLVideoElement | null, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
176
|
-
/**
|
177
|
-
* Continuously tries to decode the barcode from the device specified by device while showing the video in the specified video element.
|
178
|
-
*
|
179
|
-
* @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
|
180
|
-
* @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
181
|
-
* @returns {Promise<void>}
|
182
|
-
*
|
183
|
-
* @memberOf BrowserCodeReader
|
184
|
-
*/
|
185
|
-
decodeFromVideoDevice(deviceId: string | null, videoSource: string | HTMLVideoElement | null, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
186
|
-
/**
|
187
|
-
* Continuously tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
|
188
|
-
*
|
189
|
-
* @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
|
190
|
-
* @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
191
|
-
* @returns {Promise<Result>} The decoding result.
|
192
|
-
*
|
193
|
-
* @memberOf BrowserCodeReader
|
194
|
-
*/
|
195
|
-
decodeFromConstraints(constraints: MediaStreamConstraints, videoSource: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
196
|
-
/**
|
197
|
-
* In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
|
198
|
-
*
|
199
|
-
* @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
|
200
|
-
* @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
|
201
|
-
* @returns {Promise<Result>} The decoding result.
|
202
|
-
*
|
203
|
-
* @memberOf BrowserCodeReader
|
204
|
-
*/
|
205
|
-
decodeFromStream(stream: MediaStream, videoSource: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
206
|
-
/**
|
207
|
-
* Breaks the decoding loop.
|
208
|
-
*/
|
209
|
-
stopAsyncDecode(): void;
|
210
|
-
/**
|
211
|
-
* Breaks the decoding loop.
|
212
|
-
*/
|
213
|
-
stopContinuousDecode(): void;
|
214
|
-
/**
|
215
|
-
* Sets the new stream and request a new decoding-with-delay.
|
216
|
-
*
|
217
|
-
* @param stream The stream to be shown in the video element.
|
218
|
-
* @param decodeFn A callback for the decode method.
|
219
|
-
*/
|
220
|
-
protected attachStreamToVideo(stream: MediaStream, videoSource: string | HTMLVideoElement): Promise<HTMLVideoElement>;
|
221
|
-
/**
|
222
|
-
*
|
223
|
-
* @param videoElement
|
224
|
-
*/
|
225
|
-
protected playVideoOnLoadAsync(videoElement: HTMLVideoElement): Promise<void>;
|
226
|
-
/**
|
227
|
-
* Binds listeners and callbacks to the videoElement.
|
228
|
-
*
|
229
|
-
* @param element
|
230
|
-
* @param callbackFn
|
231
|
-
*/
|
232
|
-
protected playVideoOnLoad(element: HTMLVideoElement, callbackFn: EventListener): void;
|
233
|
-
/**
|
234
|
-
* Checks if the given video element is currently playing.
|
235
|
-
*/
|
236
|
-
isVideoPlaying(video: HTMLVideoElement): boolean;
|
237
|
-
/**
|
238
|
-
* Just tries to play the video and logs any errors.
|
239
|
-
* The play call is only made is the video is not already playing.
|
240
|
-
*/
|
241
|
-
tryPlayVideo(videoElement: HTMLVideoElement): Promise<void>;
|
242
71
|
/**
|
243
72
|
* Searches and validates a media element.
|
244
73
|
*/
|
@@ -253,79 +82,21 @@ export declare class BrowserCodeReader {
|
|
253
82
|
* @memberOf BrowserCodeReader
|
254
83
|
*/
|
255
84
|
decodeFromImage(source?: string | HTMLImageElement, url?: string): Promise<Result>;
|
256
|
-
/**
|
257
|
-
* Decodes the barcode from a video.
|
258
|
-
*
|
259
|
-
* @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
|
260
|
-
* @param {string} [url]
|
261
|
-
* @returns {Promise<Result>} The decoding result.
|
262
|
-
*
|
263
|
-
* @memberOf BrowserCodeReader
|
264
|
-
*/
|
265
|
-
decodeFromVideo(source?: string | HTMLVideoElement, url?: string): Promise<Result>;
|
266
|
-
/**
|
267
|
-
* Decodes continuously the barcode from a video.
|
268
|
-
*
|
269
|
-
* @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
|
270
|
-
* @param {string} [url]
|
271
|
-
* @returns {Promise<Result>} The decoding result.
|
272
|
-
*
|
273
|
-
* @memberOf BrowserCodeReader
|
274
|
-
*
|
275
|
-
* @experimental
|
276
|
-
*/
|
277
|
-
decodeFromVideoContinuously(source: string | HTMLVideoElement | null, url: string | null, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
278
85
|
/**
|
279
86
|
* Decodes something from an image HTML element.
|
280
87
|
*/
|
281
88
|
decodeFromImageElement(source: string | HTMLImageElement): Promise<Result>;
|
282
|
-
/**
|
283
|
-
* Decodes something from an image HTML element.
|
284
|
-
*/
|
285
|
-
decodeFromVideoElement(source: string | HTMLVideoElement): Promise<Result>;
|
286
|
-
/**
|
287
|
-
* Decodes something from an image HTML element.
|
288
|
-
*/
|
289
|
-
decodeFromVideoElementContinuously(source: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
290
|
-
/**
|
291
|
-
* Sets up the video source so it can be decoded when loaded.
|
292
|
-
*
|
293
|
-
* @param source The video source element.
|
294
|
-
*/
|
295
|
-
private _decodeFromVideoElementSetup;
|
296
89
|
/**
|
297
90
|
* Decodes an image from a URL.
|
298
91
|
*/
|
299
92
|
decodeFromImageUrl(url?: string): Promise<Result>;
|
300
|
-
/**
|
301
|
-
* Decodes an image from a URL.
|
302
|
-
*/
|
303
|
-
decodeFromVideoUrl(url: string): Promise<Result>;
|
304
|
-
/**
|
305
|
-
* Decodes an image from a URL.
|
306
|
-
*
|
307
|
-
* @experimental
|
308
|
-
*/
|
309
|
-
decodeFromVideoUrlContinuously(url: string, callbackFn: DecodeContinuouslyCallback): Promise<void>;
|
310
93
|
private _decodeOnLoadImage;
|
311
|
-
private _decodeOnLoadVideo;
|
312
|
-
private _decodeOnLoadVideoContinuously;
|
313
94
|
isImageLoaded(img: HTMLImageElement): boolean;
|
314
95
|
prepareImageElement(imageSource?: HTMLImageElement | string): HTMLImageElement;
|
315
96
|
/**
|
316
|
-
*
|
317
|
-
*
|
318
|
-
* @param videoSource The HTMLVideoElement to be set.
|
319
|
-
*/
|
320
|
-
prepareVideoElement(videoSource?: HTMLVideoElement | string): HTMLVideoElement;
|
321
|
-
/**
|
322
|
-
* Tries to decode from the video input until it finds some value.
|
97
|
+
* Tries to decode from the image input until it finds some value.
|
323
98
|
*/
|
324
99
|
decodeOnce(element: HTMLVisualMediaElement, retryIfNotFound?: boolean, retryIfChecksumOrFormatError?: boolean): Promise<Result>;
|
325
|
-
/**
|
326
|
-
* Continuously decodes from video input.
|
327
|
-
*/
|
328
|
-
decodeContinuously(element: HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): void;
|
329
100
|
/**
|
330
101
|
* Gets the BinaryBitmap for ya! (and decodes it)
|
331
102
|
*/
|
@@ -344,19 +115,6 @@ export declare class BrowserCodeReader {
|
|
344
115
|
*
|
345
116
|
*/
|
346
117
|
protected getCaptureCanvas(mediaElement?: HTMLVisualMediaElement): HTMLCanvasElement;
|
347
|
-
/**
|
348
|
-
* Overwriting this allows you to manipulate the next frame in anyway you want before decode.
|
349
|
-
*/
|
350
|
-
drawFrameOnCanvas(srcElement: HTMLVideoElement, dimensions?: {
|
351
|
-
sx: number;
|
352
|
-
sy: number;
|
353
|
-
sWidth: number;
|
354
|
-
sHeight: number;
|
355
|
-
dx: number;
|
356
|
-
dy: number;
|
357
|
-
dWidth: number;
|
358
|
-
dHeight: number;
|
359
|
-
}, canvasElementContext?: CanvasRenderingContext2D): void;
|
360
118
|
/**
|
361
119
|
* Ovewriting this allows you to manipulate the snapshot image in anyway you want before decode.
|
362
120
|
*/
|
@@ -379,32 +137,14 @@ export declare class BrowserCodeReader {
|
|
379
137
|
*/
|
380
138
|
createCaptureCanvas(mediaElement?: HTMLVisualMediaElement): HTMLCanvasElement;
|
381
139
|
/**
|
382
|
-
*
|
383
|
-
*/
|
384
|
-
protected stopStreams(): void;
|
385
|
-
/**
|
386
|
-
* Resets the code reader to the initial state. Cancels any ongoing barcode scanning from video or camera.
|
140
|
+
* Resets the code reader to the initial state.
|
387
141
|
*
|
388
142
|
* @memberOf BrowserCodeReader
|
389
143
|
*/
|
390
144
|
reset(): void;
|
391
|
-
private _destroyVideoElement;
|
392
145
|
private _destroyImageElement;
|
393
146
|
/**
|
394
|
-
*
|
147
|
+
* Destroys the capture canvas and context.
|
395
148
|
*/
|
396
149
|
private _destroyCaptureCanvas;
|
397
|
-
/**
|
398
|
-
* Defines what the videoElement src will be.
|
399
|
-
*
|
400
|
-
* @param videoElement
|
401
|
-
* @param stream
|
402
|
-
*/
|
403
|
-
addVideoSource(videoElement: HTMLVideoElement, stream: MediaStream): void;
|
404
|
-
/**
|
405
|
-
* Unbinds a HTML video src property.
|
406
|
-
*
|
407
|
-
* @param videoElement
|
408
|
-
*/
|
409
|
-
private cleanVideoSource;
|
410
150
|
}
|
@@ -5,15 +5,20 @@ import LuminanceSource from './LuminanceSource';
|
|
5
5
|
*/
|
6
6
|
export declare class NodeLuminanceSource extends LuminanceSource {
|
7
7
|
private buffer;
|
8
|
-
private _width;
|
9
|
-
private _height;
|
10
8
|
private constructor();
|
11
9
|
/**
|
12
10
|
* Asynchronously creates a NodeLuminanceSource from an image buffer.
|
13
|
-
*
|
14
|
-
* @param
|
11
|
+
* Can handle standard image formats (PNG/JPEG via Jimp) or raw RGBA buffers.
|
12
|
+
* @param bufferInput - The image data as a Buffer (PNG, JPEG, or raw RGBA).
|
13
|
+
* @param isPngOrJpeg - Flag indicating if the buffer is a standard format (true) or raw RGBA (false).
|
14
|
+
* @param width - Required width if bufferInput is raw RGBA.
|
15
|
+
* @param height - Required height if bufferInput is raw RGBA.
|
16
|
+
* @param doAutoInvert - If true, computes an inverted grayscale buffer (only relevant for grayscale conversion).
|
15
17
|
*/
|
16
|
-
static create(
|
18
|
+
static create(bufferInput: Buffer, isPngOrJpeg: boolean, // Renamed from isPng for clarity
|
19
|
+
width?: number, // Optional width
|
20
|
+
height?: number, // Optional height
|
21
|
+
doAutoInvert?: boolean): Promise<NodeLuminanceSource>;
|
17
22
|
/**
|
18
23
|
* Converts raw RGBA data to a grayscale buffer.
|
19
24
|
* If doAutoInvert is true, each computed luminance is inverted.
|
@@ -24,13 +29,5 @@ export declare class NodeLuminanceSource extends LuminanceSource {
|
|
24
29
|
isCropSupported(): boolean;
|
25
30
|
crop(left: number, top: number, width: number, height: number): LuminanceSource;
|
26
31
|
isRotateSupported(): boolean;
|
27
|
-
rotateCounterClockwise(): LuminanceSource;
|
28
|
-
rotateCounterClockwise45(): LuminanceSource;
|
29
|
-
/**
|
30
|
-
* Rotates the image by the specified angle (in degrees) using Sharp.
|
31
|
-
* This method creates a temporary RGBA image from the grayscale data,
|
32
|
-
* rotates it, then re-converts to grayscale.
|
33
|
-
*/
|
34
|
-
private rotate;
|
35
32
|
invert(): LuminanceSource;
|
36
33
|
}
|
package/lib/node.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { QRCodeBuilder } from './builder/node';
|
1
2
|
import { QRCodeJs as _QRCodeJs } from './core/qr-code-js';
|
2
3
|
import { type ValidationResult } from './license/LicenseManagerNode';
|
3
4
|
import type * as _browserUtils from './tools/browser-utils';
|
@@ -30,6 +31,13 @@ export declare class QRCodeJs extends _QRCodeJs {
|
|
30
31
|
static setLicenseUrl(url: string): typeof QRCodeJs;
|
31
32
|
constructor(options: RecursivePartial<Options>);
|
32
33
|
validateScanning(): Promise<ScanValidatorResponse>;
|
34
|
+
/**
|
35
|
+
* Creates a QRCodeBuilder instance initialized with a specific template.
|
36
|
+
* Allows for fluent configuration chaining.
|
37
|
+
* @param templateName - The name of the template to start with.
|
38
|
+
* @returns A new QRCodeBuilder instance.
|
39
|
+
*/
|
40
|
+
static useTemplate(templateName: string): QRCodeBuilder;
|
33
41
|
}
|
34
42
|
export declare class _ extends QRCodeJs {
|
35
43
|
protected _hls(): boolean;
|