Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f97c7a6c
D
Docs
项目概览
OpenHarmony
/
Docs
11 个月 前同步成功
通知
158
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,发现更多精彩内容 >>
未验证
提交
f97c7a6c
编写于
10月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!10801 image文档修改
Merge pull request !10801 from 徐蕊w/master
上级
7625b197
dc1f18b9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
16 deletion
+16
-16
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+16
-16
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
f97c7a6c
...
...
@@ -36,7 +36,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
...
...
@@ -65,7 +65,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
error
,
pixelmap
)
=>
{
...
...
@@ -112,7 +112,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:**
```
js
const
readBuffer
=
new
ArrayBuffer
(
96
);
const
readBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
console
.
log
(
'
Succeeded in reading image pixel data.
'
);
//符合条件则进入
}).
catch
(
error
=>
{
...
...
@@ -138,7 +138,7 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```
js
const
readBuffer
=
new
ArrayBuffer
(
96
);
const
readBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
(
err
,
res
)
=>
{
if
(
err
)
{
console
.
log
(
'
Failed to read image pixel data.
'
);
//不符合条件则进入
...
...
@@ -202,7 +202,7 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
...
...
@@ -243,7 +243,7 @@ writePixels(area: PositionArea): Promise\<void>
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
...
...
@@ -328,7 +328,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
...
...
@@ -358,7 +358,7 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
...
...
@@ -390,7 +390,7 @@ getImageInfo(): Promise\<ImageInfo>
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
color
,
opts
).
then
(
pixelmap
=>
{
if
(
pixelmap
==
undefined
)
{
...
...
@@ -424,7 +424,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
...
...
@@ -458,7 +458,7 @@ getBytesNumberPerRow(): number
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
...
...
@@ -1044,7 +1044,7 @@ createImageSource(buf: ArrayBuffer): ImageSource
**示例:**
```
js
const
buf
=
new
ArrayBuffer
(
96
);
const
buf
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
const
imageSourceApi
=
image
.
createImageSource
(
buf
);
```
...
...
@@ -1099,7 +1099,7 @@ createIncrementalSource(buf: ArrayBuffer): ImageSource
**示例:**
```
js
const
buf
=
new
ArrayBuffer
(
96
);
const
buf
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
const
imageSourceIncrementalSApi
=
image
.
createIncrementalSource
(
buf
);
```
...
...
@@ -1127,7 +1127,7 @@ createIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
**示例:**
```
js
const
buf
=
new
ArrayBuffer
(
96
);
const
buf
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
const
imageSourceIncrementalSApi
=
image
.
createIncrementalSource
(
buf
);
```
...
...
@@ -1662,7 +1662,7 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
...
...
@@ -1697,7 +1697,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
**示例:**
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
=
new
Uint8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录