Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
71fef51b
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
71fef51b
编写于
1月 05, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
!13159 canvas 文档整改,修改颜色表示方法-monthly20221018
Merge pull request !13159 from lanyi/cherry-pick-1672738935
上级
d2d43c49
90d7b706
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
32 addition
and
32 deletion
+32
-32
zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md
...reference/arkui-js/js-components-canvas-canvasgradient.md
+3
-3
zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
...arkui-js/js-components-canvas-canvasrenderingcontext2d.md
+6
-6
zh-cn/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
...eference/arkui-js/js-offscreencanvasrenderingcontext2d.md
+2
-2
zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
...ion-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
+9
-9
zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
...reference/arkui-ts/ts-components-canvas-canvasgradient.md
+3
-3
zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
...eference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
+9
-9
未找到文件。
zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md
浏览文件 @
71fef51b
...
...
@@ -35,9 +35,9 @@ export default {
const
el
=
this
.
$refs
.
canvas
;
const
ctx
=
el
.
getContext
(
'
2d
'
);
const
gradient
=
ctx
.
createLinearGradient
(
50
,
0
,
300
,
100
);
gradient
.
addColorStop
(
0.0
,
'
red
'
)
gradient
.
addColorStop
(
0.5
,
'
white
'
)
gradient
.
addColorStop
(
1.0
,
'
green
'
)
gradient
.
addColorStop
(
0.0
,
'
#ff0000
'
)
gradient
.
addColorStop
(
0.5
,
'
#ffffff
'
)
gradient
.
addColorStop
(
1.0
,
'
#00ff00
'
)
ctx
.
fillStyle
=
gradient
ctx
.
fillRect
(
0
,
0
,
300
,
300
)
}
...
...
zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
浏览文件 @
71fef51b
...
...
@@ -1681,9 +1681,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): Object
// Linear gradient: start(50,0) end(300,100)
var
gradient
=
ctx
.
createLinearGradient
(
50
,
0
,
300
,
100
);
// Add three color stops
gradient
.
addColorStop
(
0.0
,
'
red
'
);
gradient
.
addColorStop
(
0.5
,
'
white
'
);
gradient
.
addColorStop
(
1.0
,
'
green
'
);
gradient
.
addColorStop
(
0.0
,
'
#ff0000
'
);
gradient
.
addColorStop
(
0.5
,
'
#ffffff
'
);
gradient
.
addColorStop
(
1.0
,
'
#00ff00
'
);
// Set the fill style and draw a rectangle
ctx
.
fillStyle
=
gradient
;
ctx
.
fillRect
(
0
,
0
,
500
,
500
);
...
...
@@ -1734,9 +1734,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
// Radial gradient: inner circle(200,200,r:50) outer circle(200,200,r:200)
var
gradient
=
ctx
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
);
// Add three color stops
gradient
.
addColorStop
(
0.0
,
'
red
'
);
gradient
.
addColorStop
(
0.5
,
'
white
'
);
gradient
.
addColorStop
(
1.0
,
'
green
'
);
gradient
.
addColorStop
(
0.0
,
'
#ff0000
'
);
gradient
.
addColorStop
(
0.5
,
'
#ffffff
'
);
gradient
.
addColorStop
(
1.0
,
'
#00ff00
'
);
// Set the fill style and draw a rectangle
ctx
.
fillStyle
=
gradient
;
ctx
.
fillRect
(
0
,
0
,
500
,
500
);
...
...
zh-cn/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
浏览文件 @
71fef51b
...
...
@@ -198,13 +198,13 @@ export default {
var
offscreenCanvasCtx
=
offscreen
.
getContext
(
"
2d
"
);
offscreenCanvasCtx
.
transform
(
1
,
0
,
1.7
,
1
,
0
,
0
);
offscreenCanvasCtx
.
fillStyle
=
'
gray
'
;
offscreenCanvasCtx
.
fillStyle
=
'
#a9a9a9
'
;
offscreenCanvasCtx
.
fillRect
(
40
,
40
,
50
,
20
);
offscreenCanvasCtx
.
fillRect
(
40
,
90
,
50
,
20
);
// Non-skewed rectangles
offscreenCanvasCtx
.
resetTransform
();
offscreenCanvasCtx
.
fillStyle
=
'
red
'
;
offscreenCanvasCtx
.
fillStyle
=
'
#ff0000
'
;
offscreenCanvasCtx
.
fillRect
(
40
,
40
,
50
,
20
);
offscreenCanvasCtx
.
fillRect
(
40
,
90
,
50
,
20
);
...
...
zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
浏览文件 @
71fef51b
...
...
@@ -1579,7 +1579,7 @@ struct Fill {
region
.
lineTo
(
270
,
90
)
region
.
closePath
()
// Fill path
this
.
context
.
fillStyle
=
'
green
'
this
.
context
.
fillStyle
=
'
#00ff00
'
this
.
context
.
fill
(
region
,
"
evenodd
"
)
})
}
...
...
@@ -2412,7 +2412,7 @@ restore(): void
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
context
.
save
()
// save the default state
this
.
context
.
fillStyle
=
"
green
"
this
.
context
.
fillStyle
=
"
#00ff00
"
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
...
...
@@ -2450,7 +2450,7 @@ save(): void
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
context
.
save
()
// save the default state
this
.
context
.
fillStyle
=
"
green
"
this
.
context
.
fillStyle
=
"
#00ff00
"
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
...
...
@@ -2497,9 +2497,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
...
...
@@ -2548,9 +2548,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
...
...
zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
浏览文件 @
71fef51b
...
...
@@ -41,9 +41,9 @@ struct Page45 {
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
...
...
zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
浏览文件 @
71fef51b
...
...
@@ -1673,7 +1673,7 @@ struct Fill {
region
.
lineTo
(
270
,
90
)
region
.
closePath
()
// Fill path
this
.
offContext
.
fillStyle
=
'
green
'
this
.
offContext
.
fillStyle
=
'
#00ff00
'
this
.
offContext
.
fill
(
region
,
"
evenodd
"
)
var
image
=
this
.
offContext
.
transferToImageBitmap
()
this
.
context
.
transferFromImageBitmap
(
image
)
...
...
@@ -2535,7 +2535,7 @@ struct CanvasExample {
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
offContext
.
save
()
// save the default state
this
.
offContext
.
fillStyle
=
"
green
"
this
.
offContext
.
fillStyle
=
"
#00ff00
"
this
.
offContext
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
offContext
.
restore
()
// restore to the default state
this
.
offContext
.
fillRect
(
150
,
75
,
100
,
100
)
...
...
@@ -2576,7 +2576,7 @@ struct CanvasExample {
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
offContext
.
save
()
// save the default state
this
.
offContext
.
fillStyle
=
"
green
"
this
.
offContext
.
fillStyle
=
"
#00ff00
"
this
.
offContext
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
offContext
.
restore
()
// restore to the default state
this
.
offContext
.
fillRect
(
150
,
75
,
100
,
100
)
...
...
@@ -2626,9 +2626,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
var
grad
=
this
.
offContext
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
var
image
=
this
.
offContext
.
transferToImageBitmap
()
...
...
@@ -2680,9 +2680,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
var
grad
=
this
.
offContext
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
var
image
=
this
.
offContext
.
transferToImageBitmap
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录