Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
302c479b
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看板
未验证
提交
302c479b
编写于
7月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6560 image文档内容整改
Merge pull request !6560 from 徐蕊w/OpenHarmony-3.1-Release
上级
e0129e0c
11055fd8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
193 addition
and
131 deletion
+193
-131
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+193
-131
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
302c479b
...
@@ -10,11 +10,12 @@ import image from '@ohos.multimedia.image';
...
@@ -10,11 +10,12 @@ import image from '@ohos.multimedia.image';
```
```
## image.createPixelMap<sup>8+</sup>
## image.createPixelMap<sup>8+</sup>
createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise
\<
PixelMap>
createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise
\<
PixelMap>
通过属性创建PixelMap,通过Promise返回结果。
通过属性创建PixelMap,通过Promise返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -33,6 +34,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
...
@@ -33,6 +34,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
)
.
then
((
pixelmap
)
=>
{
.
then
((
pixelmap
)
=>
{
...
@@ -45,7 +47,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
...
@@ -45,7 +47,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
通过属性创建PixelMap,通过回调函数返回结果。
通过属性创建PixelMap,通过回调函数返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -59,6 +61,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
...
@@ -59,6 +61,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
})
})
...
@@ -70,7 +73,7 @@ image.createPixelMap(color, opts, (pixelmap) => {
...
@@ -70,7 +73,7 @@ image.createPixelMap(color, opts, (pixelmap) => {
### 属性
### 属性
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------------------- | ------- | ---- | ---- | -------------------------- |
| ----------------------- | ------- | ---- | ---- | -------------------------- |
...
@@ -82,7 +85,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
...
@@ -82,7 +85,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
读取图像像素数据,结果写入ArrayBuffer里,使用Promise形式返回。
读取图像像素数据,结果写入ArrayBuffer里,使用Promise形式返回。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -99,10 +102,11 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
...
@@ -99,10 +102,11 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:**
**示例:**
```
js
```
js
pixelmap
.
readPixelsToBuffer
(
ReadBuffer
).
then
(()
=>
{
const
readBuffer
=
new
ArrayBuffer
(
400
);
console
.
log
(
'
readPixelsToBuffer succeeded.
'
);
//符合条件则进入
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
console
.
log
(
'
Succeeded in reading image pixel data.
'
);
//符合条件则进入
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
readPixelsToBuffer failed
.
'
);
//不符合条件则进入
console
.
log
(
'
Failed to read image pixel data
.
'
);
//不符合条件则进入
})
})
```
```
...
@@ -112,7 +116,7 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -112,7 +116,7 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
读取图像像素数据,结果写入ArrayBuffer里,使用callback形式返回。
读取图像像素数据,结果写入ArrayBuffer里,使用callback形式返回。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -124,11 +128,12 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -124,11 +128,12 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
**示例:**
```
js
```
js
pixelmap
.
readPixelsToBuffer
(
ReadBuffer
,
(
err
,
res
)
=>
{
const
readBuffer
=
new
ArrayBuffer
(
400
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
(
err
,
res
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
readPixelsToBuffer failed
.
'
);
//不符合条件则进入
console
.
log
(
'
Failed to read image pixel data
.
'
);
//不符合条件则进入
}
else
{
}
else
{
console
.
log
(
'
readPixelsToBuffer succeeded
.
'
);
//符合条件则进入
console
.
log
(
'
Succeeded in reading image pixel data
.
'
);
//符合条件则进入
}
}
})
})
```
```
...
@@ -139,7 +144,7 @@ readPixels(area: PositionArea): Promise\<void>
...
@@ -139,7 +144,7 @@ readPixels(area: PositionArea): Promise\<void>
读取区域内的图片数据,使用Promise形式返回读取结果。
读取区域内的图片数据,使用Promise形式返回读取结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -156,10 +161,11 @@ readPixels(area: PositionArea): Promise\<void>
...
@@ -156,10 +161,11 @@ readPixels(area: PositionArea): Promise\<void>
**示例:**
**示例:**
```
js
```
js
pixelmap
.
readPixels
(
Area
).
then
((
data
)
=>
{
const
area
=
new
ArrayBuffer
(
400
);
console
.
log
(
'
readPixels succeeded.
'
);
//符合条件则进入
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
log
(
'
Succeeded in reading the image data in the area.
'
);
//符合条件则进入
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
readPixels failed
.
'
);
//不符合条件则进入
console
.
log
(
'
Failed to read the image data in the area
.
'
);
//不符合条件则进入
})
})
```
```
...
@@ -169,7 +175,7 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
...
@@ -169,7 +175,7 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
读取区域内的图片数据,使用callback形式返回读取结果。
读取区域内的图片数据,使用callback形式返回读取结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -181,6 +187,8 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
...
@@ -181,6 +187,8 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
**示例:**
**示例:**
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
){
if
(
pixelmap
==
undefined
){
...
@@ -203,7 +211,7 @@ writePixels(area: PositionArea): Promise\<void>
...
@@ -203,7 +211,7 @@ writePixels(area: PositionArea): Promise\<void>
将PixelMap写入指定区域内,使用Promise形式返回写入结果。
将PixelMap写入指定区域内,使用Promise形式返回写入结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -221,6 +229,7 @@ writePixels(area: PositionArea): Promise\<void>
...
@@ -221,6 +229,7 @@ writePixels(area: PositionArea): Promise\<void>
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
.
then
(
pixelmap
=>
{
...
@@ -256,21 +265,22 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
...
@@ -256,21 +265,22 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
将PixelMap写入指定区域内,使用callback形式返回写入结果。
将PixelMap写入指定区域内,使用callback形式返回写入结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------ | ---- | ------------------------------ |
| --------- | ------------------------------ | ---- | ------------------------------ |
| area |
[
PositionArea
](
#positionarea7
)
| 是 | 区域,根据区域写入。 |
| area |
[
PositionArea
](
#positionarea7
)
| 是 | 区域,根据区域写入。 |
| callback: | AsyncCallback
\<
void> | 是 | 获取回调,失败时
error会
返回错误信息。 |
| callback: | AsyncCallback
\<
void> | 是 | 获取回调,失败时返回错误信息。 |
**示例:**
**示例:**
```
js
```
js
pixelmap
.
writePixels
(
Area
,
(
error
)
=>
{
const
area
=
new
ArrayBuffer
(
400
);
pixelmap
.
writePixels
(
area
,
(
error
)
=>
{
if
(
error
!=
undefined
)
{
if
(
error
!=
undefined
)
{
console
.
info
(
'
writePixels failed
.
'
);
console
.
info
(
'
Failed to write pixelmap into the specified area
.
'
);
}
else
{
}
else
{
const
readArea
=
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
20
),
pixels
:
new
ArrayBuffer
(
20
),
...
@@ -288,7 +298,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
...
@@ -288,7 +298,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
读取缓冲区中的图片数据,结果写入PixelMap中,使用Promise形式返回。
读取缓冲区中的图片数据,结果写入PixelMap中,使用Promise形式返回。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -305,7 +315,10 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
...
@@ -305,7 +315,10 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:**
**示例:**
```
js
```
js
PixelMap
.
writeBufferToPixels
(
color
).
then
(()
=>
{
const
color
=
new
ArrayBuffer
(
96
);
const
pixelMap
=
new
ArrayBuffer
(
400
);
let
bufferArr
=
new
Unit8Array
(
color
);
pixelMap
.
writeBufferToPixels
(
color
).
then
(()
=>
{
console
.
log
(
"
Succeeded in writing data from a buffer to a PixelMap.
"
);
console
.
log
(
"
Succeeded in writing data from a buffer to a PixelMap.
"
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
...
@@ -318,7 +331,7 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -318,7 +331,7 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
读取缓冲区中的图片数据,结果写入PixelMap中,使用callback形式返回。
读取缓冲区中的图片数据,结果写入PixelMap中,使用callback形式返回。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -330,7 +343,10 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -330,7 +343,10 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
**示例:**
```
js
```
js
PixelMap
.
writeBufferToPixels
(
color
,
function
(
err
)
{
const
color
=
new
ArrayBuffer
(
96
);
\
const
pixelMap
=
new
ArrayBuffer
(
400
);
let
bufferArr
=
new
Unit8Array
(
color
);
pixelMap
.
writeBufferToPixels
(
color
,
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
console
.
error
(
"
Failed to write data from a buffer to a PixelMap.
"
);
return
;
return
;
...
@@ -346,7 +362,7 @@ getImageInfo(): Promise\<ImageInfo>
...
@@ -346,7 +362,7 @@ getImageInfo(): Promise\<ImageInfo>
获取图像像素信息,使用Promise形式返回获取的图像像素信息。
获取图像像素信息,使用Promise形式返回获取的图像像素信息。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**返回值:**
**返回值:**
...
@@ -357,7 +373,8 @@ getImageInfo(): Promise\<ImageInfo>
...
@@ -357,7 +373,8 @@ getImageInfo(): Promise\<ImageInfo>
**示例:**
**示例:**
```
js
```
js
PixelMap
.
getImageInfo
().
then
(
function
(
info
)
{
const
pixelMap
=
new
ArrayBuffer
(
400
);
pixelMap
.
getImageInfo
().
then
(
function
(
info
)
{
console
.
log
(
"
Succeeded in obtaining the image pixel map information.
"
);
console
.
log
(
"
Succeeded in obtaining the image pixel map information.
"
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
"
Failed to obtain the image pixel map information.
"
);
console
.
error
(
"
Failed to obtain the image pixel map information.
"
);
...
@@ -370,7 +387,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -370,7 +387,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
获取图像像素信息,使用callback形式返回获取的图像像素信息。
获取图像像素信息,使用callback形式返回获取的图像像素信息。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -382,9 +399,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -382,9 +399,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
```
js
```
js
pixelmap
.
getImageInfo
((
imageInfo
)
=>
{
pixelmap
.
getImageInfo
((
imageInfo
)
=>
{
console
.
log
(
"
getImageInfo succeeded.
"
);
console
.
log
(
"
Succeeded in obtaining the image pixel map information..
"
);
}).
catch
((
err
)
=>
{
console
.
error
(
"
getImageInfo failed.
"
);
})
})
```
```
...
@@ -394,7 +409,7 @@ getBytesNumberPerRow(): number
...
@@ -394,7 +409,7 @@ getBytesNumberPerRow(): number
获取图像像素每行字节数。
获取图像像素每行字节数。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**返回值:**
**返回值:**
...
@@ -405,7 +420,10 @@ getBytesNumberPerRow(): number
...
@@ -405,7 +420,10 @@ getBytesNumberPerRow(): number
**示例:**
**示例:**
```
js
```
js
image
.
createPixelMap
(
clolr
,
opts
,
(
err
,
pixelmap
)
=>
{
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
let
rowCount
=
pixelmap
.
getBytesNumberPerRow
();
let
rowCount
=
pixelmap
.
getBytesNumberPerRow
();
})
})
```
```
...
@@ -416,7 +434,7 @@ getPixelBytesNumber(): number
...
@@ -416,7 +434,7 @@ getPixelBytesNumber(): number
获取图像像素的总字节数。
获取图像像素的总字节数。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**返回值:**
**返回值:**
...
@@ -436,7 +454,7 @@ release():Promise\<void>
...
@@ -436,7 +454,7 @@ release():Promise\<void>
释放PixelMap对象,使用Promise形式返回释放结果。
释放PixelMap对象,使用Promise形式返回释放结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**返回值:**
**返回值:**
...
@@ -447,11 +465,14 @@ release():Promise\<void>
...
@@ -447,11 +465,14 @@ release():Promise\<void>
**示例:**
**示例:**
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
pixelmap
.
release
().
then
(()
=>
{
pixelmap
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded
.
'
);
console
.
log
(
'
Succeeded in releasing pixelmap object
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
release failed
.
'
);
console
.
log
(
'
Failed to release pixelmap object
.
'
);
})
})
})
})
```
```
...
@@ -462,7 +483,7 @@ release(callback: AsyncCallback\<void>): void
...
@@ -462,7 +483,7 @@ release(callback: AsyncCallback\<void>): void
释放PixelMap对象,使用callback形式返回释放结果。
释放PixelMap对象,使用callback形式返回释放结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.Core
**参数:**
**参数:**
...
@@ -473,11 +494,14 @@ release(callback: AsyncCallback\<void>): void
...
@@ -473,11 +494,14 @@ release(callback: AsyncCallback\<void>): void
**示例:**
**示例:**
```
js
```
js
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Unit8Array
(
color
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
image
.
createPixelMap
(
color
,
opts
,
(
pixelmap
)
=>
{
pixelmap
.
release
().
then
(()
=>
{
pixelmap
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded
.
'
);
console
.
log
(
'
Succeeded in releasing pixelmap object
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
release failed
.
'
);
console
.
log
(
'
Failed to release pixelmap object
.
'
);
})
})
})
})
```
```
...
@@ -488,7 +512,7 @@ createImageSource(uri: string): ImageSource
...
@@ -488,7 +512,7 @@ createImageSource(uri: string): ImageSource
通过传入的uri创建图片源实例。
通过传入的uri创建图片源实例。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -515,13 +539,13 @@ createImageSource(fd: number): ImageSource
...
@@ -515,13 +539,13 @@ createImageSource(fd: number): ImageSource
通过传入文件描述符来创建图片源实例。
通过传入文件描述符来创建图片源实例。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明
|
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------
-
|
| ------ | ------ | ---- | ------------- |
| fd | number | 是 | 文件描述符fd。
|
| fd | number | 是 | 文件描述符fd。|
**返回值:**
**返回值:**
...
@@ -532,7 +556,7 @@ createImageSource(fd: number): ImageSource
...
@@ -532,7 +556,7 @@ createImageSource(fd: number): ImageSource
**示例:**
**示例:**
```
js
```
js
const
imageSourceApi
=
image
.
createImageSource
(
0
)
;
const
imageSourceApi
=
image
.
createImageSource
(
0
)
```
```
## ImageSource
## ImageSource
...
@@ -541,7 +565,7 @@ const imageSourceApi = image.createImageSource(0);
...
@@ -541,7 +565,7 @@ const imageSourceApi = image.createImageSource(0);
### 属性
### 属性
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
...
@@ -553,7 +577,7 @@ getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void
...
@@ -553,7 +577,7 @@ getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void
获取指定序号的图片信息,使用callback形式返回图片信息。
获取指定序号的图片信息,使用callback形式返回图片信息。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -580,7 +604,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -580,7 +604,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
获取图片信息,使用callback形式返回图片信息。
获取图片信息,使用callback形式返回图片信息。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -592,9 +616,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -592,9 +616,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
```
js
```
js
imageSourceApi
.
getImageInfo
(
imageInfo
=>
{
imageSourceApi
.
getImageInfo
(
imageInfo
=>
{
console
.
log
(
'
getImageInfo succeeded.
'
);
console
.
log
(
'
Succeeded in obtaining the image information.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
getImageInfo failed.
'
);
})
})
```
```
...
@@ -604,7 +626,7 @@ getImageInfo(index?: number): Promise\<ImageInfo>
...
@@ -604,7 +626,7 @@ getImageInfo(index?: number): Promise\<ImageInfo>
获取图片信息,使用Promise形式返回图片信息。
获取图片信息,使用Promise形式返回图片信息。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -623,9 +645,9 @@ getImageInfo(index?: number): Promise\<ImageInfo>
...
@@ -623,9 +645,9 @@ getImageInfo(index?: number): Promise\<ImageInfo>
```
js
```
js
imageSourceApi
.
getImageInfo
(
0
)
imageSourceApi
.
getImageInfo
(
0
)
.
then
(
imageInfo
=>
{
.
then
(
imageInfo
=>
{
console
.
log
(
'
getImageInfo succeeded
.
'
);
console
.
log
(
'
Succeeded in obtaining the image information
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
getImageInfo failed
.
'
);
console
.
log
(
'
Failed to obtain the image information
.
'
);
})
})
```
```
...
@@ -635,7 +657,7 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
...
@@ -635,7 +657,7 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
获取图片中给定索引处图像的指定属性键的值,用Promise形式返回结果。
获取图片中给定索引处图像的指定属性键的值,用Promise形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -655,9 +677,7 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
...
@@ -655,9 +677,7 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
```
js
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
)
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
)
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
log
(
'
getImageProperty succeeded.
'
);
console
.
log
(
'
Succeeded in getting the value of the specified attribute key of the image.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
getImageProperty failed.
'
);
})
})
```
```
...
@@ -667,7 +687,7 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
...
@@ -667,7 +687,7 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
获取图片中给定索引处图像的指定属性键的值,用callback形式返回结果。
获取图片中给定索引处图像的指定属性键的值,用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -681,9 +701,9 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
...
@@ -681,9 +701,9 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
```
js
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,(
error
,
data
)
=>
{
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'
getImageProperty failed
.
'
);
console
.
log
(
'
Failed to get the value of the specified attribute key of the image
.
'
);
}
else
{
}
else
{
console
.
log
(
'
getImageProperty succeeded
.
'
);
console
.
log
(
'
Succeeded in getting the value of the specified attribute key of the image
.
'
);
}
}
})
})
```
```
...
@@ -694,7 +714,7 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
...
@@ -694,7 +714,7 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
获取图片指定属性键的值,callback形式返回结果。
获取图片指定属性键的值,callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -707,11 +727,12 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
...
@@ -707,11 +727,12 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
**示例:**
**示例:**
```
js
```
js
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,
Property
,(
error
,
data
)
=>
{
const
property
=
new
ArrayBuffer
(
400
);
imageSourceApi
.
getImageProperty
(
"
BitsPerSample
"
,
property
,(
error
,
data
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'
getImageProperty failed
.
'
);
console
.
log
(
'
Failed to get the value of the specified attribute key of the image
.
'
);
}
else
{
}
else
{
console
.
log
(
'
getImageProperty succeeded
.
'
);
console
.
log
(
'
Succeeded in getting the value of the specified attribute key of the image
.
'
);
}
}
})
})
```
```
...
@@ -722,7 +743,7 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
...
@@ -722,7 +743,7 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
通过图片解码参数创建PixelMap对象。
通过图片解码参数创建PixelMap对象。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -740,9 +761,9 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
...
@@ -740,9 +761,9 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
```
js
```
js
imageSourceApi
.
createPixelMap
().
then
(
pixelmap
=>
{
imageSourceApi
.
createPixelMap
().
then
(
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded
.
'
);
console
.
log
(
'
Succeeded in creating pixelmap object through image decoding parameters
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
createPixelMap failed
.
'
);
console
.
log
(
'
Failed to create pixelmap object through image decoding parameters
.
'
);
})
})
```
```
...
@@ -752,7 +773,7 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
...
@@ -752,7 +773,7 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
通过默认参数创建PixelMap对象,使用callback形式返回结果。
通过默认参数创建PixelMap对象,使用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -764,9 +785,9 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
...
@@ -764,9 +785,9 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
```
js
```
js
imageSourceApi
.
createPixelMap
(
pixelmap
=>
{
imageSourceApi
.
createPixelMap
(
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded
.
'
);
console
.
log
(
'
Succeeded in creating pixelmap object
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
createPixelMap failed
.
'
);
console
.
log
(
'
Failed to create pixelmap object
.
'
);
})
})
```
```
...
@@ -776,7 +797,7 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
...
@@ -776,7 +797,7 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
通过图片解码参数创建PixelMap对象。
通过图片解码参数创建PixelMap对象。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -788,11 +809,10 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
...
@@ -788,11 +809,10 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
**示例:**
**示例:**
```
js
```
js
const
decodingOptions
=
new
ArrayBuffer
(
400
);
imageSourceApi
.
createPixelMap
(
decodingOptions
,
pixelmap
=>
{
imageSourceApi
.
createPixelMap
(
decodingOptions
,
pixelmap
=>
{
console
.
log
(
'
createPixelMap succeeded.
'
);
console
.
log
(
'
Succeeded in creating pixelmap object.
'
);
}).
catch
(
error
=>
{
})
console
.
log
(
'
createPixelMap failed.
'
);
})
```
```
### release
### release
...
@@ -801,7 +821,7 @@ release(callback: AsyncCallback\<void>): void
...
@@ -801,7 +821,7 @@ release(callback: AsyncCallback\<void>): void
释放图片源实例,使用callback形式返回结果。
释放图片源实例,使用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**参数:**
**参数:**
...
@@ -814,8 +834,6 @@ release(callback: AsyncCallback\<void>): void
...
@@ -814,8 +834,6 @@ release(callback: AsyncCallback\<void>): void
```
js
```
js
imageSourceApi
.
release
(()
=>
{
imageSourceApi
.
release
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
console
.
log
(
'
release succeeded.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
})
```
```
...
@@ -825,7 +843,7 @@ release(): Promise\<void>
...
@@ -825,7 +843,7 @@ release(): Promise\<void>
释放图片源实例,使用Promise形式返回结果。
释放图片源实例,使用Promise形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageSource
**返回值:**
**返回值:**
...
@@ -837,9 +855,9 @@ release(): Promise\<void>
...
@@ -837,9 +855,9 @@ release(): Promise\<void>
```
js
```
js
imageSourceApi
.
release
().
then
(()
=>
{
imageSourceApi
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded
.
'
);
console
.
log
(
'
Succeeded in releasing the image source instance
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
release failed
.
'
);
console
.
log
(
'
Failed to release the image source instance
.
'
);
})
})
```
```
...
@@ -849,7 +867,7 @@ createImagePacker(): ImagePacker
...
@@ -849,7 +867,7 @@ createImagePacker(): ImagePacker
创建ImagePacker实例。
创建ImagePacker实例。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImageReceiver
**返回值:**
**返回值:**
...
@@ -869,7 +887,7 @@ const imagePackerApi = image.createImagePacker();
...
@@ -869,7 +887,7 @@ const imagePackerApi = image.createImagePacker();
### 属性
### 属性
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | -------------- | ---- | ---- | -------------------------- |
| ---------------- | -------------- | ---- | ---- | -------------------------- |
...
@@ -881,7 +899,7 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
...
@@ -881,7 +899,7 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
图片压缩或重新打包,使用callback形式返回结果。
图片压缩或重新打包,使用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**参数:**
**参数:**
...
@@ -895,7 +913,8 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
...
@@ -895,7 +913,8 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
```
js
```
js
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
98
};
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
98
};
imagePackerApi
.
packing
(
ImageSourceApi
,
packOpts
,
data
=>
{})
const
imageSourceApi
=
new
ArrayBuffer
(
400
);
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
data
=>
{})
```
```
### packing
### packing
...
@@ -904,7 +923,7 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -904,7 +923,7 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
图片压缩或重新打包,使用Promise形式返回结果。
图片压缩或重新打包,使用Promise形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**参数:**
**参数:**
...
@@ -922,8 +941,9 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -922,8 +941,9 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
**示例:**
**示例:**
```
js
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
98
}
imagePackerApi
.
packing
(
ImageSourceApi
,
packOpts
)
const
imageSourceApi
=
new
ArrayBuffer
(
400
);
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
log
(
'
packing succeeded.
'
);
console
.
log
(
'
packing succeeded.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
@@ -937,7 +957,7 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
...
@@ -937,7 +957,7 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
图片压缩或重新打包,使用callback形式返回结果。
图片压缩或重新打包,使用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**参数:**
**参数:**
...
@@ -950,11 +970,12 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
...
@@ -950,11 +970,12 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
**示例:**
**示例:**
```
js
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
98
}
imagePackerApi
.
packing
(
PixelMapApi
,
packOpts
,
data
=>
{
const
pixelMapApi
=
new
ArrayBuffer
(
400
);
console
.
log
(
'
packing succeeded.
'
);
imagePackerApi
.
packing
(
pixelMapApi
,
packOpts
,
data
=>
{
console
.
log
(
'
Succeeded in packing the image.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
packing failed
.
'
);
console
.
log
(
'
Failed to pack the image
.
'
);
})
})
```
```
...
@@ -964,7 +985,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -964,7 +985,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
图片压缩或重新打包,使用Promise形式返回结果。
图片压缩或重新打包,使用Promise形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**参数:**
**参数:**
...
@@ -982,12 +1003,13 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -982,12 +1003,13 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
**示例:**
**示例:**
```
js
```
js
let
packOpts
=
{
format
:[
"
image/jpeg
"
],
quality
:
98
}
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
98
}
imagePackerApi
.
packing
(
PixelMapApi
,
packOpts
)
const
pixelMapApi
=
new
ArrayBuffer
(
400
);
imagePackerApi
.
packing
(
pixelMapApi
,
packOpts
)
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
log
(
'
packing succeeded
.
'
);
console
.
log
(
'
Succeeded in packing the image
.
'
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
packing failed
.
'
);
console
.
log
(
'
Failed to pack the image.
.
'
);
})
})
```
```
...
@@ -997,7 +1019,7 @@ release(callback: AsyncCallback\<void>): void
...
@@ -997,7 +1019,7 @@ release(callback: AsyncCallback\<void>): void
释放图片打包实例,使用callback形式返回结果。
释放图片打包实例,使用callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**参数:**
**参数:**
...
@@ -1009,9 +1031,7 @@ release(callback: AsyncCallback\<void>): void
...
@@ -1009,9 +1031,7 @@ release(callback: AsyncCallback\<void>): void
```
js
```
js
imagePackerApi
.
release
(()
=>
{
imagePackerApi
.
release
(()
=>
{
console
.
log
(
'
release succeeded.
'
);
console
.
log
(
'
Succeeded in releasing image packaging.
'
);
}).
catch
(
error
=>
{
console
.
log
(
'
release failed.
'
);
})
})
```
```
...
@@ -1021,7 +1041,7 @@ release(): Promise\<void>
...
@@ -1021,7 +1041,7 @@ release(): Promise\<void>
释放图片打包实例,使用Promise形式返回释放结果。
释放图片打包实例,使用Promise形式返回释放结果。
**系统能力:**
SystemCapability.Multimedia.Image
**系统能力:**
SystemCapability.Multimedia.Image
.ImagePacker
**返回值:**
**返回值:**
...
@@ -1033,9 +1053,9 @@ release(): Promise\<void>
...
@@ -1033,9 +1053,9 @@ release(): Promise\<void>
```
js
```
js
imagePackerApi
.
release
().
then
(()
=>
{
imagePackerApi
.
release
().
then
(()
=>
{
console
.
log
(
'
release succeeded
.
'
);
console
.
log
(
'
Succeeded in releasing image packaging
.
'
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
'
release failed
.
'
);
console
.
log
(
'
Failed to release image packaging
.
'
);
})
})
```
```
...
@@ -1101,7 +1121,7 @@ getReceivingSurfaceId(callback: AsyncCallback\<string>): void
...
@@ -1101,7 +1121,7 @@ getReceivingSurfaceId(callback: AsyncCallback\<string>): void
**示例:**
**示例:**
```
js
```
js
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{
receiver
.
getReceivingSurfaceId
((
err
,
id
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
getReceivingSurfaceId failed.
'
);
console
.
log
(
'
getReceivingSurfaceId failed.
'
);
}
else
{
}
else
{
...
@@ -1422,7 +1442,7 @@ img.release().then(() =>{
...
@@ -1422,7 +1442,7 @@ img.release().then(() =>{
表示图片指定区域内的数据。
表示图片指定区域内的数据。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ |
| ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ |
...
@@ -1435,7 +1455,7 @@ img.release().then(() =>{
...
@@ -1435,7 +1455,7 @@ img.release().then(() =>{
表示图片信息。
表示图片信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------- | ---- | ---- | ---------- |
| ---- | ------------- | ---- | ---- | ---------- |
...
@@ -1445,7 +1465,7 @@ img.release().then(() =>{
...
@@ -1445,7 +1465,7 @@ img.release().then(() =>{
表示图片尺寸。
表示图片尺寸。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ---- | ---- | -------------- |
| ------ | ------ | ---- | ---- | -------------- |
...
@@ -1456,7 +1476,7 @@ img.release().then(() =>{
...
@@ -1456,7 +1476,7 @@ img.release().then(() =>{
枚举,图片像素格式。
枚举,图片像素格式。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| --------- | ------ | ----------------- |
| --------- | ------ | ----------------- |
...
@@ -1468,7 +1488,7 @@ img.release().then(() =>{
...
@@ -1468,7 +1488,7 @@ img.release().then(() =>{
枚举,图像的透明度类型。
枚举,图像的透明度类型。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| -------- | ------ | ----------------------- |
| -------- | ------ | ----------------------- |
...
@@ -1481,7 +1501,7 @@ img.release().then(() =>{
...
@@ -1481,7 +1501,7 @@ img.release().then(() =>{
枚举,图像的缩放模式。
枚举,图像的缩放模式。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 默认值 | 描述 |
| 名称 | 默认值 | 描述 |
| --------------- | ------ | -------------------------------------------------- |
| --------------- | ------ | -------------------------------------------------- |
...
@@ -1492,7 +1512,7 @@ img.release().then(() =>{
...
@@ -1492,7 +1512,7 @@ img.release().then(() =>{
PixelMap的初始化选项。
PixelMap的初始化选项。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Code
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------------- | ---------------------------------- | ---- | ---- | -------------- |
| ---------------------- | ---------------------------------- | ---- | ---- | -------------- |
...
@@ -1506,7 +1526,7 @@ PixelMap的初始化选项。
...
@@ -1506,7 +1526,7 @@ PixelMap的初始化选项。
图像解码设置选项。
图像解码设置选项。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.ImageSource
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------ | ---------------------------------- | ---- | ---- | ---------------- |
| ------------------ | ---------------------------------- | ---- | ---- | ---------------- |
...
@@ -1516,13 +1536,13 @@ PixelMap的初始化选项。
...
@@ -1516,13 +1536,13 @@ PixelMap的初始化选项。
| desiredSize |
[
Size
](
#size
)
| 是 | 是 | 期望输出大小。 |
| desiredSize |
[
Size
](
#size
)
| 是 | 是 | 期望输出大小。 |
| desiredRegion |
[
Region
](
#region7
)
| 是 | 是 | 解码区域。 |
| desiredRegion |
[
Region
](
#region7
)
| 是 | 是 | 解码区域。 |
| desiredPixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 解码的像素格式。 |
| desiredPixelFormat |
[
PixelMapFormat
](
#pixelmapformat7
)
| 是 | 是 | 解码的像素格式。 |
| index | number
| 是 | 是 | 解码图片序号
|
| index | number
| 是 | 是 | 解码图片序号。
|
## Region<sup>7+</sup>
## Region<sup>7+</sup>
表示区域信息。
表示区域信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ------------- | ---- | ---- | ------------ |
| ---- | ------------- | ---- | ---- | ------------ |
...
@@ -1534,7 +1554,7 @@ PixelMap的初始化选项。
...
@@ -1534,7 +1554,7 @@ PixelMap的初始化选项。
表示图片打包选项。
表示图片打包选项。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.ImagePacker
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------ | ---- | ---- | -------------- |
| ------- | ------ | ---- | ---- | -------------- |
...
@@ -1545,7 +1565,7 @@ PixelMap的初始化选项。
...
@@ -1545,7 +1565,7 @@ PixelMap的初始化选项。
表示查询图片属性的索引。
表示查询图片属性的索引。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.ImageSource
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------ | ------ | ---- | ---- | ------------ |
| ------------ | ------ | ---- | ---- | ------------ |
...
@@ -1556,18 +1576,18 @@ PixelMap的初始化选项。
...
@@ -1556,18 +1576,18 @@ PixelMap的初始化选项。
枚举,Exif(Exchangeable image file format)图片信息。
枚举,Exif(Exchangeable image file format)图片信息。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Multimedia.Image
.Core
| 名称 | 默认值 | 说明
|
| 名称 | 默认值 | 说明 |
| ----------------- | ----------------- | -------------------
-
|
| ----------------- | ----------------- | ------------------- |
| BITS_PER_SAMPLE | "BitsPerSample" | 每个像素比特数。
|
| BITS_PER_SAMPLE | "BitsPerSample" | 每个像素比特数。 |
| ORIENTATION | "Orientation" | 图片方向。
|
| ORIENTATION | "Orientation" | 图片方向。 |
| IMAGE_LENGTH | "ImageLength" | 图片长度。
|
| IMAGE_LENGTH | "ImageLength" | 图片长度。 |
| IMAGE_WIDTH | "ImageWidth" | 图片宽度。
|
| IMAGE_WIDTH | "ImageWidth" | 图片宽度。 |
| GPS_LATITUDE | "GPSLatitude" | 图片纬度。
|
| GPS_LATITUDE | "GPSLatitude" | 图片纬度。 |
| GPS_LONGITUDE | "GPSLongitude" | 图片经度。
|
| GPS_LONGITUDE | "GPSLongitude" | 图片经度。 |
| 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>9+</sup>
## ImageFormat<sup>9+</sup>
...
@@ -1606,3 +1626,45 @@ PixelMap的初始化选项。
...
@@ -1606,3 +1626,45 @@ PixelMap的初始化选项。
| pixelStride | number | 是 | 否 | 像素间距。 |
| pixelStride | number | 是 | 否 | 像素间距。 |
| byteBuffer | ArrayBuffer | 是 | 否 | 组件缓冲区。 |
| byteBuffer | ArrayBuffer | 是 | 否 | 组件缓冲区。 |
## ResponseCode
编译错误返回的响应码。
| 名称 | 值 | 说明 |
| ----------------------------------- | -------- | --------------------------------------------------- |
| ERR_MEDIA_INVALID_VALUE | -1 | 无效大小。 |
| SUCCESS | 0 | 操作成功。 |
| ERROR | 62980096 | 操作失败。 |
| ERR_IPC | 62980097 | ipc错误。 |
| ERR_SHAMEM_NOT_EXIST | 62980098 | 共享内存错误。 |
| ERR_SHAMEM_DATA_ABNORMAL | 62980099 | 共享内存错误。 |
| ERR_IMAGE_DECODE_ABNORMAL | 62980100 | 图像解码错误。 |
| ERR_IMAGE_DATA_ABNORMAL | 62980101 | 图像输入数据错误。 |
| ERR_IMAGE_MALLOC_ABNORMAL | 62980102 | 图像malloc错误。 |
| ERR_IMAGE_DATA_UNSUPPORT | 62980103 | 不支持图像类型。 |
| ERR_IMAGE_INIT_ABNORMAL | 62980104 | 图像初始化错误。 |
| ERR_IMAGE_GET_DATA_ABNORMAL | 62980105 | 图像获取数据错误。 |
| ERR_IMAGE_TOO_LARGE | 62980106 | 图像数据太大。 |
| ERR_IMAGE_TRANSFORM | 62980107 | 图像转换错误。 |
| ERR_IMAGE_COLOR_CONVERT | 62980108 | 图像颜色转换错误。 |
| ERR_IMAGE_CROP | 62980109 | 裁剪错误。 |
| ERR_IMAGE_SOURCE_DATA | 62980110 | 图像源数据错误。 |
| ERR_IMAGE_SOURCE_DATA_INCOMPLETE | 62980111 | 图像源数据不完整。 |
| ERR_IMAGE_MISMATCHED_FORMAT | 62980112 | 图像格式不匹配。 |
| ERR_IMAGE_UNKNOWN_FORMAT | 62980113 | 图像未知格式。 |
| ERR_IMAGE_SOURCE_UNRESOLVED | 62980114 | 图像源未解析。 |
| ERR_IMAGE_INVALID_PARAMETER | 62980115 | 图像无效参数。 |
| ERR_IMAGE_DECODE_FAILED | 62980116 | 解码失败。 |
| ERR_IMAGE_PLUGIN_REGISTER_FAILED | 62980117 | 注册插件失败。 |
| ERR_IMAGE_PLUGIN_CREATE_FAILED | 62980118 | 创建插件失败。 |
| ERR_IMAGE_ENCODE_FAILED | 62980119 | 图像编码失败。 |
| ERR_IMAGE_ADD_PIXEL_MAP_FAILED | 62980120 | 图像添加像素映射失败。 |
| ERR_IMAGE_HW_DECODE_UNSUPPORT | 62980121 | 不支持图像硬件解码。 |
| ERR_IMAGE_DECODE_HEAD_ABNORMAL | 62980122 | 图像解码头错误。 |
| ERR_IMAGE_DECODE_EXIF_UNSUPPORT | 62980123 | 图像解码exif取消支持。 |
| ERR_IMAGE_PROPERTY_NOT_EXIST | 62980124 | 图像属性不存在;错误代码被媒体占用,图像从150开始。 |
| ERR_IMAGE_READ_PIXELMAP_FAILED | 62980246 | 读取像素地图失败。 |
| ERR_IMAGE_WRITE_PIXELMAP_FAILED | 62980247 | 写入像素映射失败。 |
| ERR_IMAGE_PIXELMAP_NOT_ALLOW_MODIFY | 62980248 | pixelmap不允许修改。 |
| ERR_IMAGE_CONFIG_FAILED | 62980259 | 配置错误。 |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录