Skip to content

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

Open
Hierifer wants to merge 3 commits into
didi:mainfrom
EchoTechFE:feat-canvas
Open

feat(fe+harmony): add canvas feature toDataURL, getImageData, canvassToTempFilePath#252
Hierifer wants to merge 3 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 变量这个是不是未定义

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