未验证 提交 3be2d32d 编写于 作者: 冯泽悟 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-image.md.

Signed-off-by: N冯泽悟 <fengzewu@huawei.com>
上级 89b4e7cd
......@@ -2128,9 +2128,8 @@ queueImage(interface: Image, callback: AsyncCallback\<void>): void
```js
creator.dequeueImage().then(img => {
const JPEG = 4;
var component = await img.getComponent(JPEG);
//绘制图片
img.getComponent(4).then(component => {
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
......@@ -2138,6 +2137,7 @@ creator.dequeueImage().then(img => {
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
})
creator.queueImage(img, (err) => {
if (err) {
console.info('queueImage failed: ' + err);
......@@ -2172,9 +2172,8 @@ queueImage(interface: Image): Promise\<void>
```js
creator.dequeueImage().then(img => {
const JPEG = 4;
var component = await img.getComponent(JPEG);
//绘制图片
img.getComponent(4).then(component => {
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
......@@ -2182,6 +2181,7 @@ creator.dequeueImage().then(img => {
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
})
creator.queueImage(img).then(() => {
console.info('queueImage succeeded.');
}).catch(error => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册