ilx1-x-tool 1.2.4 → 1.2.6
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/dist/index.d.mts +186 -165
- package/dist/index.d.ts +186 -165
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +40 -40
package/dist/index.d.mts
CHANGED
|
@@ -106,6 +106,17 @@ declare const decompressJsonGzip: (file: File) => Promise<any>;
|
|
|
106
106
|
* @return {*}
|
|
107
107
|
********************************************************************************/
|
|
108
108
|
declare function isShowPopover(popId: string): boolean;
|
|
109
|
+
/********************************************************************************
|
|
110
|
+
* @brief: 关闭指定Popover
|
|
111
|
+
* @param {string} id
|
|
112
|
+
* @return {*}
|
|
113
|
+
********************************************************************************/
|
|
114
|
+
declare const closePopoverByID: (id: string) => void;
|
|
115
|
+
/********************************************************************************
|
|
116
|
+
* @brief: 关闭页面所有原生Popover
|
|
117
|
+
* @return {*}
|
|
118
|
+
********************************************************************************/
|
|
119
|
+
declare const closeAllNativePopover: () => void;
|
|
109
120
|
/********************************************************************************
|
|
110
121
|
* @brief: 判断图片是否有效
|
|
111
122
|
* @param {string} src
|
|
@@ -297,172 +308,182 @@ interface IConfig {
|
|
|
297
308
|
/********************************************************************************
|
|
298
309
|
* @brief: 图像处理工具函数库主对象
|
|
299
310
|
********************************************************************************/
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
* @param: 无
|
|
440
|
-
* @return {Array} 默认配置数组
|
|
441
|
-
********************************************************************************/
|
|
442
|
-
getDefaultConfig: () => number[];
|
|
311
|
+
/********************************************************************************
|
|
312
|
+
* @brief: 生成十六进制数组
|
|
313
|
+
* @param {string} picData - base64图像数据
|
|
314
|
+
* @param {number} thresholdData - 阈值
|
|
315
|
+
* @param {Array} config - 配置数组
|
|
316
|
+
* @return {Promise<Array|Uint8Array>} 十六进制数组
|
|
317
|
+
********************************************************************************/
|
|
318
|
+
declare function generate(picData: string, thresholdData: number, config: number[]): Promise<Uint8Array | string[]>;
|
|
319
|
+
/********************************************************************************
|
|
320
|
+
* @brief: ImageData 对象转 hexArray
|
|
321
|
+
* @param {ImageData} imageData - 图像数据对象
|
|
322
|
+
* @param {number} threshold - 阈值
|
|
323
|
+
* @param {Array} config - 配置数组
|
|
324
|
+
* @return {Uint8Array} 处理后的字节数组
|
|
325
|
+
********************************************************************************/
|
|
326
|
+
declare function imageDataToHexArray(imageData: ImageData, threshold: number, config: number[]): Uint8Array;
|
|
327
|
+
/********************************************************************************
|
|
328
|
+
* @brief: 彩色图像取模 (RGB565格式)
|
|
329
|
+
* @param {Uint8ClampedArray} pixels - 像素数组
|
|
330
|
+
* @param {number} width - 图像宽度
|
|
331
|
+
* @param {number} height - 图像高度
|
|
332
|
+
* @param {Array} config - 配置数组
|
|
333
|
+
* @return {Uint8Array} RGB565格式的字节数组
|
|
334
|
+
********************************************************************************/
|
|
335
|
+
declare function colorImageSampling(pixels: Uint8ClampedArray, width: number, height: number, config: number[]): Uint8Array;
|
|
336
|
+
/********************************************************************************
|
|
337
|
+
* @brief: 逐行式取模 (从左到右,从上到下)
|
|
338
|
+
* @param {Array} unpackedBuffer - 解压后的像素缓冲区
|
|
339
|
+
* @param {number} width - 图像宽度
|
|
340
|
+
* @param {number} height - 图像高度
|
|
341
|
+
* @param {Array} config - 配置数组
|
|
342
|
+
* @return {Uint8Array} 取模后的字节数组
|
|
343
|
+
********************************************************************************/
|
|
344
|
+
declare function ImageSamplingRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
|
|
345
|
+
/********************************************************************************
|
|
346
|
+
* @brief: 逐列式取模 (从上到下,从左到右)
|
|
347
|
+
* @param {Array} unpackedBuffer - 解压后的像素缓冲区
|
|
348
|
+
* @param {number} width - 图像宽度
|
|
349
|
+
* @param {number} height - 图像高度
|
|
350
|
+
* @param {Array} config - 配置数组
|
|
351
|
+
* @return {Uint8Array} 取模后的字节数组
|
|
352
|
+
********************************************************************************/
|
|
353
|
+
declare function ImageSamplingCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
|
|
354
|
+
/********************************************************************************
|
|
355
|
+
* @brief: 列行式取模 (先列后行)
|
|
356
|
+
* @param {Array} unpackedBuffer - 解压后的像素缓冲区
|
|
357
|
+
* @param {number} width - 图像宽度
|
|
358
|
+
* @param {number} height - 图像高度
|
|
359
|
+
* @param {Array} config - 配置数组
|
|
360
|
+
* @return {Uint8Array} 取模后的字节数组
|
|
361
|
+
********************************************************************************/
|
|
362
|
+
declare function ImageSamplingColRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
|
|
363
|
+
/********************************************************************************
|
|
364
|
+
* @brief: 行列式取模 (先行后列)
|
|
365
|
+
* @param {Array} unpackedBuffer - 解压后的像素缓冲区
|
|
366
|
+
* @param {number} width - 图像宽度
|
|
367
|
+
* @param {number} height - 图像高度
|
|
368
|
+
* @param {Array} config - 配置数组
|
|
369
|
+
* @return {Uint8Array} 取模后的字节数组
|
|
370
|
+
********************************************************************************/
|
|
371
|
+
declare function ImageSamplingRowCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
|
|
372
|
+
/********************************************************************************
|
|
373
|
+
* @brief: base64 转 ImageData 对象
|
|
374
|
+
* @param {string} base64Data - base64编码的图像数据
|
|
375
|
+
* @return {Promise<ImageData>} ImageData对象
|
|
376
|
+
********************************************************************************/
|
|
377
|
+
declare function base64ToImageData(base64Data: string): Promise<ImageData>;
|
|
378
|
+
/********************************************************************************
|
|
379
|
+
* @brief: 调整图像大小
|
|
380
|
+
********************************************************************************/
|
|
381
|
+
declare function resizeImage(width: number, height: number, imageSource: string | HTMLImageElement, colorMode: boolean): Promise<string>;
|
|
382
|
+
/********************************************************************************
|
|
383
|
+
* @brief: base64 转 Image 对象
|
|
384
|
+
* @param {string} base64
|
|
385
|
+
* @return {*}
|
|
386
|
+
********************************************************************************/
|
|
387
|
+
declare const base64ToImage: (base64: string) => Promise<HTMLImageElement>;
|
|
388
|
+
/********************************************************************************
|
|
389
|
+
* @brief: 使用 Konva.js 缩放图像
|
|
390
|
+
* @param {number} width - 目标宽度
|
|
391
|
+
* @param {number} height - 目标高度
|
|
392
|
+
* @param {HTMLImageElement} image - 源图像对象
|
|
393
|
+
* @param {boolean} colorMode - 是否转换为灰度
|
|
394
|
+
* @return {Promise<string>} base64编码的缩放后图像
|
|
395
|
+
********************************************************************************/
|
|
396
|
+
declare function resizeImageWithKonva(width: number, height: number, image: HTMLImageElement, colorMode: boolean): Promise<string>;
|
|
397
|
+
/********************************************************************************
|
|
398
|
+
* @brief: 使用 Canvas API 缩放图像 (Konva不可用时的备选方案)
|
|
399
|
+
* @param {number} width - 目标宽度
|
|
400
|
+
* @param {number} height - 目标高度
|
|
401
|
+
* @param {HTMLImageElement} image - 源图像对象
|
|
402
|
+
* @param {boolean} colorMode - 是否转换为灰度
|
|
403
|
+
* @return {Promise<string>} base64编码的缩放后图像
|
|
404
|
+
********************************************************************************/
|
|
405
|
+
declare function resizeImageWithCanvas(width: any, height: any, image: any, colorMode: any): Promise<string>;
|
|
406
|
+
/********************************************************************************
|
|
407
|
+
* @brief: Uint8Array 转十六进制字符串
|
|
408
|
+
* @param {Uint8Array} array - 字节数组
|
|
409
|
+
* @return {string} 十六进制字符串
|
|
410
|
+
********************************************************************************/
|
|
411
|
+
declare function arrayToHex(array: any): string;
|
|
412
|
+
/********************************************************************************
|
|
413
|
+
* @brief: 十六进制数据加 '0x' 前缀
|
|
414
|
+
* @param {string} hex - 十六进制字符串
|
|
415
|
+
* @return {Array<string>} 带0x前缀的十六进制数组
|
|
416
|
+
********************************************************************************/
|
|
417
|
+
declare function hex2hex(hex: string): Array<string>;
|
|
418
|
+
/********************************************************************************
|
|
419
|
+
* @brief: 生成取模预览 (0=白点, 1=黑点)
|
|
420
|
+
* @param {Uint8Array} unpackedBuffer - 解压后的像素缓冲区
|
|
421
|
+
* @param {number} width - 图像宽度
|
|
422
|
+
* @return {string} 预览字符串
|
|
423
|
+
********************************************************************************/
|
|
424
|
+
declare function generatePreview(unpackedBuffer: Uint8Array, width: number): string;
|
|
425
|
+
/********************************************************************************
|
|
426
|
+
* @brief: 创建图像数据对象(兼容性函数)
|
|
427
|
+
* @param {number} width - 图像宽度
|
|
428
|
+
* @param {number} height - 图像高度
|
|
429
|
+
* @param {Uint8ClampedArray} data - 像素数据
|
|
430
|
+
* @return {ImageData} ImageData对象
|
|
431
|
+
********************************************************************************/
|
|
432
|
+
declare function createImageData(width: number, height: number, data?: Uint8ClampedArray): ImageData;
|
|
433
|
+
/********************************************************************************
|
|
434
|
+
* @brief: 将字节数组格式化为可读字符串
|
|
435
|
+
* @param {Uint8Array|Array} hexArray - 十六进制数组
|
|
436
|
+
* @param {number} format - 输出格式 (0=带0x前缀, 1=原始数组)
|
|
437
|
+
* @param {number} lineBreak - 每行显示的字节数
|
|
438
|
+
* @return {string} 格式化后的字符串
|
|
439
|
+
********************************************************************************/
|
|
440
|
+
declare function formatHexOutput(hexArray: Uint8Array | Array<string>, format?: number, lineBreak?: number): string;
|
|
441
|
+
/********************************************************************************
|
|
442
|
+
* @brief: 计算输出字节数
|
|
443
|
+
* @param {Uint8Array|Array} hexArray - 十六进制数组
|
|
444
|
+
* @return {Object} 包含字节数和KB数的对象
|
|
445
|
+
********************************************************************************/
|
|
446
|
+
declare function calculateOutputSize(hexArray: Uint8Array | Array<string>): {
|
|
447
|
+
bytes: number;
|
|
448
|
+
kilobytes: number;
|
|
449
|
+
formatted: string;
|
|
443
450
|
};
|
|
444
451
|
/********************************************************************************
|
|
445
|
-
* @brief:
|
|
452
|
+
* @brief: 获取取模方式描述
|
|
453
|
+
* @param {number} mode - 取模方式代码
|
|
454
|
+
* @return {string} 取模方式描述
|
|
455
|
+
********************************************************************************/
|
|
456
|
+
declare function getSamplingModeDescription(mode: number): string;
|
|
457
|
+
/********************************************************************************
|
|
458
|
+
* @brief: 获取配置数组的默认值
|
|
446
459
|
* @param: 无
|
|
447
|
-
* @return
|
|
448
|
-
********************************************************************************/
|
|
449
|
-
declare
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
declare const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
460
|
+
* @return {Array} 默认配置数组
|
|
461
|
+
********************************************************************************/
|
|
462
|
+
declare function getDefaultConfig(): number[];
|
|
463
|
+
/********************************************************************************
|
|
464
|
+
* @brief: 图像处理工具函数库主对象(为了向后兼容)
|
|
465
|
+
********************************************************************************/
|
|
466
|
+
declare const ImageToHexArray: {
|
|
467
|
+
generate: typeof generate;
|
|
468
|
+
imageDataToHexArray: typeof imageDataToHexArray;
|
|
469
|
+
colorImageSampling: typeof colorImageSampling;
|
|
470
|
+
ImageSamplingRow: typeof ImageSamplingRow;
|
|
471
|
+
ImageSamplingCol: typeof ImageSamplingCol;
|
|
472
|
+
ImageSamplingColRow: typeof ImageSamplingColRow;
|
|
473
|
+
ImageSamplingRowCol: typeof ImageSamplingRowCol;
|
|
474
|
+
base64ToImageData: typeof base64ToImageData;
|
|
475
|
+
resizeImage: typeof resizeImage;
|
|
476
|
+
base64ToImage: (base64: string) => Promise<HTMLImageElement>;
|
|
477
|
+
resizeImageWithKonva: typeof resizeImageWithKonva;
|
|
478
|
+
resizeImageWithCanvas: typeof resizeImageWithCanvas;
|
|
479
|
+
arrayToHex: typeof arrayToHex;
|
|
480
|
+
hex2hex: typeof hex2hex;
|
|
481
|
+
generatePreview: typeof generatePreview;
|
|
482
|
+
createImageData: typeof createImageData;
|
|
483
|
+
formatHexOutput: typeof formatHexOutput;
|
|
484
|
+
calculateOutputSize: typeof calculateOutputSize;
|
|
485
|
+
getSamplingModeDescription: typeof getSamplingModeDescription;
|
|
486
|
+
getDefaultConfig: typeof getDefaultConfig;
|
|
487
|
+
};
|
|
467
488
|
|
|
468
|
-
export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };
|
|
489
|
+
export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImage, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, closeAllNativePopover, closePopoverByID, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImage, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };
|