Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
4fffd0e4
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看板
提交
4fffd0e4
编写于
7月 05, 2022
作者:
X
xu-rui-w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增接口
Signed-off-by:
N
xu-rui-w
<
xurui101@huawei.com
>
上级
fa2d4b8a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
233 addition
and
66 deletion
+233
-66
zh-cn/application-dev/reference/apis/js-apis-image.md
zh-cn/application-dev/reference/apis/js-apis-image.md
+233
-66
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-image.md
浏览文件 @
4fffd0e4
...
@@ -33,6 +33,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
...
@@ -33,6 +33,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
)
=>
{
...
@@ -59,6 +60,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
...
@@ -59,6 +60,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
)
=>
{
})
})
...
@@ -99,10 +101,11 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
...
@@ -99,10 +101,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
.
'
);
//不符合条件则进入
})
})
```
```
...
@@ -124,11 +127,12 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -124,11 +127,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
.
'
);
//符合条件则进入
}
}
})
})
```
```
...
@@ -156,10 +160,11 @@ readPixels(area: PositionArea): Promise\<void>
...
@@ -156,10 +160,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
.
'
);
//不符合条件则进入
})
})
```
```
...
@@ -181,6 +186,8 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
...
@@ -181,6 +186,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
){
...
@@ -221,6 +228,7 @@ writePixels(area: PositionArea): Promise\<void>
...
@@ -221,6 +228,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
=>
{
...
@@ -263,14 +271,15 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
...
@@ -263,14 +271,15 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------ | ---- | ------------------------------ |
| --------- | ------------------------------ | ---- | ------------------------------ |
| 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
),
...
@@ -305,7 +314,10 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
...
@@ -305,7 +314,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.
"
);
...
@@ -330,7 +342,10 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
...
@@ -330,7 +342,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
;
...
@@ -357,7 +372,8 @@ getImageInfo(): Promise\<ImageInfo>
...
@@ -357,7 +372,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.
"
);
...
@@ -382,9 +398,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -382,9 +398,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.
"
);
})
})
```
```
...
@@ -405,7 +419,10 @@ getBytesNumberPerRow(): number
...
@@ -405,7 +419,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
();
})
})
```
```
...
@@ -447,11 +464,14 @@ release():Promise\<void>
...
@@ -447,11 +464,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
.
'
);
})
})
})
})
```
```
...
@@ -473,11 +493,14 @@ release(callback: AsyncCallback\<void>): void
...
@@ -473,11 +493,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
.
'
);
})
})
})
})
```
```
...
@@ -535,6 +558,34 @@ createImageSource(fd: number): ImageSource
...
@@ -535,6 +558,34 @@ createImageSource(fd: number): ImageSource
const
imageSourceApi
=
image
.
createImageSource
(
0
);
const
imageSourceApi
=
image
.
createImageSource
(
0
);
```
```
## image.createIncrementalSource<sup>7+</sup>
function createIncrementalSource(buf: ArrayBuffer, options: SourceOptions): ImageSource
创建增量图片源。
**系统能力:**
SystemCapability.Multimedia.Image
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------- | ---- | ------------------------------------ |
| buf | ArrayBuffer | 是 | 数组 |
| options |
[
SourceOptions
](
#SourceOptions
)
| 是 | 图片属性,包括图片序号与默认属性值。 |
**返回值:**
| 类型 | 说明 |
| --------------------------- | --------------------------------- |
|
[
ImageSource
](
#imagesource
)
| 返回图片源,失败时返回undefined。 |
**示例:**
```
js
const
buf
=
new
ArrayBuffer
(
96
);
const
imageSourceApi
=
image
.
createIncrementalSource
(
buf
);
```
## ImageSource
## ImageSource
图片源类,用于获取图片相关信息。在调用ImageSource的方法前,需要先通过createImageSource构建一个ImageSource实例。
图片源类,用于获取图片相关信息。在调用ImageSource的方法前,需要先通过createImageSource构建一个ImageSource实例。
...
@@ -592,9 +643,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
...
@@ -592,9 +643,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.
'
);
})
})
```
```
...
@@ -623,9 +672,9 @@ getImageInfo(index?: number): Promise\<ImageInfo>
...
@@ -623,9 +672,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
.
'
);
})
})
```
```
...
@@ -655,9 +704,7 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
...
@@ -655,9 +704,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.
'
);
})
})
```
```
...
@@ -681,9 +728,9 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
...
@@ -681,9 +728,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
.
'
);
}
}
})
})
```
```
...
@@ -707,15 +754,136 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
...
@@ -707,15 +754,136 @@ 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
.
'
);
}
}
})
})
```
```
### modifyImageProperty<sup>7+</sup>
modifyImageProperty(key: string, value: string): Promise
<void>
修改属性的值。
**系统能力:**
SystemCapability.Multimedia.Image
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ |
| key | string | 是 | 图片属性名。 |
| value | string | 是 | 属性值。 |
**返回值:**
| 类型 | 说明 |
| ---------------------- | ------------------------ |
| Promise
<
[
void
](
#void
)
>
| 返回修改后的图片属性值。 |
**示例:**
```
js
imageSourceApi
.
modifyImageProperty
(
"
ImageWidth
"
,
"
abc
"
)
.
then
(()
=>
{
const
w
=
imageSourceApi
.
getImageProperty
(
"
ImageWidth
"
)
console
.
info
(
'
w
'
,
w
);
expect
(
w
==
'
abc
'
).
assertTrue
();
done
();
})
```
### modifyImageProperty<sup>7+</sup>
modifyImageProperty(key: string, value: string, callback: AsyncCallback
<void>
): void
修改属性的值,callback形式返回结果。
**系统能力:**
SystemCapability.Multimedia.Image
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | ------------------------------ |
| key | string | 是 | 图片属性名。 |
| value | string | 是 | 属性值。 |
| callback | AsyncCallback
<void>
| 是 | 修改属性值,callback返回结果。 |
**示例:**
```
js
imageSourceApi
.
modifyImageProperty
(
"
ImageWidth
"
,
"
abc
"
,()
=>
{})
```
### updateData<sup>7+</sup>
updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number): Promise
<void>
更新增量数据。
**系统能力:**
SystemCapability.Multimedia.Image
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ---------- | ----------- | ---- | ------------ |
| buf | ArrayBuffer | 是 | 增量数据。 |
| isFinished | boolean | 是 | 是否更新完。 |
| value | number | 否 | 偏移量。 |
| length | number | 否 | 数组长。 |
**返回值:**
| 类型 | 说明 |
| ---------------------- | ---------------------- |
| Promise
<
[
void
](
#void
)
>
| 返回更新后的增量数据。 |
**示例:**
```
js
const
array
=
new
ArrayBuffer
(
100
);
imageSourceIncrementalSApi
.
updateData
(
array
,
false
,
0
,
10
).
then
(
data
=>
{
expect
(
data
).
assertTrue
();
console
.
info
(
'
Succeeded in updating data.
'
);
done
();
})
```
### updateData<sup>7+</sup>
updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback
<void>
): void
更新增量数据。
**系统能力:**
SystemCapability.Multimedia.Image
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ---------- | ------------------- | ---- | -------------------- |
| buf | ArrayBuffer | 是 | 增量数据。 |
| isFinished | boolean | 是 | 是否更新完。 |
| value | number | 否 | 偏移量。 |
| length | number | 否 | 数组长。 |
| callback | AsyncCallback
<void>
| 是 | 回调表示成功或失败。 |
**示例:**
```
js
const
array
=
new
ArrayBuffer
(
100
);
imageSourceIncrementalSApi
.
updateData
(
array
,
false
,
0
,
10
,(
error
,
data
)
=>
{
if
(
data
!==
undefined
){
expect
(
data
).
assertTrue
();
console
.
info
(
'
TC_053-1 success
'
);
done
();
}
```
### createPixelMap<sup>7+</sup>
### createPixelMap<sup>7+</sup>
createPixelMap(options?: DecodingOptions): Promise
\<
PixelMap>
createPixelMap(options?: DecodingOptions): Promise
\<
PixelMap>
...
@@ -740,9 +908,9 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
...
@@ -740,9 +908,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
.
'
);
})
})
```
```
...
@@ -764,9 +932,9 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
...
@@ -764,9 +932,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
.
'
);
})
})
```
```
...
@@ -788,10 +956,9 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
...
@@ -788,10 +956,9 @@ 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.
'
);
})
})
```
```
...
@@ -814,8 +981,6 @@ release(callback: AsyncCallback\<void>): void
...
@@ -814,8 +981,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.
'
);
})
})
```
```
...
@@ -837,9 +1002,9 @@ release(): Promise\<void>
...
@@ -837,9 +1002,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
.
'
);
})
})
```
```
...
@@ -895,7 +1060,8 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
...
@@ -895,7 +1060,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
...
@@ -922,8 +1088,9 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -922,8 +1088,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
=>
{
...
@@ -950,11 +1117,12 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
...
@@ -950,11 +1117,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
.
'
);
})
})
```
```
...
@@ -982,12 +1150,13 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
...
@@ -982,12 +1150,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.
.
'
);
})
})
```
```
...
@@ -1009,9 +1178,7 @@ release(callback: AsyncCallback\<void>): void
...
@@ -1009,9 +1178,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.
'
);
})
})
```
```
...
@@ -1033,9 +1200,9 @@ release(): Promise\<void>
...
@@ -1033,9 +1200,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 +1268,7 @@ getReceivingSurfaceId(callback: AsyncCallback\<string>): void
...
@@ -1101,7 +1268,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
{
...
@@ -1516,7 +1683,7 @@ PixelMap的初始化选项。
...
@@ -1516,7 +1683,7 @@ 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>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录