ms-types 0.10.10 → 0.10.11
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/cryptoUtils.d.ts +50 -36
- package/types/dotocr.d.ts +9 -2
- package/types/file.d.ts +1 -1
- package/types/hid.d.ts +46 -4
- package/types/image.d.ts +447 -447
- package/types/lua/action.lua +6 -6
- package/types/lua/cryptoUtils.lua +7 -7
- package/types/lua/cv.lua +142 -142
- package/types/lua/dotocr.lua +4 -4
- package/types/lua/file.lua +1 -1
- package/types/lua/global.lua +5 -3
- package/types/lua/hid.lua +22 -22
- package/types/lua/http.lua +26 -11
- package/types/lua/image.lua +9 -5
- package/types/lua/node.lua +1 -1
- package/types/lua/pip.lua +6 -6
- package/types/lua/yolo.lua +1 -1
- package/types/lua/yolocls.lua +1 -1
- package/types/node.d.ts +1 -0
- package/types/opencv.d.ts +571 -38
- package/types/paddleocr.d.ts +1 -0
- package/types/pip.d.ts +11 -0
- package/types/system.d.ts +1 -0
- package/types/tts.d.ts +1 -1
- package/types/ui.d.ts +2 -0
- package/types/web.d.ts +16 -0
- package/types/zh/HID/346/250/241/345/235/227.d.ts +46 -4
- package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +10 -0
- package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +9 -2
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +2 -0
package/types/lua/dotocr.lua
CHANGED
|
@@ -20,12 +20,12 @@ local _DotOCR = {}
|
|
|
20
20
|
--- 从资源路径加载字库并缓存
|
|
21
21
|
---@param fontPath string
|
|
22
22
|
---@return string|nil 成功返回字库 ID,失败返回 `null`
|
|
23
|
-
---@example dotocr.loadFont(
|
|
23
|
+
---@example dotocr.loadFont("/fonts/default.json")
|
|
24
24
|
function _DotOCR.loadFont(fontPath) return nil end
|
|
25
25
|
|
|
26
26
|
--- 释放指定字库
|
|
27
27
|
---@param fontId string
|
|
28
|
-
---@example dotocr.free(fontId)
|
|
28
|
+
---@example dotocr.free("fontId")
|
|
29
29
|
function _DotOCR.free(fontId) end
|
|
30
30
|
|
|
31
31
|
--- 释放全部已加载的点阵字库
|
|
@@ -41,7 +41,7 @@ function _DotOCR.freeAll() end
|
|
|
41
41
|
---@param ey integer|nil
|
|
42
42
|
---@param confidenceThreshold number|nil 相似度下限;`<=0` 时按 `0.95`;`>0.95` 时要求像素完全一致
|
|
43
43
|
---@return OCRChar[]
|
|
44
|
-
---@example dotocr.recognizeAbs(fontId,
|
|
44
|
+
---@example dotocr.recognizeAbs("fontId", "screen", 100, 100, 200, 200, 0.95)
|
|
45
45
|
function _DotOCR.recognizeAbs(fontId, input, x, y, ex, ey, confidenceThreshold)
|
|
46
46
|
---@type OCRChar[]
|
|
47
47
|
local ret = {}
|
|
@@ -59,7 +59,7 @@ end
|
|
|
59
59
|
---@param confidenceThreshold number|nil
|
|
60
60
|
---@param exactMatch boolean|nil
|
|
61
61
|
---@return OCRChar[]
|
|
62
|
-
---@example dotocr.findTextAbs(fontId,
|
|
62
|
+
---@example dotocr.findTextAbs("fontId", "screen", {"开始"}, 100, 100, 200, 200, 0.95, false)
|
|
63
63
|
function _DotOCR.findTextAbs(fontId, input, targetTexts, x, y, ex, ey, confidenceThreshold, exactMatch)
|
|
64
64
|
---@type OCRChar[]
|
|
65
65
|
local ret = {}
|
package/types/lua/file.lua
CHANGED
|
@@ -63,7 +63,7 @@ function _File.getResFile(name) return nil end
|
|
|
63
63
|
|
|
64
64
|
--- 清理由 getResFile 得到的本地临时文件
|
|
65
65
|
---@param path string getResFile 返回的文件路径
|
|
66
|
-
---@example file.cleanupResFile(path)
|
|
66
|
+
---@example file.cleanupResFile("/path/to/file.png")
|
|
67
67
|
function _File.cleanupResFile(path) end
|
|
68
68
|
|
|
69
69
|
--- 删除指定行或包含内容的行
|
package/types/lua/global.lua
CHANGED
|
@@ -83,18 +83,20 @@ function Time() return 0 end
|
|
|
83
83
|
--- 将表转为 JSON 字符串
|
|
84
84
|
---@param data table<string, any>|any[]
|
|
85
85
|
---@return string
|
|
86
|
-
---@example ToJsonString(
|
|
86
|
+
---@example ToJsonString("hello")
|
|
87
87
|
function ToJsonString(data) return '' end
|
|
88
88
|
|
|
89
89
|
--- 启动协作协程,返回协程名
|
|
90
90
|
---@param func function
|
|
91
91
|
---@return string
|
|
92
|
-
---@example StartThread(
|
|
92
|
+
---@example StartThread(function()
|
|
93
|
+
--- logi("thread")
|
|
94
|
+
--- end)
|
|
93
95
|
function StartThread(func) return '' end
|
|
94
96
|
|
|
95
97
|
--- 请求停止指定协作协程
|
|
96
98
|
---@param threadName string
|
|
97
|
-
---@example StopThread(
|
|
99
|
+
---@example StopThread("Safari")
|
|
98
100
|
function StopThread(threadName) end
|
|
99
101
|
|
|
100
102
|
--- 当前协程是否应退出
|
package/types/lua/hid.lua
CHANGED
|
@@ -44,26 +44,26 @@ local _HID = {}
|
|
|
44
44
|
|
|
45
45
|
--- 设置抖动值
|
|
46
46
|
---@param value integer 抖动值
|
|
47
|
-
---@example hid.setJitterValue(
|
|
47
|
+
---@example hid.setJitterValue(5)
|
|
48
48
|
function _HID.setJitterValue(value) end
|
|
49
49
|
|
|
50
50
|
--- 设置连续点击/滑动之间的等待毫秒。不调用时用固件默认(相对 200ms / 绝对 100ms)。
|
|
51
51
|
---@param milliseconds integer 0 关闭等待,大于 0 覆盖为指定毫秒,-1 恢复默认
|
|
52
52
|
---@return boolean 操作是否成功
|
|
53
|
-
---@example hid.setActionDelay(
|
|
53
|
+
---@example hid.setActionDelay(100)
|
|
54
54
|
function _HID.setActionDelay(milliseconds) return true end
|
|
55
55
|
|
|
56
56
|
--- 设置移动完成后的等待毫秒。不调用时固件默认 40ms。
|
|
57
57
|
---@param milliseconds integer 0 关闭等待,大于 0 覆盖为指定毫秒,小于 0 恢复默认
|
|
58
58
|
---@return boolean 操作是否成功
|
|
59
|
-
---@example hid.setMoveDelay(
|
|
59
|
+
---@example hid.setMoveDelay(100)
|
|
60
60
|
function _HID.setMoveDelay(milliseconds) return true end
|
|
61
61
|
|
|
62
62
|
--- 移动
|
|
63
63
|
---@param x integer 移动坐标的X轴
|
|
64
64
|
---@param y integer 移动坐标的Y轴
|
|
65
65
|
---@return boolean 操作是否成功
|
|
66
|
-
---@example hid.move(
|
|
66
|
+
---@example hid.move(100, 100)
|
|
67
67
|
function _HID.move(x, y) return true end
|
|
68
68
|
|
|
69
69
|
--- 按下鼠标左键(不自动抬起)
|
|
@@ -82,7 +82,7 @@ function _HID.mouseUp() return true end
|
|
|
82
82
|
---@param duration integer|nil 点击持续时间(可选,默认值为20毫秒)
|
|
83
83
|
---@param jitter boolean|nil 是否添加随机抖动(可选,默认值为false)
|
|
84
84
|
---@return boolean 操作是否成功
|
|
85
|
-
---@example hid.click(
|
|
85
|
+
---@example hid.click(100, 100, 20, false)
|
|
86
86
|
function _HID.click(x, y, duration, jitter) return true end
|
|
87
87
|
|
|
88
88
|
--- 复位坐标到左下角(仅相对鼠标模式需要)
|
|
@@ -118,7 +118,7 @@ function _HID.getBLEHIDDeviceName() return '' end
|
|
|
118
118
|
--- 设置蓝牙 HID 设备名称
|
|
119
119
|
---@param name string 蓝牙 HID 设备名称
|
|
120
120
|
---@return boolean 是否设置成功
|
|
121
|
-
---@example hid.setBLEHIDDeviceName(
|
|
121
|
+
---@example hid.setBLEHIDDeviceName("Safari")
|
|
122
122
|
function _HID.setBLEHIDDeviceName(name) return true end
|
|
123
123
|
|
|
124
124
|
--- 获取 HID 设备 MAC 字符串
|
|
@@ -144,7 +144,7 @@ function _HID.restartDevice() return true end
|
|
|
144
144
|
--- 开关充电。当前连接的 HID 不支持时返回 false。
|
|
145
145
|
---@param on boolean true 打开充电,false 关闭充电
|
|
146
146
|
---@return boolean 是否成功发送
|
|
147
|
-
---@example hid.setCharging(
|
|
147
|
+
---@example hid.setCharging(true)
|
|
148
148
|
function _HID.setCharging(on) return true end
|
|
149
149
|
|
|
150
150
|
--- 随机点击
|
|
@@ -154,7 +154,7 @@ function _HID.setCharging(on) return true end
|
|
|
154
154
|
---@param y2 integer 区域右下角y坐标
|
|
155
155
|
---@param duration integer|nil 持续时间 默认20ms
|
|
156
156
|
---@return boolean 随机点击是否成功
|
|
157
|
-
---@example
|
|
157
|
+
---@example hid.clickRandom(100, 100, 200, 200, 20)
|
|
158
158
|
function _HID.clickRandom(x1, y1, x2, y2, duration) return true end
|
|
159
159
|
|
|
160
160
|
--- 双击
|
|
@@ -164,7 +164,7 @@ function _HID.clickRandom(x1, y1, x2, y2, duration) return true end
|
|
|
164
164
|
---@param interval integer|nil 双击间隔时间 默认20ms
|
|
165
165
|
---@param jitter boolean|nil 抖动 开启抖动,会在像素范围随机偏移 点击 默认false
|
|
166
166
|
---@return boolean 双击是否成功
|
|
167
|
-
---@example
|
|
167
|
+
---@example hid.doubleClick(100, 100, 20, 20, true)
|
|
168
168
|
function _HID.doubleClick(x, y, duration, interval, jitter) return true end
|
|
169
169
|
|
|
170
170
|
--- 随机双击
|
|
@@ -175,7 +175,7 @@ function _HID.doubleClick(x, y, duration, interval, jitter) return true end
|
|
|
175
175
|
---@param duration integer|nil 持续时间 默认20ms
|
|
176
176
|
---@param interval integer|nil 双击间隔时间 默认20ms
|
|
177
177
|
---@return boolean 随机双击是否成功
|
|
178
|
-
---@example
|
|
178
|
+
---@example hid.doubleClickRandom(100, 100, 200, 200, 20, 20)
|
|
179
179
|
function _HID.doubleClickRandom(x1, y1, x2, y2, duration, interval) return true end
|
|
180
180
|
|
|
181
181
|
--- 滑动
|
|
@@ -186,7 +186,7 @@ function _HID.doubleClickRandom(x1, y1, x2, y2, duration, interval) return true
|
|
|
186
186
|
---@param jitter boolean|nil 是否添加随机抖动(可选,默认值为false)
|
|
187
187
|
---@param steps integer|nil 滑动步骤数(可选,默认值为6)
|
|
188
188
|
---@return boolean 操作是否成功
|
|
189
|
-
---@example hid.swipe(
|
|
189
|
+
---@example hid.swipe(100, 100, 200, 200, false, 6)
|
|
190
190
|
function _HID.swipe(startX, startY, endX, endY, jitter, steps) return true end
|
|
191
191
|
|
|
192
192
|
--- 曲线滑动(3点)
|
|
@@ -197,7 +197,7 @@ function _HID.swipe(startX, startY, endX, endY, jitter, steps) return true end
|
|
|
197
197
|
---@param endX integer 目标x坐标
|
|
198
198
|
---@param endY integer 目标y坐标
|
|
199
199
|
---@return boolean 操作是否成功
|
|
200
|
-
---@example hid.swipeCurve(
|
|
200
|
+
---@example hid.swipeCurve(100, 100, 200, 150, 200, 200)
|
|
201
201
|
function _HID.swipeCurve(startX, startY, midX, midY, endX, endY) return true end
|
|
202
202
|
|
|
203
203
|
--- 长按并滑动
|
|
@@ -209,7 +209,7 @@ function _HID.swipeCurve(startX, startY, midX, midY, endX, endY) return true end
|
|
|
209
209
|
---@param jitter boolean|nil 是否添加随机抖动(可选,默认值为false)
|
|
210
210
|
---@param steps integer|nil 滑动步骤数(可选,默认值为6)
|
|
211
211
|
---@return boolean 操作是否成功
|
|
212
|
-
---@example hid.pressAndSwipe(
|
|
212
|
+
---@example hid.pressAndSwipe(100, 100, 200, 200, 20, false, 6)
|
|
213
213
|
function _HID.pressAndSwipe(startX, startY, endX, endY, duration, jitter, steps)
|
|
214
214
|
return true
|
|
215
215
|
end
|
|
@@ -217,19 +217,19 @@ end
|
|
|
217
217
|
--- 打开URL
|
|
218
218
|
---@param url string URL字符串
|
|
219
219
|
---@return boolean 操作是否成功
|
|
220
|
-
---@example hid.openURL(
|
|
220
|
+
---@example hid.openURL("https://example.com")
|
|
221
221
|
function _HID.openURL(url) return true end
|
|
222
222
|
|
|
223
223
|
--- 打开App
|
|
224
224
|
---@param bundle string 应用名称 支持 app name 或 bundleId
|
|
225
225
|
---@return boolean 操作是否成功
|
|
226
|
-
---@example hid.openApp(
|
|
226
|
+
---@example hid.openApp("Safari")
|
|
227
227
|
function _HID.openApp(bundle) return true end
|
|
228
228
|
|
|
229
229
|
--- 关闭App(不会关闭当前快点 JS)
|
|
230
230
|
---@param name string 应用名称 支持 app name 或 bundleId
|
|
231
231
|
---@return boolean 操作是否成功
|
|
232
|
-
---@example hid.closeApp(
|
|
232
|
+
---@example hid.closeApp("Safari")
|
|
233
233
|
function _HID.closeApp(name) return true end
|
|
234
234
|
|
|
235
235
|
--- 获取剪贴板
|
|
@@ -240,7 +240,7 @@ function _HID.getClipboard() return '' end
|
|
|
240
240
|
--- 设置剪贴板
|
|
241
241
|
---@param s string 要设置的文本
|
|
242
242
|
---@return boolean 设置结果
|
|
243
|
-
---@example hid.setClipboard(
|
|
243
|
+
---@example hid.setClipboard("hello")
|
|
244
244
|
function _HID.setClipboard(s) return true end
|
|
245
245
|
|
|
246
246
|
--- 回到主页
|
|
@@ -251,19 +251,19 @@ function _HID.homeScreen() return true end
|
|
|
251
251
|
--- 按下系统按钮
|
|
252
252
|
---@param name string 按钮 home 按下Home键 volumeup 按下音量上键 volumedown 按下音量下键 mute 按下静音键 playpause 按下播放/暂停键 next 按下下一首键 prev 按下上一首键 eject 显示隐藏键盘 globe 按下globe键 search 按下搜索键 brightnessup 调高屏幕亮度 brightnessdown 调低屏幕亮度 power 电源/锁屏键 snapshot 系统截图键
|
|
253
253
|
---@return boolean 按下按钮是否成功
|
|
254
|
-
---@example
|
|
254
|
+
---@example hid.pressButton("home")
|
|
255
255
|
function _HID.pressButton(name) return true end
|
|
256
256
|
|
|
257
257
|
--- 输入文本(优先输入法,否则剪贴板粘贴,可输中文)
|
|
258
258
|
---@param text string 要输入的文本
|
|
259
259
|
---@return boolean 操作是否成功
|
|
260
|
-
---@example hid.input(
|
|
260
|
+
---@example hid.input("hello")
|
|
261
261
|
function _HID.input(text) return true end
|
|
262
262
|
|
|
263
263
|
--- 简单键盘输入(英文)
|
|
264
264
|
---@param data string 要输入的基础文本(建议 ASCII)
|
|
265
265
|
---@return boolean 操作是否成功
|
|
266
|
-
---@example hid.inputSimple(
|
|
266
|
+
---@example hid.inputSimple("hello")
|
|
267
267
|
function _HID.inputSimple(data) return true end
|
|
268
268
|
|
|
269
269
|
--- 空格键
|
|
@@ -274,7 +274,7 @@ function _HID.space() return true end
|
|
|
274
274
|
--- 退格键
|
|
275
275
|
---@param count integer|nil 删除次数(可选,默认值为1)
|
|
276
276
|
---@return boolean 操作是否成功
|
|
277
|
-
---@example hid.backspace(
|
|
277
|
+
---@example hid.backspace(1)
|
|
278
278
|
function _HID.backspace(count) return true end
|
|
279
279
|
|
|
280
280
|
--- 回车键
|
|
@@ -285,7 +285,7 @@ function _HID.enter() return true end
|
|
|
285
285
|
--- 发送组合按键(支持字符串和数值)
|
|
286
286
|
---@param keys SendHIDKey[] 要发送的按键
|
|
287
287
|
---@return boolean 操作是否成功
|
|
288
|
-
---@example hid.sendKey(
|
|
288
|
+
---@example hid.sendKey({"COMMAND", "c"})
|
|
289
289
|
function _HID.sendKey(keys) return true end
|
|
290
290
|
|
|
291
291
|
--- 复制
|
package/types/lua/http.lua
CHANGED
|
@@ -106,69 +106,84 @@ end
|
|
|
106
106
|
--- 连接
|
|
107
107
|
---@example ws.connect()
|
|
108
108
|
function _WebSocket.connect() end
|
|
109
|
+
|
|
109
110
|
--- 关闭
|
|
110
111
|
---@example ws.close()
|
|
111
112
|
function _WebSocket.close() end
|
|
113
|
+
|
|
112
114
|
--- 重置
|
|
113
115
|
---@return boolean
|
|
114
116
|
---@example ws.reset()
|
|
115
117
|
function _WebSocket.reset() return true end
|
|
118
|
+
|
|
116
119
|
--- 是否已关闭
|
|
117
120
|
---@return boolean
|
|
118
121
|
---@example ws.isClosed()
|
|
119
122
|
function _WebSocket.isClosed() return true end
|
|
123
|
+
|
|
120
124
|
--- 是否已连接
|
|
121
125
|
---@return boolean
|
|
122
126
|
---@example ws.isConnected()
|
|
123
127
|
function _WebSocket.isConnected() return false end
|
|
128
|
+
|
|
124
129
|
--- 发送文本
|
|
125
130
|
---@param data string
|
|
126
|
-
---@example ws.sendText(
|
|
131
|
+
---@example ws.sendText("hello")
|
|
127
132
|
function _WebSocket.sendText(data) end
|
|
133
|
+
|
|
128
134
|
--- 发送二进制(base64 字符串)
|
|
129
135
|
---@param data string
|
|
130
|
-
---@example ws.sendBinary(
|
|
136
|
+
---@example ws.sendBinary("hello")
|
|
131
137
|
function _WebSocket.sendBinary(data) end
|
|
138
|
+
|
|
132
139
|
--- 设置连接超时
|
|
133
140
|
---@param timeout number
|
|
134
|
-
---@example ws.setConnectionTimeout(
|
|
141
|
+
---@example ws.setConnectionTimeout(10)
|
|
135
142
|
function _WebSocket.setConnectionTimeout(timeout) end
|
|
143
|
+
|
|
136
144
|
--- 设置写入超时
|
|
137
145
|
---@param timeout number
|
|
138
|
-
---@example ws.setWriteTimeout(
|
|
146
|
+
---@example ws.setWriteTimeout(10)
|
|
139
147
|
function _WebSocket.setWriteTimeout(timeout) end
|
|
148
|
+
|
|
140
149
|
--- 启动心跳(可选回调返回心跳文本)
|
|
141
150
|
---@param interval number
|
|
142
151
|
---@param fn fun() :string|nil
|
|
143
|
-
---@example ws.startHeartbeatInterval(
|
|
152
|
+
---@example ws.startHeartbeatInterval(30, function() return "ping" end)
|
|
144
153
|
function _WebSocket.startHeartbeatInterval(interval, fn) end
|
|
154
|
+
|
|
145
155
|
--- 停止心跳
|
|
146
156
|
---@example ws.stopHeartbeatInterval()
|
|
147
157
|
function _WebSocket.stopHeartbeatInterval() end
|
|
158
|
+
|
|
148
159
|
--- 自动重连
|
|
149
160
|
---@param autoReconnect boolean
|
|
150
|
-
---@example ws.setAutoReconnect(
|
|
161
|
+
---@example ws.setAutoReconnect(true)
|
|
151
162
|
function _WebSocket.setAutoReconnect(autoReconnect) end
|
|
152
163
|
|
|
153
164
|
--- 监听打开
|
|
154
165
|
---@param fn fun()
|
|
155
|
-
---@example ws.onOpen(
|
|
166
|
+
---@example ws.onOpen(function() end)
|
|
156
167
|
function _WebSocket.onOpen(fn) end
|
|
168
|
+
|
|
157
169
|
--- 监听关闭
|
|
158
170
|
---@param fn fun()
|
|
159
|
-
---@example ws.onClose(
|
|
171
|
+
---@example ws.onClose(function() end)
|
|
160
172
|
function _WebSocket.onClose(fn) end
|
|
173
|
+
|
|
161
174
|
--- 监听文本
|
|
162
175
|
---@param fn fun(text:string)
|
|
163
|
-
---@example ws.onText(
|
|
176
|
+
---@example ws.onText(function(text) logi(text) end)
|
|
164
177
|
function _WebSocket.onText(fn) end
|
|
178
|
+
|
|
165
179
|
--- 监听二进制(base64 字符串)
|
|
166
180
|
---@param fn fun(data:string)
|
|
167
|
-
---@example ws.onBinary(
|
|
181
|
+
---@example ws.onBinary(function(data) end)
|
|
168
182
|
function _WebSocket.onBinary(fn) end
|
|
183
|
+
|
|
169
184
|
--- 监听错误
|
|
170
185
|
---@param fn fun(error:string)
|
|
171
|
-
---@example ws.onError(
|
|
186
|
+
---@example ws.onError(function(err) loge(err) end)
|
|
172
187
|
function _WebSocket.onError(fn) end
|
|
173
188
|
|
|
174
189
|
---@type Http
|
package/types/lua/image.lua
CHANGED
|
@@ -72,7 +72,7 @@ function _Image.clip(id, x, y, ex, ey) return '' end
|
|
|
72
72
|
--- 获取尺寸
|
|
73
73
|
---@param id string 图片id
|
|
74
74
|
---@return Size 图片大小 {width: number, height: number}
|
|
75
|
-
---@example local size = image.getSize(
|
|
75
|
+
---@example local size = image.getSize("screen")
|
|
76
76
|
--- if size then
|
|
77
77
|
--- logi(size.width, size.height)
|
|
78
78
|
--- end
|
|
@@ -133,14 +133,14 @@ function _Image.isRelease(id) return false end
|
|
|
133
133
|
|
|
134
134
|
--- 释放图片
|
|
135
135
|
---@param id string 图片id
|
|
136
|
-
---@example image.release(
|
|
136
|
+
---@example image.release("screen")
|
|
137
137
|
function _Image.release(id) end
|
|
138
138
|
|
|
139
139
|
--- 保存图片到路径
|
|
140
140
|
---@param id string 图片id 路径 http地址或者 screen 实时截屏
|
|
141
141
|
---@param path string 保存路径
|
|
142
142
|
---@return boolean 成功
|
|
143
|
-
---@example image.saveTo(
|
|
143
|
+
---@example image.saveTo("screen", "screen.jpg")
|
|
144
144
|
function _Image.saveTo(id, path) return true end
|
|
145
145
|
|
|
146
146
|
--- 查找颜色
|
|
@@ -198,7 +198,9 @@ function _Image.cmpColor(id, points, threshold) return true end
|
|
|
198
198
|
--- logi("找到图片")
|
|
199
199
|
--- end
|
|
200
200
|
function _Image.findImage(id, templateImageId, x, y, ex, ey, threshold, limit,
|
|
201
|
-
method, rgb, options)
|
|
201
|
+
method, rgb, options)
|
|
202
|
+
return {}
|
|
203
|
+
end
|
|
202
204
|
|
|
203
205
|
--- 按 kjst 模板找图
|
|
204
206
|
---@param id string 图片id,通常为 `"screen"`
|
|
@@ -231,7 +233,9 @@ function _Image.findImageEx(id, kjstPath) return {} end
|
|
|
231
233
|
--- end
|
|
232
234
|
--- image.release(imageId)
|
|
233
235
|
function _Image.findMultiColor(id, firstColor, threshold, points, x, y, ex, ey,
|
|
234
|
-
limit, orz)
|
|
236
|
+
limit, orz)
|
|
237
|
+
return {}
|
|
238
|
+
end
|
|
235
239
|
|
|
236
240
|
--- 统计颜色数量
|
|
237
241
|
---@param id string 图片id
|
package/types/lua/node.lua
CHANGED
|
@@ -77,7 +77,7 @@ local _Node = {}
|
|
|
77
77
|
--- 创建选择器。可用 `local selector <close> = ...` 自动释放,或用完后 `selector:releaseNode()` 手动释放。
|
|
78
78
|
---@param params SelectorParams|nil
|
|
79
79
|
---@return NodeSelector 选择器
|
|
80
|
-
---@example node.createNodeSelector(
|
|
80
|
+
---@example node.createNodeSelector({ maxDepth = 50, mode = 1 })
|
|
81
81
|
function _Node.createNodeSelector(params)
|
|
82
82
|
---@type NodeSelector
|
|
83
83
|
local ret
|
package/types/lua/pip.lua
CHANGED
|
@@ -32,37 +32,37 @@ function _Pip.closeWindow() return true end
|
|
|
32
32
|
---@param width number 宽度方向比例值(与 height 共同决定宽高比,不是像素)
|
|
33
33
|
---@param height number 高度方向比例值(与 width 共同决定宽高比,不是像素)
|
|
34
34
|
---@return boolean true代表尺寸已提交,false代表当前模式不允许设置或宽高无效
|
|
35
|
-
---@example pip.setContentSize(
|
|
35
|
+
---@example pip.setContentSize(200, 120)
|
|
36
36
|
function _Pip.setContentSize(width, height) return true end
|
|
37
37
|
|
|
38
38
|
--- 设置日志字号;缺省 8
|
|
39
39
|
---@param fontSize number|nil 日志字号,必须是有效数字
|
|
40
40
|
---@return boolean true代表日志文字大小已提交,false代表字号无效
|
|
41
|
-
---@example pip.setLogFontSize(
|
|
41
|
+
---@example pip.setLogFontSize(14)
|
|
42
42
|
function _Pip.setLogFontSize(fontSize) return true end
|
|
43
43
|
|
|
44
44
|
--- 设置自定义文本(不自动切模式)
|
|
45
45
|
---@param text string 要显示的文本,支持换行
|
|
46
46
|
---@return boolean true代表文本已提交
|
|
47
|
-
---@example pip.setCustomText(
|
|
47
|
+
---@example pip.setCustomText("hello")
|
|
48
48
|
function _Pip.setCustomText(text) return true end
|
|
49
49
|
|
|
50
50
|
--- 设置自定义文字颜色,支持 RRGGBB / RRGGBBAA
|
|
51
51
|
---@param color string 文字颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
|
|
52
52
|
---@return boolean true代表文字颜色已提交
|
|
53
|
-
---@example pip.setCustomTextColor(
|
|
53
|
+
---@example pip.setCustomTextColor("#FFFFFF")
|
|
54
54
|
function _Pip.setCustomTextColor(color) return true end
|
|
55
55
|
|
|
56
56
|
--- 设置自定义文字大小;缺省 12
|
|
57
57
|
---@param fontSize number|nil 文字字号,必须是有效数字
|
|
58
58
|
---@return boolean true代表文字大小已提交,false代表字号无效
|
|
59
|
-
---@example pip.setCustomTextSize(
|
|
59
|
+
---@example pip.setCustomTextSize(14)
|
|
60
60
|
function _Pip.setCustomTextSize(fontSize) return true end
|
|
61
61
|
|
|
62
62
|
--- 设置自定义背景色
|
|
63
63
|
---@param color string 背景颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
|
|
64
64
|
---@return boolean true代表背景色已提交
|
|
65
|
-
---@example pip.setCustomBackgroundColor(
|
|
65
|
+
---@example pip.setCustomBackgroundColor("#FFFFFF")
|
|
66
66
|
function _Pip.setCustomBackgroundColor(color) return true end
|
|
67
67
|
|
|
68
68
|
---@type Pip
|
package/types/lua/yolo.lua
CHANGED
package/types/lua/yolocls.lua
CHANGED