ms-types 0.0.53 → 0.0.56
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/package.json +1 -1
- package/types/image.d.ts +37 -37
- package/types/index.d.ts +2 -1
- package/types/node.d.ts +9 -8
- package/types/paddleOcr.d.ts +6 -6
- package/types/tts.d.ts +100 -0
- package/types/ui.d.ts +0 -7
package/package.json
CHANGED
package/types/image.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare namespace image {
|
|
|
8
8
|
* @example
|
|
9
9
|
* const imageId = image.captureFullScreen()
|
|
10
10
|
* if (imageId) {
|
|
11
|
-
* image.saveTo(imageId, "screen.
|
|
11
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
14
|
function captureFullScreen(): string | null;
|
|
@@ -17,7 +17,7 @@ declare namespace image {
|
|
|
17
17
|
* @param imageId 图片id 路径 http地址或者 screen 实时截屏
|
|
18
18
|
* @param filePath 保存路径
|
|
19
19
|
* @example
|
|
20
|
-
* image.saveTo(imageId, "screen.
|
|
20
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
21
21
|
*/
|
|
22
22
|
function saveTo(imageId: string, filePath: string): void;
|
|
23
23
|
/**
|
|
@@ -27,7 +27,7 @@ declare namespace image {
|
|
|
27
27
|
* @example
|
|
28
28
|
* const imageId = image.captureFullScreen()
|
|
29
29
|
* if (imageId) {
|
|
30
|
-
* image.saveTo(imageId, "screen.
|
|
30
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
31
31
|
* image.isRelease(imageId) // false
|
|
32
32
|
* image.release(imageId)
|
|
33
33
|
* image.isRelease(imageId) // true
|
|
@@ -63,9 +63,9 @@ declare namespace image {
|
|
|
63
63
|
* @param path 图片路径
|
|
64
64
|
* @returns 图片id ,如果读取失败则返回null
|
|
65
65
|
* @example
|
|
66
|
-
* const imageId = image.readImage("screen.
|
|
66
|
+
* const imageId = image.readImage("screen.jpg")
|
|
67
67
|
* if (imageId) {
|
|
68
|
-
* image.saveTo(imageId, "screen.
|
|
68
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
69
69
|
* }
|
|
70
70
|
* image.release(imageId)
|
|
71
71
|
*/
|
|
@@ -75,7 +75,7 @@ declare namespace image {
|
|
|
75
75
|
* @param fileName 文件名
|
|
76
76
|
* @returns 图片id ,如果读取失败则返回null
|
|
77
77
|
* @example
|
|
78
|
-
* image.readResImage("test.
|
|
78
|
+
* image.readResImage("test.jpg")
|
|
79
79
|
*/
|
|
80
80
|
function readResImage(fileName: string): string | null;
|
|
81
81
|
/**
|
|
@@ -84,11 +84,11 @@ declare namespace image {
|
|
|
84
84
|
* @param degree 旋转角度 只能是 90 -90 180
|
|
85
85
|
* @returns 旋转后的图片id ,如果旋转失败则返回null
|
|
86
86
|
* @example
|
|
87
|
-
* const imageId = image.readImage("screen.
|
|
87
|
+
* const imageId = image.readImage("screen.jpg")
|
|
88
88
|
* if (imageId) {
|
|
89
89
|
* const newImageId = image.rotateImage(imageId, 90)
|
|
90
90
|
* if (newImageId) {
|
|
91
|
-
* image.saveTo(newImageId, "screen.
|
|
91
|
+
* image.saveTo(newImageId, "screen.jpg")
|
|
92
92
|
* }
|
|
93
93
|
* image.release(imageId)
|
|
94
94
|
* }
|
|
@@ -99,13 +99,13 @@ declare namespace image {
|
|
|
99
99
|
* @param imageId 图片id
|
|
100
100
|
* @param points 颜色点
|
|
101
101
|
* @param threshold 阈值
|
|
102
|
-
* @param x 左上角x
|
|
103
|
-
* @param y 左上角y
|
|
104
|
-
* @param ex 右下角x
|
|
105
|
-
* @param ey 右下角y
|
|
102
|
+
* @param x 左上角x 全屏传0
|
|
103
|
+
* @param y 左上角y 全屏传0
|
|
104
|
+
* @param ex 右下角x 全屏传0
|
|
105
|
+
* @param ey 右下角y 全屏传0
|
|
106
106
|
* @returns true 相同 false 不同
|
|
107
107
|
* @example
|
|
108
|
-
* const imageId = image.readImage("screen.
|
|
108
|
+
* const imageId = image.readImage("screen.jpg")
|
|
109
109
|
* if (imageId) {
|
|
110
110
|
* const isSame = image.cmpColor(imageId, "1|2|#6DD1E6-#101010", 10, 0, 0, 100, 100)
|
|
111
111
|
* if (isSame) {
|
|
@@ -127,15 +127,15 @@ declare namespace image {
|
|
|
127
127
|
* @param imageId 图片id
|
|
128
128
|
* @param color 颜色 支持"主色-偏色"格式,如"0x6DD1E6-0x101010"
|
|
129
129
|
* @param threshold 阈值
|
|
130
|
-
* @param x 左上角x
|
|
131
|
-
* @param y 左上角y
|
|
132
|
-
* @param ex 右下角x
|
|
133
|
-
* @param ey 右下角y
|
|
130
|
+
* @param x 左上角x 全屏传0
|
|
131
|
+
* @param y 左上角y 全屏传0
|
|
132
|
+
* @param ex 右下角x 全屏传0
|
|
133
|
+
* @param ey 右下角y 全屏传0
|
|
134
134
|
* @param limit 限制数量
|
|
135
135
|
* @param orz 查找方向1-8
|
|
136
136
|
* @returns 颜色点数组
|
|
137
137
|
* @example
|
|
138
|
-
* const imageId = image.readImage("screen.
|
|
138
|
+
* const imageId = image.readImage("screen.jpg")
|
|
139
139
|
* if (imageId) {
|
|
140
140
|
* const points = image.findColor(imageId, "0x6DD1E6-0x101010", 10, 0, 0, 100, 100, 1, 1)
|
|
141
141
|
* if (points.length > 0) {
|
|
@@ -161,15 +161,15 @@ declare namespace image {
|
|
|
161
161
|
* @param firstColor 第一个颜色
|
|
162
162
|
* @param threshold 阈值
|
|
163
163
|
* @param points 颜色点
|
|
164
|
-
* @param x 左上角x
|
|
165
|
-
* @param y 左上角y
|
|
166
|
-
* @param ex 右下角x
|
|
167
|
-
* @param ey 右下角y
|
|
164
|
+
* @param x 左上角x 全屏传0
|
|
165
|
+
* @param y 左上角y 全屏传0
|
|
166
|
+
* @param ex 右下角x 全屏传0
|
|
167
|
+
* @param ey 右下角y 全屏传0
|
|
168
168
|
* @param limit 限制数量
|
|
169
169
|
* @param orz 查找方向1-8
|
|
170
170
|
* @returns 颜色点数组
|
|
171
171
|
* @example
|
|
172
|
-
* const imageId = image.readImage("screen.
|
|
172
|
+
* const imageId = image.readImage("screen.jpg")
|
|
173
173
|
* if (imageId) {
|
|
174
174
|
* const points = image.findMultiColor(imageId, "0x6DD1E6-0x101010", 10, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
|
|
175
175
|
* if (points.length > 0) {
|
|
@@ -194,16 +194,16 @@ declare namespace image {
|
|
|
194
194
|
* 查找图片
|
|
195
195
|
* @param imageId 图片id
|
|
196
196
|
* @param templateImageId 模板图片id
|
|
197
|
-
* @param x 左上角x
|
|
198
|
-
* @param y 左上角y
|
|
199
|
-
* @param ex 右下角x
|
|
200
|
-
* @param ey 右下角y
|
|
197
|
+
* @param x 左上角x 全屏传0
|
|
198
|
+
* @param y 左上角y 全屏传0
|
|
199
|
+
* @param ex 右下角x 全屏传0
|
|
200
|
+
* @param ey 右下角y 全屏传0
|
|
201
201
|
* @param threshold 阈值
|
|
202
202
|
* @param limit 限制数量
|
|
203
203
|
* @param method 方法
|
|
204
204
|
* @returns 图片数组
|
|
205
205
|
* @example
|
|
206
|
-
* const points = image.findImage("screen", "template.
|
|
206
|
+
* const points = image.findImage("screen", "template.jpg", 0, 0, 100, 100, 0.8, 1, 5)
|
|
207
207
|
* if (points.length > 0) {
|
|
208
208
|
* logger.info("找到图片")
|
|
209
209
|
* }
|
|
@@ -238,7 +238,7 @@ declare namespace image {
|
|
|
238
238
|
* @param ey 坐标ey
|
|
239
239
|
* @returns 裁剪后的图片id
|
|
240
240
|
* @example
|
|
241
|
-
* const imageId = image.readImage("screen.
|
|
241
|
+
* const imageId = image.readImage("screen.jpg")
|
|
242
242
|
* if (imageId) {
|
|
243
243
|
* const clipImageId = image.clip(imageId, 0, 0, 100, 100)
|
|
244
244
|
* if (clipImageId) {
|
|
@@ -261,7 +261,7 @@ declare namespace image {
|
|
|
261
261
|
* @param y 坐标y
|
|
262
262
|
* @returns 颜色值
|
|
263
263
|
* @example
|
|
264
|
-
* const imageId = image.readImage("screen.
|
|
264
|
+
* const imageId = image.readImage("screen.jpg")
|
|
265
265
|
* if (imageId) {
|
|
266
266
|
* const color = image.pixel(imageId, 0, 0)
|
|
267
267
|
* logger.info(color)
|
|
@@ -275,7 +275,7 @@ declare namespace image {
|
|
|
275
275
|
* @param color 颜色值
|
|
276
276
|
* @returns 16进制RGB字符串
|
|
277
277
|
* @example
|
|
278
|
-
* const imageId = image.readImage("screen.
|
|
278
|
+
* const imageId = image.readImage("screen.jpg")
|
|
279
279
|
* if (imageId) {
|
|
280
280
|
* const color = image.pixel(imageId, 0, 0)
|
|
281
281
|
* logger.info(image.argb(imageId, color))
|
|
@@ -289,7 +289,7 @@ declare namespace image {
|
|
|
289
289
|
* @param threshold 阈值
|
|
290
290
|
* @returns 二值化后的图片id
|
|
291
291
|
* @example
|
|
292
|
-
* const imageId = image.readImage("screen.
|
|
292
|
+
* const imageId = image.readImage("screen.jpg")
|
|
293
293
|
* if (imageId) {
|
|
294
294
|
* const binaryzationImageId = image.binaryzation(imageId, 128)
|
|
295
295
|
* if (binaryzationImageId) {
|
|
@@ -304,7 +304,7 @@ declare namespace image {
|
|
|
304
304
|
* @param imageId 图片id
|
|
305
305
|
* @returns 灰度化后的图片id
|
|
306
306
|
* @example
|
|
307
|
-
* const imageId = image.readImage("screen.
|
|
307
|
+
* const imageId = image.readImage("screen.jpg")
|
|
308
308
|
* if (imageId) {
|
|
309
309
|
* const grayImageId = image.gray(imageId)
|
|
310
310
|
* if (grayImageId) {
|
|
@@ -319,7 +319,7 @@ declare namespace image {
|
|
|
319
319
|
* @param base64 base64字符串
|
|
320
320
|
* @returns 图片id
|
|
321
321
|
* @example
|
|
322
|
-
* const imageId = image.base64ToImage("data:image/
|
|
322
|
+
* const imageId = image.base64ToImage("data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==")
|
|
323
323
|
* if (imageId) {
|
|
324
324
|
* logger.info("base64转图片成功")
|
|
325
325
|
* }
|
|
@@ -333,9 +333,9 @@ declare namespace image {
|
|
|
333
333
|
* @param q 质量 1-100 数字越大质量越高
|
|
334
334
|
* @returns base64字符串
|
|
335
335
|
* @example
|
|
336
|
-
* const imageId = image.readImage("screen.
|
|
336
|
+
* const imageId = image.readImage("screen.jpg")
|
|
337
337
|
* if (imageId) {
|
|
338
|
-
* const base64 = image.toBase64Format(imageId, "
|
|
338
|
+
* const base64 = image.toBase64Format(imageId, "jpg", 100)
|
|
339
339
|
* logger.info(base64)
|
|
340
340
|
* }
|
|
341
341
|
* image.release(imageId)
|
|
@@ -353,7 +353,7 @@ declare namespace image {
|
|
|
353
353
|
* @param thickness 线宽
|
|
354
354
|
* @returns 无
|
|
355
355
|
* @example
|
|
356
|
-
* const imageId = image.readImage("screen.
|
|
356
|
+
* const imageId = image.readImage("screen.jpg")
|
|
357
357
|
* if (imageId) {
|
|
358
358
|
* image.drawRect(imageId, 0, 0, 100, 100, "#ff0000", 1)
|
|
359
359
|
* }
|
package/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
/// <reference path="system.d.ts" />
|
|
19
19
|
/// <reference path="thread.d.ts" />
|
|
20
20
|
/// <reference path="tomatoOcr.d.ts" />
|
|
21
|
+
/// <reference path="tts.d.ts" />
|
|
21
22
|
/// <reference path="ui.d.ts" />
|
|
22
23
|
/// <reference path="utils.d.ts" />
|
|
23
|
-
/// <reference path="yolo.d.ts" />
|
|
24
|
+
/// <reference path="yolo.d.ts" />
|
package/types/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 节点模块 包含节点操作、节点内容读写等功能
|
|
3
3
|
*/
|
|
4
|
-
declare function createNodeSelector(params
|
|
4
|
+
declare function createNodeSelector(params?: {
|
|
5
5
|
/**
|
|
6
6
|
* 1 代表不管visible是true还是false都获取,2 代表只获取 visible=true的节点
|
|
7
7
|
*/
|
|
@@ -116,12 +116,12 @@ declare interface NodeInfo {
|
|
|
116
116
|
/**
|
|
117
117
|
* 获取父节点
|
|
118
118
|
*/
|
|
119
|
-
parent(): NodeInfo;
|
|
119
|
+
parent(): NodeInfo | null;
|
|
120
120
|
/**
|
|
121
121
|
* 获取子节点
|
|
122
122
|
* @param index 子节点索引
|
|
123
123
|
*/
|
|
124
|
-
child(index: number): NodeInfo;
|
|
124
|
+
child(index: number): NodeInfo | null;
|
|
125
125
|
/**
|
|
126
126
|
* 获取所有子节点
|
|
127
127
|
*/
|
|
@@ -146,20 +146,21 @@ declare interface NodeInfo {
|
|
|
146
146
|
declare class NodeSelector {
|
|
147
147
|
/**
|
|
148
148
|
* 获取节点信息
|
|
149
|
-
* @param timeout 超时时间,单位毫秒
|
|
149
|
+
* @param timeout 超时时间,单位毫秒 默认为 5000 毫秒
|
|
150
150
|
* @returns 节点信息数组
|
|
151
151
|
*/
|
|
152
|
-
getNodeInfo(timeout
|
|
152
|
+
getNodeInfo(timeout?: number): NodeInfo[];
|
|
153
153
|
/**
|
|
154
154
|
* 获取一个节点信息
|
|
155
|
-
* @param timeout 超时时间,单位毫秒
|
|
155
|
+
* @param timeout 超时时间,单位毫秒 默认为 5000 毫秒
|
|
156
156
|
* @returns 节点信息
|
|
157
157
|
*/
|
|
158
|
-
getOneNodeInfo(timeout
|
|
158
|
+
getOneNodeInfo(timeout?: number): NodeInfo | null;
|
|
159
159
|
/**
|
|
160
160
|
* 加载节点
|
|
161
|
+
* @param timeout 超时时间,单位毫秒 默认为 5000 毫秒
|
|
161
162
|
*/
|
|
162
|
-
loadNode(timeout
|
|
163
|
+
loadNode(timeout?: number): NodeSelector;
|
|
163
164
|
/**
|
|
164
165
|
* 清除条件
|
|
165
166
|
*/
|
package/types/paddleOcr.d.ts
CHANGED
|
@@ -34,10 +34,10 @@ declare namespace paddleOcr {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* 初始化PP-OCRv5模型
|
|
37
|
-
* @param maxSideLen 最大边长,默认
|
|
37
|
+
* @param maxSideLen 最大边长,默认640,可不传
|
|
38
38
|
* @returns 初始化是否成功
|
|
39
39
|
* @example
|
|
40
|
-
* const loaded = paddleOcr.loadV5(
|
|
40
|
+
* const loaded = paddleOcr.loadV5(640)
|
|
41
41
|
* if (loaded) {
|
|
42
42
|
* logger.info("加载成功")
|
|
43
43
|
* }
|
|
@@ -46,10 +46,10 @@ declare namespace paddleOcr {
|
|
|
46
46
|
/**
|
|
47
47
|
* 执行OCR识别
|
|
48
48
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
49
|
-
* @param x 边界框左上角x坐标
|
|
50
|
-
* @param y 边界框左上角y坐标
|
|
51
|
-
* @param ex 边界框右下角x坐标
|
|
52
|
-
* @param ey 边界框右下角y坐标
|
|
49
|
+
* @param x 边界框左上角x坐标 全屏传0
|
|
50
|
+
* @param y 边界框左上角y坐标 全屏传0
|
|
51
|
+
* @param ex 边界框右下角x坐标 全屏传0
|
|
52
|
+
* @param ey 边界框右下角y坐标 全屏传0
|
|
53
53
|
* @param confidenceThreshold 置信度阈值,默认0.6
|
|
54
54
|
* @returns 识别结果数组
|
|
55
55
|
* @example
|
package/types/tts.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TTS(文本转语音)模块 包含语音合成、播放控制等功能
|
|
3
|
+
*/
|
|
4
|
+
declare namespace tts {
|
|
5
|
+
/**
|
|
6
|
+
* 语音信息接口
|
|
7
|
+
*/
|
|
8
|
+
interface VoiceInfo {
|
|
9
|
+
/** 语音标识符 */
|
|
10
|
+
identifier: string;
|
|
11
|
+
/** 语音名称 */
|
|
12
|
+
name: string;
|
|
13
|
+
/** 语言代码 */
|
|
14
|
+
language: string;
|
|
15
|
+
/** 语音质量等级 */
|
|
16
|
+
quality: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 播放文本转语音(5参数版本)
|
|
21
|
+
* @param text 要转换的文本
|
|
22
|
+
* @param rate 语速,范围0.0-1.0,默认0.5
|
|
23
|
+
* @param pitch 音调,范围0.5-2.0,默认1.0
|
|
24
|
+
* @param volume 音量,范围0.0-1.0,默认1.0
|
|
25
|
+
* @param language 语言代码,默认"zh-CN"
|
|
26
|
+
* @returns 是否成功开始播放
|
|
27
|
+
* @example
|
|
28
|
+
* const success = tts.speak("你好世界", 0.5, 1.0, 1.0, "zh-CN");
|
|
29
|
+
*/
|
|
30
|
+
function speak(
|
|
31
|
+
text: string,
|
|
32
|
+
rate: number,
|
|
33
|
+
pitch: number,
|
|
34
|
+
volume: number,
|
|
35
|
+
language: string
|
|
36
|
+
): boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 播放文本转语音(简化版本)
|
|
40
|
+
* @param text 要转换的文本
|
|
41
|
+
* @returns 是否成功开始播放
|
|
42
|
+
* @example
|
|
43
|
+
* const success = tts.speak("Hello World");
|
|
44
|
+
*/
|
|
45
|
+
function speak(text: string): boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 停止当前播放
|
|
49
|
+
* @example
|
|
50
|
+
* tts.stop();
|
|
51
|
+
*/
|
|
52
|
+
function stop(): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 暂停播放
|
|
56
|
+
* @example
|
|
57
|
+
* tts.pause();
|
|
58
|
+
*/
|
|
59
|
+
function pause(): void;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 继续播放
|
|
63
|
+
* @example
|
|
64
|
+
* tts.resume();
|
|
65
|
+
*/
|
|
66
|
+
function resume(): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 检查是否正在播放
|
|
70
|
+
* @returns 是否正在播放
|
|
71
|
+
* @example
|
|
72
|
+
* if (tts.isSpeaking()) {
|
|
73
|
+
* logger.info("正在播放");
|
|
74
|
+
* }
|
|
75
|
+
*/
|
|
76
|
+
function isSpeaking(): boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 获取可用的语音列表
|
|
80
|
+
* @returns 语音信息数组
|
|
81
|
+
* @example
|
|
82
|
+
* const voices = tts.getAvailableVoices();
|
|
83
|
+
* voices.forEach(voice => {
|
|
84
|
+
* logger.info(`语音: ${voice.name}, 语言: ${voice.language}, 标识符: ${voice.identifier}`);
|
|
85
|
+
* });
|
|
86
|
+
*/
|
|
87
|
+
function getAvailableVoices(): VoiceInfo[];
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 设置语音
|
|
91
|
+
* @param voiceIdentifier 语音标识符
|
|
92
|
+
* @returns 是否设置成功
|
|
93
|
+
* @example
|
|
94
|
+
* const success = tts.setVoice("com.apple.ttsbundle.Samantha-compact");
|
|
95
|
+
* if (success) {
|
|
96
|
+
* logger.info("语音设置成功");
|
|
97
|
+
* }
|
|
98
|
+
*/
|
|
99
|
+
function setVoice(voiceIdentifier: string): boolean;
|
|
100
|
+
}
|
package/types/ui.d.ts
CHANGED
|
@@ -62,13 +62,6 @@ declare namespace ms {
|
|
|
62
62
|
*/
|
|
63
63
|
function getAllConfig(): Promise<Record<string, any>>;
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* 设置所有配置
|
|
67
|
-
* @param configs 包含所有配置的字典
|
|
68
|
-
* @returns 如果设置成功返回true,否则返回false
|
|
69
|
-
*/
|
|
70
|
-
function setAllConfig(configs: Record<string, any>): Promise<boolean>;
|
|
71
|
-
|
|
72
65
|
/**
|
|
73
66
|
* 获取服务器设备ID
|
|
74
67
|
* @returns 服务器设备ID
|