Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
29a3fe10
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看板
提交
29a3fe10
编写于
6月 23, 2022
作者:
X
xu-rui-w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
文档修改
Signed-off-by:
N
xu-rui-w
<
xurui101@huawei.com
>
上级
20f94deb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
230 addition
and
103 deletion
+230
-103
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+230
-103
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
29a3fe10
...
...
@@ -20,7 +20,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
| 名称 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ |
| colors | ArrayBuffer | 是 |
颜色数组。
|
| colors | ArrayBuffer | 是 |
BGRA_8888格式的颜色数组。
|
| options |
[
InitializationOptions
](
#initializationoptions8
)
| 是 | 创建像素的属性,包括透明度,尺寸,缩略值,像素格式和是否可编辑。 |
**返回值:**
...
...
@@ -32,7 +32,9 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
**示例:**
```
js
image
.
createPixelMap
(
Color
,
opts
)
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
((
pixelmap
)
=>
{
})
```
...
...
@@ -49,14 +51,16 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | -------------------------- |
| colors | ArrayBuffer | 是 |
颜色数组。
|
| colors | ArrayBuffer | 是 |
BGRA_8888格式的颜色数组。
|
| options |
[
InitializationOptions
](
#initializationoptions8
)
| 是 | 属性。 |
| callback | AsyncCallback
\<
[
PixelMap
](
#pixelmap7
)
> | 是 | 通过回调返回PixelMap对象。 |
**示例:**
```
js
image
.
createPixelMap
(
Color
,
opts
,
(
pixelmap
)
=>
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
})
```
...
...
@@ -95,11 +99,11 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:**
```
js
pixelmap
.
readPixelsToBuffer
(
r
eadBuffer
).
then
(()
=>
{
//符合条件则进入
}).
catch
(
error
=>
{
//不符合条件则进入
})
pixelmap
.
readPixelsToBuffer
(
R
eadBuffer
).
then
(()
=>
{
console
.
log
(
'
readPixelsToBuffer succeeded.
'
);
//符合条件则进入
}).
catch
(
error
=>
{
console
.
log
(
'
readPixelsToBuffer failed.
'
);
//不符合条件则进入
})
```
### readPixelsToBuffer<sup>7+</sup>
...
...
@@ -120,8 +124,13 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```
js
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
})
pixelmap
.
readPixelsToBuffer
(
ReadBuffer
,
(
err
,
res
)
=>
{
if
(
err
)
{
console
.
log
(
'
readPixelsToBuffer failed.
'
);
//不符合条件则进入
}
else
{
console
.
log
(
'
readPixelsToBuffer succeeded.
'
);
//符合条件则进入
}
})
```
### readPixels<sup>7+</sup>
...
...
@@ -147,11 +156,11 @@ readPixels(area: PositionArea): Promise\<void>
**示例:**
```
js
pixelmap
.
readPixels
(
a
rea
).
then
((
data
)
=>
{
//符合条件则进入
}).
catch
(
error
=>
{
//不符合条件则进入
})
pixelmap
.
readPixels
(
A
rea
).
then
((
data
)
=>
{
console
.
log
(
'
readPixels succeeded.
'
);
//符合条件则进入
}).
catch
(
error
=>
{
console
.
log
(
'
readPixels failed.
'
);
//不符合条件则进入
})
```
### readPixels<sup>7+</sup>
...
...
@@ -175,14 +184,12 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
){
console
.
info
(
'
createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
createPixelMap failed.
'
);
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}}
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}};
pixelmap
.
readPixels
(
area
,
()
=>
{
console
.
info
(
'
readPixels success
'
);
})
...
...
@@ -218,9 +225,7 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
console
.
info
(
'
createPixelMap failed.
'
);
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
...
...
@@ -243,8 +248,6 @@ image.createPixelMap(color, opts)
})
.
catch
(
error
=>
{
console
.
log
(
'
error:
'
+
error
);
expect
().
assertFail
();
done
();
})
```
...
...
@@ -266,14 +269,14 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
**示例:**
```
js
pixelmap
.
writePixels
(
a
rea
,
()
=>
{
pixelmap
.
writePixels
(
A
rea
,
()
=>
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
}
})
})
```
### writeBufferToPixels<sup>7+</sup>
...
...
@@ -299,11 +302,11 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:**
```
js
pixelMap
.
writeBufferToPixels
(
colorBuffe
r
).
then
(()
=>
{
PixelMap
.
writeBufferToPixels
(
colo
r
).
then
(()
=>
{
console
.
log
(
"
Succeeded in writing data from a buffer to a PixelMap.
"
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
})
;
})
```
### writeBufferToPixels<sup>7+</sup>
...
...
@@ -324,12 +327,13 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```
js
pixelMap
.
writeBufferToPixels
(
colorBuffe
r
,
function
(
err
)
{
PixelMap
.
writeBufferToPixels
(
colo
r
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
return
;
}
}
else
{
console
.
log
(
"
Succeeded in writing data from a buffer to a PixelMap.
"
);
}
});
```
...
...
@@ -350,7 +354,7 @@ getImageInfo(): Promise\<ImageInfo>
**示例:**
```
js
p
ixelMap
.
getImageInfo
().
then
(
function
(
info
)
{
P
ixelMap
.
getImageInfo
().
then
(
function
(
info
)
{
console
.
log
(
"
Succeeded in obtaining the image pixel map information.
"
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
Failed to obtain the image pixel map information.
"
);
...
...
@@ -374,7 +378,11 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:**
```
js
pixelmap
.
getImageInfo
((
imageInfo
)
=>
{})
pixelmap
.
getImageInfo
((
imageInfo
)
=>
{
console
.
log
(
"
getImageInfo succeeded.
"
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getImageInfo failed.
"
);
})
```
### getBytesNumberPerRow<sup>7+</sup>
...
...
@@ -394,7 +402,9 @@ getBytesNumberPerRow(): number
**示例:**
```
js
rowCount
=
pixelmap
.
getBytesNumberPerRow
()
image
.
createPixelMap
(
clolr
,
opts
,
(
err
,
pixelmap
)
=>
{
let
rowCount
=
pixelmap
.
getBytesNumberPerRow
();
})
```
### getPixelBytesNumber<sup>7+</sup>
...
...
@@ -414,7 +424,7 @@ getPixelBytesNumber(): number
**示例:**
```
js
pixelBytesNumber
=
pixelmap
.
getPixelBytesNumber
()
let
pixelBytesNumber
=
pixelmap
.
getPixelBytesNumber
();
```
### release<sup>7+</sup>
...
...
@@ -434,8 +444,13 @@ release():Promise\<void>
**示例:**
```
js
pixelmap
.
release
().
then
(()
=>
{
})
.
catch
(
error
=>
{})
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
pixelmap
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
})
```
### release<sup>7+</sup>
...
...
@@ -455,7 +470,13 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
pixelmap
.
release
(()
=>
{
})
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
pixelmap
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
})
```
## image.createImageSource
...
...
@@ -508,7 +529,7 @@ createImageSource(fd: number): ImageSource
**示例:**
```
js
const
imageSourceApi
=
image
.
createImageSource
(
0
)
const
imageSourceApi
=
image
.
createImageSource
(
0
)
;
```
## ImageSource
...
...
@@ -541,7 +562,13 @@ getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void
**示例:**
```
js
imageSourceApi
.
getImageInfo
(
0
,(
error
,
imageInfo
)
=>
{})
imageSourceApi
.
getImageInfo
(
0
,(
error
,
imageInfo
)
=>
{
if
(
error
)
{
console
.
log
(
'
getImageInfo failed.
'
);
}
else
{
console
.
log
(
'
getImageInfo succeeded.
'
);
}
})
```
### getImageInfo
...
...
@@ -561,7 +588,11 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:**
```
js
imageSourceApi
.
getImageInfo
(
imageInfo
=>
{})
imageSourceApi
.
getImageInfo
(
imageInfo
=>
{
console
.
log
(
'
getImageInfo succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
getImageInfo failed.
'
);
})
```
### getImageInfo
...
...
@@ -588,8 +619,12 @@ getImageInfo(index?: number): Promise\<ImageInfo>
```
js
imageSourceApi
.
getImageInfo
(
0
)
.
then
(
imageInfo
=>
{})
.
catch
(
error
=>
{})
.
then
(
imageInfo
=>
{
console
.
log
(
'
getImageInfo succeeded.
'
);
})
.
catch
(
error
=>
{
console
.
log
(
'
getImageInfo failed.
'
);
})
```
### getImageProperty<sup>7+</sup>
...
...
@@ -617,8 +652,12 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
)
.
then
(
data
=>
{})
.
catch
(
error
=>
{})
.
then
(
data
=>
{
console
.
log
(
'
getImageProperty succeeded.
'
);
})
.
catch
(
error
=>
{
console
.
log
(
'
getImageProperty failed.
'
);
})
```
### getImageProperty<sup>7+</sup>
...
...
@@ -639,7 +678,13 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
**示例:**
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,(
error
,
data
)
=>
{})
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
'
getImageProperty failed.
'
);
}
else
{
console
.
log
(
'
getImageProperty succeeded.
'
);
}
})
```
### getImageProperty<sup>7+</sup>
...
...
@@ -661,7 +706,13 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
**示例:**
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,
property
,(
error
,
data
)
=>
{})
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,
Property
,(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
'
getImageProperty failed.
'
);
}
else
{
console
.
log
(
'
getImageProperty succeeded.
'
);
}
})
```
### createPixelMap<sup>7+</sup>
...
...
@@ -687,8 +738,11 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
**示例:**
```
js
imageSourceApi
.
createPixelMap
().
then
(
pixelmap
=>
{})
.
catch
(
error
=>
{})
imageSourceApi
.
createPixelMap
().
then
(
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
createPixelMap failed.
'
);
})
```
### createPixelMap<sup>7+</sup>
...
...
@@ -708,7 +762,11 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
**示例:**
```
js
imageSourceApi
.
createPixelMap
(
pixelmap
=>
{})
imageSourceApi
.
createPixelMap
(
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
createPixelMap failed.
'
);
})
```
### createPixelMap<sup>7+</sup>
...
...
@@ -729,7 +787,11 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
**示例:**
```
js
imageSourceApi
.
createPixelMap
(
decodingOptions
,
pixelmap
=>
{})
imageSourceApi
.
createPixelMap
(
decodingOptions
,
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
createPixelMap failed.
'
);
})
```
### release
...
...
@@ -749,7 +811,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
imageSourceApi
.
release
(()
=>
{})
imageSourceApi
.
release
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
### release
...
...
@@ -769,7 +835,11 @@ release(): Promise\<void>
**示例:**
```
js
imageSourceApi
.
release
().
then
(()
=>
{
}).
catch
(
error
=>
{})
imageSourceApi
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
## image.createImagePacker
...
...
@@ -823,8 +893,8 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
**示例:**
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
imagePackerApi
.
packing
(
i
mageSourceApi
,
packOpts
,
data
=>
{})
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
;
imagePackerApi
.
packing
(
I
mageSourceApi
,
packOpts
,
data
=>
{})
```
### packing
...
...
@@ -852,9 +922,12 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
})
.
catch
(
error
=>
{})
imagePackerApi
.
packing
(
ImageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
log
(
'
packing succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
packing failed.
'
);
})
```
### packing<sup>8+</sup>
...
...
@@ -877,7 +950,11 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
imagePackerApi
.
packing
(
pixelMapApi
,
packOpts
,
data
=>
{})
imagePackerApi
.
packing
(
PixelMapApi
,
packOpts
,
data
=>
{
console
.
log
(
'
packing succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
packing failed.
'
);
})
```
### packing<sup>8+</sup>
...
...
@@ -905,9 +982,12 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
imagePackerApi
.
packing
(
pixelMapApi
,
packOpts
)
.
then
(
data
=>
{
})
.
catch
(
error
=>
{})
imagePackerApi
.
packing
(
PixelMapApi
,
packOpts
)
.
then
(
data
=>
{
console
.
log
(
'
packing succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
packing failed.
'
);
})
```
### release
...
...
@@ -927,7 +1007,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
imagePackerApi
.
release
(()
=>
{})
imagePackerApi
.
release
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
### release
...
...
@@ -947,8 +1031,11 @@ release(): Promise\<void>
**示例:**
```
js
imagePackerApi
.
release
().
then
(()
=>
{
}).
catch
((
error
)
=>
{})
imagePackerApi
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
((
error
)
=>
{
console
.
log
(
'
release failed.
'
);
})
```
## image.createImageReceiver<sup>9+</sup>
...
...
@@ -977,7 +1064,7 @@ createImageReceiver(width: number, height: number, format: number, capacity: num
**示例:**
```
js
var
receiver
=
image
.
createImageReceiver
(
8192
,
8
,
4
,
8
)
var
receiver
=
image
.
createImageReceiver
(
8192
,
8
,
4
,
8
)
;
```
## ImageReceiver<sup>9+</sup>
...
...
@@ -1013,7 +1100,13 @@ getReceivingSurfaceId(callback: AsyncCallback\<string>): void
**示例:**
```
js
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{});
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{
if
(
err
)
{
console
.
log
(
'
getReceivingSurfaceId failed.
'
);
}
else
{
console
.
log
(
'
getReceivingSurfaceId succeeded.
'
);
}
});
```
### getReceivingSurfaceId<sup>9+</sup>
...
...
@@ -1034,8 +1127,10 @@ getReceivingSurfaceId(): Promise\<string>
```
js
receiver
.
getReceivingSurfaceId
().
then
(
id
=>
{
}).
catch
(
error
=>
{
})
console
.
log
(
'
getReceivingSurfaceId succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
getReceivingSurfaceId failed.
'
);
})
```
### readLatestImage<sup>9+</sup>
...
...
@@ -1055,7 +1150,13 @@ readLatestImage(callback: AsyncCallback\<Image>): void
**示例:**
```
js
receiver
.
readLatestImage
((
err
,
img
)
=>
{
});
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
err
)
{
console
.
log
(
'
readLatestImage failed.
'
);
}
else
{
console
.
log
(
'
readLatestImage succeeded.
'
);
}
});
```
### readLatestImage<sup>9+</sup>
...
...
@@ -1075,8 +1176,11 @@ readLatestImage(): Promise\<Image>
**示例:**
```
js
receiver
.
readLatestImage
().
then
(
img
=>
{})
.
catch
(
error
=>
{})
receiver
.
readLatestImage
().
then
(
img
=>
{
console
.
log
(
'
readLatestImage succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
readLatestImage failed.
'
);
})
```
### readNextImage<sup>9+</sup>
...
...
@@ -1096,7 +1200,13 @@ readNextImage(callback: AsyncCallback\<Image>): void
**示例:**
```
js
receiver
.
readNextImage
((
err
,
img
)
=>
{});
receiver
.
readNextImage
((
err
,
img
)
=>
{
if
(
err
)
{
console
.
log
(
'
readNextImage failed.
'
);
}
else
{
console
.
log
(
'
readNextImage succeeded.
'
);
}
});
```
### readNextImage<sup>9+</sup>
...
...
@@ -1116,9 +1226,11 @@ readNextImage(): Promise\<Image>
**示例:**
```
js
receiver
.
readNextImage
().
then
(
img
=>
{
}).
catch
(
error
=>
{
})
receiver
.
readNextImage
().
then
(
img
=>
{
console
.
log
(
'
readNextImage succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
readNextImage failed.
'
);
})
```
### on('imageArrival')<sup>9+</sup>
...
...
@@ -1139,7 +1251,7 @@ on(type: 'imageArrival', callback: AsyncCallback\<void>): void
**示例:**
```
js
receiver
.
on
(
'
imageArrival
'
,
()
=>
{})
receiver
.
on
(
'
imageArrival
'
,
()
=>
{})
```
### release<sup>9+</sup>
...
...
@@ -1159,7 +1271,7 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
receiver
.
release
(()
=>
{})
receiver
.
release
(()
=>
{})
```
### release<sup>9+</sup>
...
...
@@ -1179,8 +1291,11 @@ release(): Promise\<void>
**示例:**
```
js
receiver
.
release
().
then
(()
=>
{})
.
catch
(
error
=>
{})
receiver
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
## Image<sup>9+</sup>
...
...
@@ -1215,7 +1330,13 @@ getComponent(componentType: ComponentType, callback: AsyncCallback\<Component>):
**示例:**
```
js
img
.
getComponent
(
4
,
(
err
,
component
)
=>
{})
img
.
getComponent
(
4
,
(
err
,
component
)
=>
{
if
(
err
)
{
console
.
log
(
'
getComponent failed.
'
);
}
else
{
console
.
log
(
'
getComponent succeeded.
'
);
}
})
```
### getComponent<sup>9+</sup>
...
...
@@ -1263,7 +1384,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
img
.
release
(()
=>
{
})
img
.
release
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
### release<sup>9+</sup>
...
...
@@ -1286,8 +1411,10 @@ release(): Promise\<void>
```
js
img
.
release
().
then
(()
=>
{
}).
catch
(
error
=>
{
})
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
```
## PositionArea<sup>7+</sup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录