Skip to content

图像与截图:资源回收、重载参数与找图选项修复 - #235

Open
xcl199f wants to merge 3 commits into
aiselp:setup-v7from
xcl199f:pr/image-recycle
Open

xcl199f wants to merge 3 commits into
aiselp:setup-v7from
xcl199f:pr/image-recycle

Conversation

@xcl199f

@xcl199f xcl199f commented Nov 14, 2026

Copy link
Copy Markdown
  • images.requestScreenCaptureLegacy() 支持 0 / 1 / 2 个参数:无参时自动方向 + 15 秒超时,单参数可传横竖屏或超时时间,双参数为方向 + 超时;修复无参调用时的参数匹配失败。
  • 修复边缘匹配时 ROI 过窄导致的崩溃
  • 找图相关 API 新增 useGrayscale(灰度匹配)与 matchMethod(匹配方法)选项;
  • 新增 images.getBrightness(img, sampleCount?, region?) 获取图像亮度。
  • 图像对象加入追踪与批量回收机制,脚本结束后可统一释放仍存活的 Bitmap;
  • 修复屏幕方向变化后复用旧尺寸截图的问题

修复

  • 截图服务绑定增加超时,绑定失败不再被当作成功,避免脚本无限等待与连接泄漏。

基于 upstream/setup-v7 (4c396b2) 重建,内容取自已合并上游的 setup-v7
(8f18853e) 中的 6 个图像相关文件,一次性包含:

- 脚本结束时回收全部图像资源(原 PR 主题)
- ImageWrapper 追踪上限不再误回收刚创建的 Bitmap
- requestScreenCaptureLegacy 统一为单一同步语义、15s 默认超时,
  并支持 0/1/2 参重载(修复 Rhino 传入 Undefined 时的重载歧义)
- getBrightness 改用 Double 累加、修正区域边界与采样数收敛
- ScreenCaptureManager 绑定加超时、失败不伪装成功、连接不泄漏
- TemplateMatching 拒绝 useGrayscale 与 transparentMask 同时使用
- images/index.ts 的 matchMethod 保留合法的 0 (TM_SQDIFF)

JS 产物(dist/assets)由构建任务生成,未纳入提交。
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 72 complexity · 2 duplication

Metric Results
Complexity 72
Duplication 2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant