Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
4c544145
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,发现更多精彩内容 >>
未验证
提交
4c544145
编写于
1月 05, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
!13165 canvas 文档整改,修改颜色表示方法-3.1release
Merge pull request !13165 from lanyi/locallanyi
上级
cf68ab51
201c15e9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
26 deletion
+26
-26
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
+6
-6
未找到文件。
zh-cn/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
浏览文件 @
4c544145
...
@@ -1652,9 +1652,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): Object
...
@@ -1652,9 +1652,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): Object
// Linear gradient: start(50,0) end(300,100)
// Linear gradient: start(50,0) end(300,100)
var gradient = ctx.createLinearGradient(50,0, 300,100);
var gradient = ctx.createLinearGradient(50,0, 300,100);
// Add three color stops
// Add three color stops
gradient.addColorStop(0.0, '
red
');
gradient.addColorStop(0.0, '
#ff0000
');
gradient.addColorStop(0.5, '
white
');
gradient.addColorStop(0.5, '
#ffffff
');
gradient.addColorStop(1.0, '
green
');
gradient.addColorStop(1.0, '
#00ff00
');
// Set the fill style and draw a rectangle
// Set the fill style and draw a rectangle
ctx.fillStyle = gradient;
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, 500, 500);
ctx.fillRect(0, 0, 500, 500);
...
@@ -1703,9 +1703,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
...
@@ -1703,9 +1703,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)
// Radial gradient: inner circle(200,200,r:50) outer circle(200,200,r:200)
var gradient = ctx.createRadialGradient(200,200,50, 200,200,200);
var gradient = ctx.createRadialGradient(200,200,50, 200,200,200);
// Add three color stops
// Add three color stops
gradient.addColorStop(0.0, '
red
');
gradient.addColorStop(0.0, '
#ff0000
');
gradient.addColorStop(0.5, '
white
');
gradient.addColorStop(0.5, '
#ffffff
');
gradient.addColorStop(1.0, '
green
');
gradient.addColorStop(1.0, '
#00ff00
');
// Set the fill style and draw a rectangle
// Set the fill style and draw a rectangle
ctx.fillStyle = gradient;
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, 500, 500);
ctx.fillRect(0, 0, 500, 500);
...
...
zh-cn/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
浏览文件 @
4c544145
...
@@ -204,13 +204,13 @@ resetTransform(): void
...
@@ -204,13 +204,13 @@ resetTransform(): void
var offscreenCanvasCtx = offscreen.getContext("2d");
var offscreenCanvasCtx = offscreen.getContext("2d");
offscreenCanvasCtx.transform(1, 0, 1.7, 1, 0, 0);
offscreenCanvasCtx.transform(1, 0, 1.7, 1, 0, 0);
offscreenCanvasCtx.fillStyle = '
gray
';
offscreenCanvasCtx.fillStyle = '
#a9a9a9
';
offscreenCanvasCtx.fillRect(40, 40, 50, 20);
offscreenCanvasCtx.fillRect(40, 40, 50, 20);
offscreenCanvasCtx.fillRect(40, 90, 50, 20);
offscreenCanvasCtx.fillRect(40, 90, 50, 20);
// Non-skewed rectangles
// Non-skewed rectangles
offscreenCanvasCtx.resetTransform();
offscreenCanvasCtx.resetTransform();
offscreenCanvasCtx.fillStyle = '
red
';
offscreenCanvasCtx.fillStyle = '
#ff0000
';
offscreenCanvasCtx.fillRect(40, 40, 50, 20);
offscreenCanvasCtx.fillRect(40, 40, 50, 20);
offscreenCanvasCtx.fillRect(40, 90, 50, 20);
offscreenCanvasCtx.fillRect(40, 90, 50, 20);
...
...
zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
浏览文件 @
4c544145
...
@@ -1576,7 +1576,7 @@ struct Fill {
...
@@ -1576,7 +1576,7 @@ struct Fill {
region
.
lineTo
(
270
,
90
)
region
.
lineTo
(
270
,
90
)
region
.
closePath
()
region
.
closePath
()
// Fill path
// Fill path
this
.
context
.
fillStyle
=
'
green
'
this
.
context
.
fillStyle
=
'
#00ff00
'
this
.
context
.
fill
(
region
,
"
evenodd
"
)
this
.
context
.
fill
(
region
,
"
evenodd
"
)
})
})
}
}
...
@@ -2410,7 +2410,7 @@ restore(): void
...
@@ -2410,7 +2410,7 @@ restore(): void
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
this
.
context
.
save
()
// save the default state
this
.
context
.
save
()
// save the default state
this
.
context
.
fillStyle
=
"
green
"
this
.
context
.
fillStyle
=
"
#00ff00
"
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
...
@@ -2448,7 +2448,7 @@ save(): void
...
@@ -2448,7 +2448,7 @@ save(): void
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
this
.
context
.
save
()
// save the default state
this
.
context
.
save
()
// save the default state
this
.
context
.
fillStyle
=
"
green
"
this
.
context
.
fillStyle
=
"
#00ff00
"
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
fillRect
(
20
,
20
,
100
,
100
)
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
restore
()
// restore to the default state
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
this
.
context
.
fillRect
(
150
,
75
,
100
,
100
)
...
@@ -2495,9 +2495,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
...
@@ -2495,9 +2495,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
})
...
@@ -2546,9 +2546,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
...
@@ -2546,9 +2546,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
var
grad
=
this
.
context
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
})
...
...
zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
浏览文件 @
4c544145
...
@@ -41,9 +41,9 @@ struct Page45 {
...
@@ -41,9 +41,9 @@ struct Page45 {
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
var
grad
=
this
.
context
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
this
.
context
.
fillRect
(
0
,
0
,
500
,
500
)
})
})
...
...
zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
浏览文件 @
4c544145
...
@@ -2626,9 +2626,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
...
@@ -2626,9 +2626,9 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
var
grad
=
this
.
offContext
.
createLinearGradient
(
50
,
0
,
300
,
100
)
var
grad
=
this
.
offContext
.
createLinearGradient
(
50
,
0
,
300
,
100
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
var
image
=
this
.
offContext
.
transferToImageBitmap
()
var
image
=
this
.
offContext
.
transferToImageBitmap
()
...
@@ -2680,9 +2680,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
...
@@ -2680,9 +2680,9 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number,
.
backgroundColor
(
'
#ffff00
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
.
onReady
(()
=>
{
var
grad
=
this
.
offContext
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
var
grad
=
this
.
offContext
.
createRadialGradient
(
200
,
200
,
50
,
200
,
200
,
200
)
grad
.
addColorStop
(
0.0
,
'
red
'
)
grad
.
addColorStop
(
0.0
,
'
#ff0000
'
)
grad
.
addColorStop
(
0.5
,
'
white
'
)
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
green
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillStyle
=
grad
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
this
.
offContext
.
fillRect
(
0
,
0
,
500
,
500
)
var
image
=
this
.
offContext
.
transferToImageBitmap
()
var
image
=
this
.
offContext
.
transferToImageBitmap
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录