Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f5a4d7d5
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看板
提交
f5a4d7d5
编写于
5月 08, 2023
作者:
E
ester.zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs (16235)
Signed-off-by:
N
ester.zhou
<
ester.zhou@huawei.com
>
上级
85ea21ae
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
706 addition
and
407 deletion
+706
-407
en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239032420.png
...ference/arkui-ts/figures/en-us_image_0000001239032420.png
+0
-0
en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
...ion-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
+257
-119
en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
...reference/arkui-ts/ts-components-canvas-canvasgradient.md
+1
-1
en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md
...-dev/reference/arkui-ts/ts-components-canvas-imagedata.md
+21
-21
en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md
...ion-dev/reference/arkui-ts/ts-components-canvas-path2d.md
+60
-60
en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
...eference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
+367
-206
未找到文件。
en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239032420.png
0 → 100644
浏览文件 @
f5a4d7d5
5.7 KB
en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
浏览文件 @
f5a4d7d5
此差异已折叠。
点击以展开。
en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
浏览文件 @
f5a4d7d5
...
...
@@ -47,7 +47,7 @@ struct Page45 {
grad
.
addColorStop
(
0.5
,
'
#ffffff
'
)
grad
.
addColorStop
(
1.0
,
'
#00ff00
'
)
this
.
context
.
fillStyle
=
grad
this
.
context
.
fillRect
(
0
,
0
,
500
,
5
00
)
this
.
context
.
fillRect
(
0
,
0
,
400
,
4
00
)
})
}
.
width
(
'
100%
'
)
...
...
en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md
浏览文件 @
f5a4d7d5
...
...
@@ -24,29 +24,29 @@ An **ImageData** object stores pixel data rendered on a canvas.
```
ts
// xxx.ets
@
Entry
@
Component
struct
Translate
{
private
settings
:
RenderingContextSettings
=
new
RenderingContextSettings
(
true
)
private
context
:
CanvasRenderingContext2D
=
new
CanvasRenderingContext2D
(
this
.
settings
)
private
img
:
ImageBitmap
=
new
ImageBitmap
(
"
/common/images/1234.png
"
)
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Center
,
justifyContent
:
FlexAlign
.
Center
})
{
Canvas
(
this
.
context
)
.
width
(
'
100%
'
)
.
height
(
'
100%
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
context
.
drawImage
(
this
.
img
,
0
,
0
,
130
,
130
)
var
imagedata
=
this
.
context
.
getImageData
(
50
,
50
,
130
,
130
)
this
.
context
.
putImageData
(
imagedata
,
150
,
150
)
})
@
Entry
@
Component
struct
Translate
{
private
settings
:
RenderingContextSettings
=
new
RenderingContextSettings
(
true
)
private
context
:
CanvasRenderingContext2D
=
new
CanvasRenderingContext2D
(
this
.
settings
)
private
img
:
ImageBitmap
=
new
ImageBitmap
(
"
common/images/1234.png
"
)
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Center
,
justifyContent
:
FlexAlign
.
Center
})
{
Canvas
(
this
.
context
)
.
width
(
'
100%
'
)
.
height
(
'
100%
'
)
.
backgroundColor
(
'
#ffff00
'
)
.
onReady
(()
=>
{
this
.
context
.
drawImage
(
this
.
img
,
0
,
0
,
130
,
130
)
var
imagedata
=
this
.
context
.
getImageData
(
50
,
50
,
130
,
130
)
this
.
context
.
putImageData
(
imagedata
,
150
,
150
)
})
}
.
width
(
'
100%
'
)
.
height
(
'
100%
'
)
}
.
width
(
'
100%
'
)
.
height
(
'
100%
'
)
}
}
```
!
[
en-us_image_000000127777780
](
figures/en-us_image_000000127777780.png
)
en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md
浏览文件 @
f5a4d7d5
# Path2D
**Path2D**
allows you to describe a path through an existing path. This path can be drawn through the
**stroke**
API of
**Canvas**
.
**Path2D**
allows you to describe a path through an existing path. This path can be drawn through the
**stroke**
or
**fill**
API of
**Canvas**
.
> **NOTE**
>
**NOTE**
>
> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
...
...
@@ -18,11 +18,11 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| path | path2D | Yes| - | Path to be added to this path.|
| transform | Matrix2D | No| null | Transformation matrix of the new path.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| path | path2D | Yes| - | Path to be added to this path.|
| transform | Matrix2D | No| null | Transformation matrix of the new path.|
**Example**
...
...
@@ -109,10 +109,10 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the target point.|
| y | number | Yes| 0 | Y-coordinate of the target point.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the target point.|
| y | number | Yes| 0 | Y-coordinate of the target point.|
**Example**
...
...
@@ -158,10 +158,10 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the target point.|
| y | number | Yes| 0 | Y-coordinate of the target point.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the target point.|
| y | number | Yes| 0 | Y-coordinate of the target point.|
**Example**
...
...
@@ -208,14 +208,14 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| cp1x | number | Yes| 0 | X-coordinate of the first parameter of the bezier curve.|
| cp1y | number | Yes| 0 | Y-coordinate of the first parameter of the bezier curve.|
| cp2x | number | Yes| 0 | X-coordinate of the second parameter of the bezier curve.|
| cp2y | number | Yes| 0 | Y-coordinate of the second parameter of the bezier curve.|
| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.|
| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| cp1x | number | Yes| 0 | X-coordinate of the first parameter of the bezier curve.|
| cp1y | number | Yes| 0 | Y-coordinate of the first parameter of the bezier curve.|
| cp2x | number | Yes| 0 | X-coordinate of the second parameter of the bezier curve.|
| cp2y | number | Yes| 0 | Y-coordinate of the second parameter of the bezier curve.|
| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.|
| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.|
**Example**
...
...
@@ -259,12 +259,12 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| cpx | number | Yes| 0 | X-coordinate of the bezier curve parameter.|
| cpy | number | Yes| 0 | Y-coordinate of the bezier curve parameter.|
| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.|
| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| cpx | number | Yes| 0 | X-coordinate of the bezier curve parameter.|
| cpy | number | Yes| 0 | Y-coordinate of the bezier curve parameter.|
| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.|
| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.|
**Example**
...
...
@@ -308,14 +308,14 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the center point of the arc.|
| y | number | Yes| 0 | Y-coordinate of the center point of the arc.|
| radius | number | Yes| 0 | Radius of the arc.|
| startAngle | number | Yes| 0 | Start radian of the arc.|
| endAngle | number | Yes| 0 | End radian of the arc.|
| counterclockwise | boolean | No| false | Whether to draw the arc counterclockwise.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the center point of the arc.|
| y | number | Yes| 0 | Y-coordinate of the center point of the arc.|
| radius | number | Yes| 0 | Radius of the arc.|
| startAngle | number | Yes| 0 | Start radian of the arc.|
| endAngle | number | Yes| 0 | End radian of the arc.|
| counterclockwise | boolean | No| false | Whether to draw the arc counterclockwise.|
**Example**
...
...
@@ -358,13 +358,13 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x1 | number | Yes| 0 | X-coordinate of the first point on the arc.|
| y1 | number | Yes| 0 | Y-coordinate of the first point on the arc.|
| x2 | number | Yes| 0 | X-coordinate of the second point on the arc.|
| y2 | number | Yes| 0 | Y-coordinate of the second point on the arc.|
| radius | number | Yes| 0 | Radius of the arc.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x1 | number | Yes| 0 | X-coordinate of the first point on the arc.|
| y1 | number | Yes| 0 | Y-coordinate of the first point on the arc.|
| x2 | number | Yes| 0 | X-coordinate of the second point on the arc.|
| y2 | number | Yes| 0 | Y-coordinate of the second point on the arc.|
| radius | number | Yes| 0 | Radius of the arc.|
**Example**
...
...
@@ -407,16 +407,16 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the ellipse center.|
| y | number | Yes| 0 | Y-coordinate of the ellipse center.|
| radiusX | number | Yes| 0 | Ellipse radius on the x-axis.|
| radiusY | number | Yes| 0 | Ellipse radius on the y-axis.|
| rotation | number | Yes| 0 | Rotation angle of the ellipse. The unit is radian.|
| startAngle | number | Yes| 0 | Angle of the start point for drawing the ellipse. The unit is radian.|
| endAngle | number | Yes| 0 | Angle of the end point for drawing the ellipse. The unit is radian.|
| counterclockwise | boolean | No| false | Whether to draw the ellipse counterclockwise.
<br>
**true**
: Draw the ellipse counterclockwise.
<br>
**false**
: Draw the ellipse clockwise.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the ellipse center.|
| y | number | Yes| 0 | Y-coordinate of the ellipse center.|
| radiusX | number | Yes| 0 | Ellipse radius on the x-axis.|
| radiusY | number | Yes| 0 | Ellipse radius on the y-axis.|
| rotation | number | Yes| 0 | Rotation angle of the ellipse. The unit is radian.|
| startAngle | number | Yes| 0 | Angle of the start point for drawing the ellipse. The unit is radian.|
| endAngle | number | Yes| 0 | Angle of the end point for drawing the ellipse. The unit is radian.|
| counterclockwise | boolean | No| false | Whether to draw the ellipse counterclockwise.
<br>
**true**
: Draw the ellipse counterclockwise.
<br>
**false**
: Draw the ellipse clockwise.|
**Example**
...
...
@@ -459,12 +459,12 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters**
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the upper left corner of the rectangle.|
| y | number | Yes| 0 | Y-coordinate of the upper left corner of the rectangle.|
| w | number | Yes| 0 | Width of the rectangle.|
| h | number | Yes| 0 | Height of the rectangle.|
| Name| Type| Mandatory| Default Value| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| 0 | X-coordinate of the upper left corner of the rectangle.|
| y | number | Yes| 0 | Y-coordinate of the upper left corner of the rectangle.|
| w | number | Yes| 0 | Width of the rectangle.|
| h | number | Yes| 0 | Height of the rectangle.|
**Example**
...
...
en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
浏览文件 @
f5a4d7d5
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录