Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7776272b
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看板
未验证
提交
7776272b
编写于
9月 05, 2023
作者:
刘
刘关鹏
提交者:
Gitee
9月 05, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-image.md.
Signed-off-by:
N
刘关鹏
<
liuguanpeng1@huawei.com
>
上级
97280e14
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
0 deletion
+20
-0
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+20
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
7776272b
...
...
@@ -36,6 +36,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
color
:
ArrayBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
:
Uint8Array
=
new
Uint8Array
(
color
);
let
opts
:
image
.
InitializationOptions
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
...
...
@@ -112,6 +113,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
readBuffer
:
ArrayBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
console
.
log
(
'
Succeeded in reading image pixel data.
'
);
//符合条件则进入
...
...
@@ -171,6 +173,7 @@ readPixels(area: PositionArea): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
area
:
image
.
PositionArea
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
...
...
@@ -243,6 +246,7 @@ writePixels(area: PositionArea): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
color
:
ArrayBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
:
Uint8Array
=
new
Uint8Array
(
color
);
let
opts
:
image
.
InitializationOptions
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
...
...
@@ -328,6 +332,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
color
:
ArrayBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
:
Uint8Array
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
...
...
@@ -1074,6 +1079,7 @@ release():Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
pixelmap
.
release
().
then
(()
=>
{
console
.
log
(
'
Succeeded in releasing pixelmap object.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -1411,6 +1417,7 @@ getImageInfo(index?: number): Promise\<ImageInfo>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
imageSourceApi
.
getImageInfo
(
0
)
.
then
((
imageInfo
:
image
.
ImageInfo
)
=>
{
console
.
log
(
'
Succeeded in obtaining the image information.
'
);
...
...
@@ -1642,6 +1649,7 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
imageSourceApi
.
createPixelMap
().
then
((
pixelmap
:
image
.
PixelMap
)
=>
{
console
.
log
(
'
Succeeded in creating pixelmap object through image decoding parameters.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2005,6 +2013,7 @@ release(): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
imageSourceApi
.
release
().
then
(()
=>
{
console
.
log
(
'
Succeeded in releasing the image source instance.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2092,6 +2101,7 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
imageSourceApi
:
image
.
ImageSource
=
image
.
createImageSource
(
0
);
let
packOpts
:
image
.
PackingOption
=
{
format
:
"
image/jpeg
"
,
quality
:
98
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
...
...
@@ -2156,6 +2166,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
const
color
:
ArrayBuffer
=
new
ArrayBuffer
(
96
);
//96为需要创建的像素buffer大小,取值为:height * width *4
let
bufferArr
:
Uint8Array
=
new
Uint8Array
(
color
);
let
opts
:
image
.
InitializationOptions
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
...
...
@@ -2209,6 +2220,7 @@ release(): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
imagePackerApi
.
release
().
then
(()
=>
{
console
.
log
(
'
Succeeded in releasing image packaging.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2304,6 +2316,7 @@ getReceivingSurfaceId(): Promise\<string>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
receiver
.
getReceivingSurfaceId
().
then
(
(
id
:
string
)
=>
{
console
.
log
(
'
getReceivingSurfaceId succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2354,6 +2367,7 @@ readLatestImage(): Promise\<Image>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
receiver
.
readLatestImage
().
then
((
img
:
image
.
Image
)
=>
{
console
.
log
(
'
readLatestImage succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2404,6 +2418,7 @@ readNextImage(): Promise\<Image>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
receiver
.
readNextImage
().
then
((
img
:
image
.
Image
)
=>
{
console
.
log
(
'
readNextImage succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2469,6 +2484,7 @@ release(): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
receiver
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2561,6 +2577,7 @@ dequeueImage(): Promise\<Image>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
creator
.
dequeueImage
().
then
((
img
:
image
.
Image
)
=>
{
console
.
info
(
'
dequeueImage succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2630,6 +2647,7 @@ queueImage(interface: Image): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
creator
.
dequeueImage
().
then
((
img
:
image
.
Image
)
=>
{
//绘制图片
img
.
getComponent
(
4
).
then
(
component
:
image
.
Component
=>
{
...
...
@@ -2717,6 +2735,7 @@ release(): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
creator
.
release
().
then
(()
=>
{
console
.
info
(
'
release succeeded
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
@@ -2834,6 +2853,7 @@ release(): Promise\<void>
**示例:**
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
img
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
((
error
:
BusinessError
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录