Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d17bc999
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
提交
d17bc999
编写于
5月 07, 2022
作者:
Z
zhang-xiaobo1997
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify for image reciver
Signed-off-by:
N
zhang-xiaobo1997
<
tony.zhangxiaobo@huawei.com
>
上级
80532197
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
165 addition
and
155 deletion
+165
-155
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+165
-155
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
d17bc999
...
@@ -66,9 +66,11 @@ image.createPixelMap(Color, opts, (pixelmap) => {
...
@@ -66,9 +66,11 @@ image.createPixelMap(Color, opts, (pixelmap) => {
### 属性
### 属性
**系统能力: **
SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------------------- | ------- | ---- | ---- | --------------------------
----------------------------------
|
| ----------------------- | ------- | ---- | ---- | -------------------------- |
| isEditable
<sup>
7+
</sup>
| boolean | 是 | 否 | 设定是否图像像素可被编辑。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image
|
| isEditable
<sup>
7+
</sup>
| boolean | 是 | 否 | 设定是否图像像素可被编辑。 |
### readPixelsToBuffer<sup>7+</sup>
### readPixelsToBuffer<sup>7+</sup>
...
@@ -514,9 +516,11 @@ const imageSourceApi = image.createImageSource(0)
...
@@ -514,9 +516,11 @@ const imageSourceApi = image.createImageSource(0)
### 属性
### 属性
**系统能力: **
SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
| supportedFormats | Array
\<
string> | 是 | 否 | 支持的图片格式,包括:png,jpeg,wbmp,bmp,gif,webp,heif等。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image
|
| supportedFormats | Array
\<
string> | 是 | 否 | 支持的图片格式,包括:png,jpeg,wbmp,bmp,gif,webp,heif等。 |
### getImageInfo
### getImageInfo
...
@@ -793,9 +797,11 @@ const imagePackerApi = image.createImagePacker();
...
@@ -793,9 +797,11 @@ const imagePackerApi = image.createImagePacker();
### 属性
### 属性
**系统能力: **
SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | -------------- | ---- | ---- | --------------------------
----------------------------------
|
| ---------------- | -------------- | ---- | ---- | -------------------------- |
| supportedFormats | Array
\<
string> | 是 | 否 | 图片打包支持的格式,jpeg。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image
|
| supportedFormats | Array
\<
string> | 是 | 否 | 图片打包支持的格式,jpeg。 |
### packing
### packing
...
@@ -884,7 +890,7 @@ packing(source: PixelMap, option: PackingOption): Promise<Array\<ArrayBuffer>>
...
@@ -884,7 +890,7 @@ packing(source: PixelMap, option: PackingOption): Promise<Array\<ArrayBuffer>>
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------------- | ---- | -------------- |
| ------ | ------------------------------- | ---- | --------------
----
|
| source |
[
PixelMap
](
#pixelmap
)
| 是 | 打包的PixelMap源。 |
| source |
[
PixelMap
](
#pixelmap
)
| 是 | 打包的PixelMap源。 |
| option |
[
PackingOption
](
#packingoption
)
| 是 | 设置打包参数。 |
| option |
[
PackingOption
](
#packingoption
)
| 是 | 设置打包参数。 |
...
@@ -944,31 +950,62 @@ release(): Promise\<void>
...
@@ -944,31 +950,62 @@ release(): Promise\<void>
}).
catch
((
error
)
=>
{})
}).
catch
((
error
)
=>
{})
```
```
## ImageReceiver<sup>8+</sup>
## image.createImageReceiver<sup>9+</sup>
createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver
通过宽、高、图片格式、容量创建imagereceiver实例。
**系统能力: **
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------- |
| width | number | 是 | imagereceiver将生成的图像的默认宽度。 |
| height | number | 是 | imagereceiver将生成的图像的默认高度。 |
| format | number | 是 | imagereceiver将生成的图像格式。 |
| capacity | number | 是 | 同时访问的最大图像数。 |
**返回值:**
| 类型 | 说明 |
| ------------- | ----------------------------------------- |
| ImageReceiver | 如果操作成功,则返回 ImageReceiver 实例。 |
**示例:**
```
js
var
receiver
=
image
.
createImageReceiver
(
8192
,
8
,
4
,
8
)
```
## ImageReceiver<sup>9+</sup>
图像接收类,用于获取组件
端口号
,接收最新的图片和读取下一张图片,以及释放 ImageReceiver 实例。在调用各方法前需要先创建 ImageReceiver 实例。
图像接收类,用于获取组件
surface id
,接收最新的图片和读取下一张图片,以及释放 ImageReceiver 实例。在调用各方法前需要先创建 ImageReceiver 实例。
### 属性
### 属性
**系统能力: **
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ---------------------------- | ---- | ---- | ------------------
------------------------------------------
|
| -------- | ---------------------------- | ---- | ---- | ------------------ |
| size |
[
Size
](
#
Size
)
| 是 | 否 | 图片大小。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
|
| size |
[
Size
](
#
size
)
| 是 | 否 | 图片大小。
|
| capacity | number | 是 | 否 | 同时访问的图像数。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
|
| capacity | number | 是 | 否 | 同时访问的图像数。 |
| format |
[
ImageFormat
](
#
ImageFormat8
)
| 是 | 否 | 图像格式。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
|
| format |
[
ImageFormat
](
#
imageformat9
)
| 是 | 否 | 图像格式。
|
### getReceivingSurfaceId<sup>
8
+</sup>
### getReceivingSurfaceId<sup>
9
+</sup>
getReceivingSurfaceId(callback: AsyncCallback
<string>
): void
getReceivingSurfaceId(callback: AsyncCallback
\
<
string>): void
获取一个端口id,可用于设置为 Camera 或其他组件可以接收端口,
并使用callback返回结果。
用于获取一个surface id
并使用callback返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | ---------------------
| ---- |
------------------------ |
| -------- | ---------------------
- | ---- | ----
------------------------ |
| callback | AsyncCallback
<string>
| 是 | 使用callback返回端口
id。 |
| callback | AsyncCallback
\<
string> | 是 | 使用callback返回surface
id。 |
**示例:**
**示例:**
...
@@ -976,19 +1013,19 @@ getReceivingSurfaceId(callback: AsyncCallback<string>): void
...
@@ -976,19 +1013,19 @@ getReceivingSurfaceId(callback: AsyncCallback<string>): void
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{});
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{});
```
```
### getReceivingSurfaceId<sup>
8
+</sup>
### getReceivingSurfaceId<sup>
9
+</sup>
getReceivingSurfaceId(): Promise
<string>
getReceivingSurfaceId(): Promise
\
<
string>
获取一个端口id,可用于设置为 Camera 或其他组件可以接收端口,
并使用promise返回结果。
用于获取一个surface id
并使用promise返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ---------------
|
---------------- |
| ---------------
- | ----
---------------- |
| Promise
<string>
| 异步返回端口
id。 |
| Promise
\<
string> | 异步返回surface
id。 |
**示例:**
**示例:**
...
@@ -998,19 +1035,19 @@ receiver.getReceivingSurfaceId().then( id => {
...
@@ -998,19 +1035,19 @@ receiver.getReceivingSurfaceId().then( id => {
})
})
```
```
### readLatestImage<sup>
8
+</sup>
### readLatestImage<sup>
9
+</sup>
readLatestImage(callback: AsyncCallback
<Image>
): void
readLatestImage(callback: AsyncCallback
\
<
Image>): void
从 ImageReceiver读取最新的图片,并使用callback返回结果。
从 ImageReceiver读取最新的图片,并使用callback返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ---------------------- |
| -------- | ------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback
<
[
Image
](
#
I
mage8
)
>
| 是 | callback返回最新图像。 |
| callback | AsyncCallback
<
[
Image
](
#
i
mage8
)
>
| 是 | callback返回最新图像。 |
**示例:**
**示例:**
...
@@ -1018,19 +1055,19 @@ readLatestImage(callback: AsyncCallback<Image>): void
...
@@ -1018,19 +1055,19 @@ readLatestImage(callback: AsyncCallback<Image>): void
receiver
.
readLatestImage
((
err
,
img
)
=>
{
});
receiver
.
readLatestImage
((
err
,
img
)
=>
{
});
```
```
### readLatestImage<sup>
8
+</sup>
### readLatestImage<sup>
9
+</sup>
readLatestImage(): Promise
<Image>
readLatestImage(): Promise
\
<
Image>
从 ImageReceiver读取最新的图片,并使用promise返回结果。
从 ImageReceiver读取最新的图片,并使用promise返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------- | ------------------ |
| ------------------------- | ------------------ |
| Promise
<
[
Image
](
#
I
mage8
)
>
| 异步返回最新图片。 |
| Promise
<
[
Image
](
#
i
mage8
)
>
| 异步返回最新图片。 |
**示例:**
**示例:**
...
@@ -1039,19 +1076,19 @@ receiver.readLatestImage().then(img => {})
...
@@ -1039,19 +1076,19 @@ receiver.readLatestImage().then(img => {})
.
catch
(
error
=>
{})
.
catch
(
error
=>
{})
```
```
### readNextImage<sup>
8
+</sup>
### readNextImage<sup>
9
+</sup>
readNextImage(callback: AsyncCallback
<Image>
): void
readNextImage(callback: AsyncCallback
\
<
Image>): void
从 ImageReceiver读取下一张图片,并使用callback返回结果。
从 ImageReceiver读取下一张图片,并使用callback返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------------ |
| -------- | ------------------------------- | ---- | ------------------------ |
| callback | AsyncCallback
<
[
Image
](
#
I
mage8
)
>
| 是 | callback返回下一张图片。 |
| callback | AsyncCallback
<
[
Image
](
#
i
mage8
)
>
| 是 | callback返回下一张图片。 |
**示例:**
**示例:**
...
@@ -1059,19 +1096,19 @@ readNextImage(callback: AsyncCallback<Image>): void
...
@@ -1059,19 +1096,19 @@ readNextImage(callback: AsyncCallback<Image>): void
receiver
.
readNextImage
((
err
,
img
)
=>
{});
receiver
.
readNextImage
((
err
,
img
)
=>
{});
```
```
### readNextImage<sup>
8
+</sup>
### readNextImage<sup>
9
+</sup>
readNextImage(): Promise
<Image>
readNextImage(): Promise
\
<
Image>
从 ImageReceiver读取下一张图片,并使用promise返回结果。
从 ImageReceiver读取下一张图片,并使用promise返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------------- | -------------------- |
| ------------------------- | -------------------- |
| Promise
<
[
Image
](
#
I
mage8
)
>
| 异步返回下一张图片。 |
| Promise
<
[
Image
](
#
i
mage8
)
>
| 异步返回下一张图片。 |
**示例:**
**示例:**
...
@@ -1081,20 +1118,20 @@ readNextImage(): Promise<Image>
...
@@ -1081,20 +1118,20 @@ readNextImage(): Promise<Image>
})
})
```
```
### on<sup>
8
+</sup>
### on<sup>
9
+</sup>
on(type: 'imageArrival', callback: AsyncCallback
<void>
): void
on(type: 'imageArrival', callback: AsyncCallback
\
<
void>): void
接收图片时注册回调。
接收图片时注册回调。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------------------
| ---- |
---------------- |
| -------- | -------------------
- | ---- | --------------------------------------
---------------- |
| type | imageArrival
| 是 | 注册事件的类型
。 |
| type | imageArrival
| 是 | 注册事件的类型,固定为'imageArrival',接收图片时触发
。 |
| callback | AsyncCallback
<void>
| 是 | 注册的事件回调。
|
| callback | AsyncCallback
\<
void> | 是 | 注册的事件回调。
|
**示例:**
**示例:**
...
@@ -1102,19 +1139,19 @@ on(type: 'imageArrival', callback: AsyncCallback<void>): void
...
@@ -1102,19 +1139,19 @@ on(type: 'imageArrival', callback: AsyncCallback<void>): void
receiver
.
on
(
'
imageArrival
'
,
()
=>
{})
receiver
.
on
(
'
imageArrival
'
,
()
=>
{})
```
```
### release<sup>
8
+</sup>
### release<sup>
9
+</sup>
release(callback: AsyncCallback
<void>
): void
release(callback: AsyncCallback
\
<
void>): void
释放ImageReceiver实例并使用回调返回结果。
释放ImageReceiver实例并使用回调返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | -------------- |
| -------- | -------------------
-
| ---- | -------------- |
| callback | AsyncCallback
<void>
| 是 | 返回操作结果。 |
| callback | AsyncCallback
\
<
void> | 是 | 返回操作结果。 |
**示例:**
**示例:**
...
@@ -1122,19 +1159,19 @@ on(type: 'imageArrival', callback: AsyncCallback<void>): void
...
@@ -1122,19 +1159,19 @@ on(type: 'imageArrival', callback: AsyncCallback<void>): void
receiver
.
release
(()
=>
{})
receiver
.
release
(()
=>
{})
```
```
### release<sup>
8
+</sup>
### release<sup>
9
+</sup>
release(): Promise
<void>
release(): Promise
\
<
void>
释放ImageReceiver实例并使用promise返回结果。
释放ImageReceiver实例并使用promise返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
SystemCapability.Multimedia.Image.ImageReceiver
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------- | ----------------------- |
| -------------
-
| ----------------------- |
| Promise
<void>
| 用promise返回操作结果。 |
| Promise
\
<
void> | 用promise返回操作结果。 |
**示例:**
**示例:**
...
@@ -1143,61 +1180,34 @@ release(): Promise<void>
...
@@ -1143,61 +1180,34 @@ release(): Promise<void>
.
catch
(
error
=>
{})
.
catch
(
error
=>
{})
```
```
## image.createImageReceiver<sup>8+</sup>
## Image<sup>9+</sup>
createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver
通过宽、高、图片格式、容量创建imagereceiver实例。
**系统能力:**
SystemCapability.Multimedia.Image.ImageReceiver
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------------------------- |
| width | number | 是 | imagereceiver将生成的图像的默认宽度。 |
| height | number | 是 | imagereceiver将生成的图像的默认高度。 |
| format | number | 是 | imagereceiver将生成的图像格式。 |
| capacity | number | 是 | 同时访问的最大图像数。 |
**返回值:**
| 类型 | 说明 |
| ------------- | ----------------------------------------- |
| ImageReceiver | 如果操作成功,则返回 ImageReceiver 实例。 |
**示例:**
```
js
var
receiver
=
image
.
createImageReceiver
(
8192
,
8
,
4
,
8
)
```
## Image<sup>8+</sup>
提供基本的图像操作,包括获取图像信息、读写图像数据。
提供基本的图像操作,包括获取图像信息、读写图像数据。
调用readNextImage和readLatestImage接口时会返回image。
### 属性
### 属性
**系统能力: **
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ------------------ | ---- | ---- | ----------------------------
--------------------------------
|
| -------- | ------------------ | ---- | ---- | ---------------------------- |
| clipRect |
[
Region
](
#
Region7
)
| 是 | 是 | 设置或获取要裁剪的图像区域。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.Core
|
| clipRect |
[
Region
](
#
region8
)
| 是 | 是 | 设置或获取要裁剪的图像区域。
|
| size |
[
Size
](
#
Size
)
| 是 | 否 | 图像大小。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.Core
|
| size |
[
Size
](
#
size
)
| 是 | 否 | 图像大小。
|
| format | number | 是 | 否 | 图像格式。
<br/>
**系统能力:**
SystemCapability.Multimedia.Image.Core
|
| format | number | 是 | 否 | 图像格式。
|
### getComponent<sup>
8
+</sup>
### getComponent<sup>
9
+</sup>
getComponent(componentType: ComponentType, callback: AsyncCallback
<Component>
): void
getComponent(componentType: ComponentType, callback: AsyncCallback
\
<
Component>): void
从图像中获取组件缓冲区
并使用callback返回结果。
根据图像的组件类型从图像中获取组件缓存
并使用callback返回结果。
**系统能力:**
SystemCapability.Multimedia.Image.Core
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ------------- | --------------------------------------- | ---- | -------------------- |
| ------------- | --------------------------------------- | ---- | -------------------- |
| componentType |
[
ComponentType
](
#
ComponentT
ype8
)
| 是 | 图像的组件类型。 |
| componentType |
[
ComponentType
](
#
componentt
ype8
)
| 是 | 图像的组件类型。 |
| callback | AsyncCallback
<
[
Component
](
#
C
omponent8
)
>
| 是 | 用于返回组件缓冲区。 |
| callback | AsyncCallback
<
[
Component
](
#
c
omponent8
)
>
| 是 | 用于返回组件缓冲区。 |
**示例:**
**示例:**
...
@@ -1205,25 +1215,25 @@ getComponent(componentType: ComponentType, callback: AsyncCallback<Component>):
...
@@ -1205,25 +1215,25 @@ getComponent(componentType: ComponentType, callback: AsyncCallback<Component>):
img
.
getComponent
(
4
,
(
err
,
component
)
=>
{})
img
.
getComponent
(
4
,
(
err
,
component
)
=>
{})
```
```
### getComponent<sup>
8
+</sup>
### getComponent<sup>
9
+</sup>
getComponent(componentType: ComponentType): Promise
<Component>
getComponent(componentType: ComponentType): Promise
\
<
Component>
从图像中获取组件缓冲区
并使用promise方式返回结果。
根据图像的组件类型从图像中获取组件缓存
并使用promise方式返回结果。
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ------------- | -------------------------------- | ---- | ---------------- |
| ------------- | -------------------------------- | ---- | ---------------- |
| componentType |
[
ComponentType
](
#
ComponentT
ype8
)
| 是 | 图像的组件类型。 |
| componentType |
[
ComponentType
](
#
componentt
ype8
)
| 是 | 图像的组件类型。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------------------- | --------------------------------- |
| --------------------------------- | --------------------------------- |
| Promise
<
[
Component
](
#
C
omponent8
)
>
| 用于返回组件缓冲区的promise实例。 |
| Promise
<
[
Component
](
#
c
omponent8
)
>
| 用于返回组件缓冲区的promise实例。 |
**示例:**
**示例:**
...
@@ -1231,19 +1241,19 @@ getComponent(componentType: ComponentType): Promise<Component>
...
@@ -1231,19 +1241,19 @@ getComponent(componentType: ComponentType): Promise<Component>
img
.
getComponent
(
4
).
then
(
component
=>
{
})
img
.
getComponent
(
4
).
then
(
component
=>
{
})
```
```
### release<sup>
8
+</sup>
### release<sup>
9
+</sup>
release(callback: AsyncCallback
<void>
): void
release(callback: AsyncCallback
\
<
void>): void
释放当前图像
以接收另一个图像并使用callback返回结果
。
释放当前图像
并使用callback返回结果。在接收另一个图像前必须先释放对应资源
。
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | -------------- |
| -------- | -------------------
-
| ---- | -------------- |
| callback | AsyncCallback
<void>
| 是 | 返回操作结果。 |
| callback | AsyncCallback
\
<
void> | 是 | 返回操作结果。 |
**示例:**
**示例:**
...
@@ -1251,19 +1261,19 @@ release(callback: AsyncCallback<void>): void
...
@@ -1251,19 +1261,19 @@ release(callback: AsyncCallback<void>): void
img
.
release
(()
=>
{
})
img
.
release
(()
=>
{
})
```
```
### release<sup>
8
+</sup>
### release<sup>
9
+</sup>
release(): Promise
<void>
release(): Promise
\
<
void>
释放当前图像
以接收另一个图像并使用promise返回结果
。
释放当前图像
并使用promise返回结果。在接收另一个图像前必须先释放对应资源
。
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**系统能力:
**
SystemCapability.Multimedia.Image.Core
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------- | --------------------- |
| -------------
-
| --------------------- |
| Promise
<void>
| promise返回操作结果。 |
| Promise
\
<
void> | promise返回操作结果。 |
**示例:**
**示例:**
...
@@ -1277,7 +1287,7 @@ img.release().then(() =>{
...
@@ -1277,7 +1287,7 @@ img.release().then(() =>{
表示图片指定区域内的数据。
表示图片指定区域内的数据。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ |
| ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ |
...
@@ -1290,7 +1300,7 @@ img.release().then(() =>{
...
@@ -1290,7 +1300,7 @@ img.release().then(() =>{
表示图片信息。
表示图片信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------- | ---- | ---- | ---------- |
| ---- | ------------- | ---- | ---- | ---------- |
...
@@ -1300,7 +1310,7 @@ img.release().then(() =>{
...
@@ -1300,7 +1310,7 @@ img.release().then(() =>{
表示图片尺寸。
表示图片尺寸。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ---- | ---- | -------------- |
| ------ | ------ | ---- | ---- | -------------- |
...
@@ -1311,7 +1321,7 @@ img.release().then(() =>{
...
@@ -1311,7 +1321,7 @@ img.release().then(() =>{
枚举,像素格式。
枚举,像素格式。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| --------- | ------ | ----------------- |
| --------- | ------ | ----------------- |
...
@@ -1323,7 +1333,7 @@ img.release().then(() =>{
...
@@ -1323,7 +1333,7 @@ img.release().then(() =>{
枚举,透明度。
枚举,透明度。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| -------- | ------ | ----------------------- |
| -------- | ------ | ----------------------- |
...
@@ -1336,7 +1346,7 @@ img.release().then(() =>{
...
@@ -1336,7 +1346,7 @@ img.release().then(() =>{
枚举,缩略值。
枚举,缩略值。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| --------------- | ------ | -------------------------------------------------- |
| --------------- | ------ | -------------------------------------------------- |
...
@@ -1345,10 +1355,10 @@ img.release().then(() =>{
...
@@ -1345,10 +1355,10 @@ img.release().then(() =>{
## InitializationOptions<sup>8+</sup>
## InitializationOptions<sup>8+</sup>
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | ---------------------------------- | ---- | ---- | -------------- |
| -----------
-----------
| ---------------------------------- | ---- | ---- | -------------- |
| alphaType
<sup>
9+
</sup>
|
[
AlphaType
](
#alphatype9
)
| 是 | 是 | 透明度。 |
| alphaType
<sup>
9+
</sup>
|
[
AlphaType
](
#alphatype9
)
| 是 | 是 | 透明度。 |
| editable | boolean | 是 | 是 | 是否可编辑。 |
| editable | boolean | 是 | 是 | 是否可编辑。 |
| pixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 像素格式。 |
| pixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 像素格式。 |
...
@@ -1359,7 +1369,7 @@ img.release().then(() =>{
...
@@ -1359,7 +1369,7 @@ img.release().then(() =>{
解码设置选项。
解码设置选项。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------ | ---------------------------------- | ---- | ---- | ---------------- |
| ------------------ | ---------------------------------- | ---- | ---- | ---------------- |
...
@@ -1367,15 +1377,15 @@ img.release().then(() =>{
...
@@ -1367,15 +1377,15 @@ img.release().then(() =>{
| rotate | number | 是 | 是 | 旋转角度。 |
| rotate | number | 是 | 是 | 旋转角度。 |
| editable | boolean | 是 | 是 | 是否可编辑。 |
| editable | boolean | 是 | 是 | 是否可编辑。 |
| desiredSize |
[
Size
](
#size
)
| 是 | 是 | 期望输出大小。 |
| desiredSize |
[
Size
](
#size
)
| 是 | 是 | 期望输出大小。 |
| desiredRegion |
[
Region
](
#region
7
)
| 是 | 是 | 解码区域。 |
| desiredRegion |
[
Region
](
#region
8
)
| 是 | 是 | 解码区域。 |
| desiredPixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 解码的像素格式。 |
| desiredPixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 解码的像素格式。 |
| index | numer | 是 | 是 | 解码图片序号 |
| index | numer | 是 | 是 | 解码图片序号 |
## Region<sup>
7
+</sup>
## Region<sup>
8
+</sup>
表示区域信息。
表示区域信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------- | ---- | ---- | ------------ |
| ---- | ------------- | ---- | ---- | ------------ |
...
@@ -1387,7 +1397,7 @@ img.release().then(() =>{
...
@@ -1387,7 +1397,7 @@ img.release().then(() =>{
表示图片打包选项。
表示图片打包选项。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------ | ---- | ---- | -------------- |
| ------- | ------ | ---- | ---- | -------------- |
...
@@ -1398,7 +1408,7 @@ img.release().then(() =>{
...
@@ -1398,7 +1408,7 @@ img.release().then(() =>{
表示查询图片属性的索引。
表示查询图片属性的索引。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------ | ------ | ---- | ---- | ------------ |
| ------------ | ------ | ---- | ---- | ------------ |
...
@@ -1409,7 +1419,7 @@ img.release().then(() =>{
...
@@ -1409,7 +1419,7 @@ img.release().then(() =>{
枚举,Exif(Exchangeable image file format)图片信息。
枚举,Exif(Exchangeable image file format)图片信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
| 名称 | 默认值 | 说明 |
| 名称 | 默认值 | 说明 |
| ----------------- | ----------------- | -------------------- |
| ----------------- | ----------------- | -------------------- |
...
@@ -1422,11 +1432,11 @@ img.release().then(() =>{
...
@@ -1422,11 +1432,11 @@ img.release().then(() =>{
| GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。 |
| GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。 |
| GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。 |
| GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。 |
## ImageFormat<sup>
8
+</sup>
## ImageFormat<sup>
9
+</sup>
枚举,图片格式。
枚举,图片格式。
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| ------------ | ------ | --------------------- |
| ------------ | ------ | --------------------- |
...
@@ -1437,7 +1447,7 @@ img.release().then(() =>{
...
@@ -1437,7 +1447,7 @@ img.release().then(() =>{
枚举,图像的组件类型。
枚举,图像的组件类型。
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| ----- | ------ | ----------- |
| ----- | ------ | ----------- |
...
@@ -1450,11 +1460,11 @@ img.release().then(() =>{
...
@@ -1450,11 +1460,11 @@ img.release().then(() =>{
描述图像颜色分量。
描述图像颜色分量。
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core
**系统能力:
**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------- | -------------------------------- | ---- | ---- | ------------ |
| ------------- | -------------------------------- | ---- | ---- | ------------ |
| componentType |
[
ComponentType
](
#
ComponentT
ype8
)
| 是 | 否 | 组件类型。 |
| componentType |
[
ComponentType
](
#
componentt
ype8
)
| 是 | 否 | 组件类型。 |
| rowStride | number | 是 | 否 | 行距。 |
| rowStride | number | 是 | 否 | 行距。 |
| pixelStride | number | 是 | 否 | 像素间距。 |
| pixelStride | number | 是 | 否 | 像素间距。 |
| byteBuffer | ArrayBuffer | 是 | 否 | 组件缓冲区。 |
| byteBuffer | ArrayBuffer | 是 | 否 | 组件缓冲区。 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录