Skip to content

feat(fe+harmony): add canvas feature toDataURL, getImageData, canvassToTempFilePath#252

Merged
dos1in merged 6 commits into
didi:mainfrom
EchoTechFE:feat-canvas
Jun 26, 2026
Merged

feat(fe+harmony): add canvas feature toDataURL, getImageData, canvassToTempFilePath#252
dos1in merged 6 commits into
didi:mainfrom
EchoTechFE:feat-canvas

Conversation

@Hierifer

Copy link
Copy Markdown
Contributor

No description provided.

@Hierifer

Copy link
Copy Markdown
Contributor Author

临时支持 toDataURL, toBlob, getImageData, canvasToTempFile 的异步调用。这里当前和 wx 有点不一样。正在开发一个基于 skia + 同层渲染的框架,让 canvas 渲染再 service (jscore)这边执行。这样就 context 就能像 wx 一样同步调用

@Hierifer Hierifer changed the title feat(fe+harmony): add canvas feature toDataURL, toBlob, getImageData, feat(fe+harmony): add canvas feature toDataURL, toBlob, getImageData Jun 22, 2026
@Hierifer

Copy link
Copy Markdown
Contributor Author

cpp 修复 int value = JS_VALUE_GET_INT(jsValue) 的语法问题,cpp 上游依赖包没有锁版本导致语法有所改变

Comment thread fe/packages/service/src/api/core/ui/canvas/canvas-node.js
Comment thread fe/packages/render/src/core/runtime.js Outdated
}
}

canvasGetImageData({ bridgeId, params }) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个新增的 canvasGetImageData render handler 目前不可达。
service 侧没有对应 wrapper,缺失 API 会从 api/index.js (line 48) 走默认 invokeAPI,而默认 target 是 container (line 162),不会调用到 render 层。

如果这次要支持 wx.canvasGetImageData,需要在 core/ui/canvas/index.js 增加 target 为 render 的 API;如果只支持 canvas node API,这段 render handler 建议移除,避免误以为旧 API 已支持。

@Hierifer Hierifer Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

让 AI 切换了一次方案,代码漏删了。 render 侧的代码已经删除。全部由 service 侧发起, render 实现, service 处理 callback

@Hierifer Hierifer changed the title feat(fe+harmony): add canvas feature toDataURL, toBlob, getImageData feat(fe+harmony): add canvas feature toDataURL, getImageData, canvassToTempFilePath Jun 22, 2026
width,
height,
callback: callbackId,
errorCallback: errorCallbackId,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errorCallbackId 变量这个是不是未定义

@dos1in

dos1in commented Jun 26, 2026

Copy link
Copy Markdown
Member

lint错误需要处理下

Rename 'const self = this' to 'const that = this' and parameter
'self' to 'ctx' to satisfy no-restricted-globals lint rule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hierifer

Copy link
Copy Markdown
Contributor Author

@dos1in 我让 cc 修复了 self 的问题,不过看上去不是这次 diff 的问题。而且这种 replace 没有必要。麻烦看一下 lint 这里

@dos1in

dos1in commented Jun 26, 2026

Copy link
Copy Markdown
Member

@dos1in 我让 cc 修复了 self 的问题,不过看上去不是这次 diff 的问题。而且这种 replace 没有必要。麻烦看一下 lint 这里

可能是新的检测规则,其他没问题,合并了。

@dos1in dos1in merged commit 9f68d82 into didi:main Jun 26, 2026
2 checks passed
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.

2 participants