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

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

Signed-off-by: N冯泽悟 <fengzewu@huawei.com>
上级 89b4e7cd
......@@ -2128,16 +2128,16 @@ queueImage(interface: Image, callback: AsyncCallback\<void>): void
```js
creator.dequeueImage().then(img => {
const JPEG = 4;
var component = await img.getComponent(JPEG);
//绘制图片
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
img.getComponent(4).then(component => {
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
})
creator.queueImage(img, (err) => {
if (err) {
console.info('queueImage failed: ' + err);
......@@ -2172,16 +2172,16 @@ queueImage(interface: Image): Promise\<void>
```js
creator.dequeueImage().then(img => {
const JPEG = 4;
var component = await img.getComponent(JPEG);
//绘制图片
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
img.getComponent(4).then(component => {
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
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.
先完成此消息的编辑!
想要评论请 注册