263 Star 422 Fork 2.9K

OpenHarmony / arkui_ace_engine

 / 详情

Improve documentation for OffscreenCanvasRenderingConxt2D

已完成
任务 成员
创建于  
2022-03-23 18:28

https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md

the documentation tries to motivate the use of OffscreenCanvasRenderingConxt2D as it reads at the top of this page:

Use OffscreenCanvasRenderingContext2D to draw rectangles, images, and text offscreen onto a canvas. Drawing offscreen onto a canvas is a process where content to draw onto the canvas is first drawn in the buffer, and then converted into a picture, and finally the picture is drawn on the canvas. This process increases the drawing efficiency.

The following examples are basically all like this

 Canvas(this.context)
    .onReady(() =>{
          this.offContext.lineWidth = 5
          this.offContext.strokeRect(25, 25, 85, 105)
          var image = this.offContext.transferToImageBitmap()
          this.context.transferFromImageBitmap(image)
    })

comparing to using on screen context

 Canvas(this.context)
    .onReady(() =>{
          this.context.lineWidth = 5
          this.context.strokeRect(25, 25, 85, 105)
    })

Why would the first be more efficient than the second? - It involves an additional image copy operation. It will be slower to execute!

You need to give a meaningful example that makes it clear why OffscreenCanvasRenderingContext2D is more efficient (if it actually is ;-)

Besides these examples for OffscreenCanvasRenderingContext2D being repetitive. Same as for regular Context.

评论 (1)

Guido Grassel 创建了任务
Yao.inhome 任务状态待办的 修改为进行中
Yao.inhome 负责人设置为Yao.inhome
展开全部操作日志

We have made a proposal how to fix the developer API of Canvas , 2D context and also offscreen context. Shared Huawei internally https://rnd-gitlab-eu-c.huawei.com/zidanehbs/ace-fin-web/ace-reports/-/blob/master/new_feature_ideation/canvas-view-redesign.md

Yao.inhome 添加协作者Yao.inhome
Yao.inhome 负责人Yao.inhome 修改为seaside
Yao.inhome 取消协作者Yao.inhome
seaside 添加协作者seaside
seaside 负责人seaside 修改为keerecles
seaside 取消协作者seaside
keerecles 任务状态进行中 修改为已完成

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(1)
1
https://gitee.com/openharmony/arkui_ace_engine.git
git@gitee.com:openharmony/arkui_ace_engine.git
openharmony
arkui_ace_engine
arkui_ace_engine

搜索帮助