From 55a986a49924691ac99b87e60dad9e329b9df64c Mon Sep 17 00:00:00 2001 From: xu-rui-w Date: Mon, 19 Sep 2022 15:07:53 +0800 Subject: [PATCH] modify the sample code of readPixels Signed-off-by: xu-rui-w --- zh-cn/application-dev/reference/apis/js-apis-image.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index b7f42d3cb4..63b3f9d072 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -169,7 +169,12 @@ readPixels(area: PositionArea): Promise\ **示例:** ```js -const area = new ArrayBuffer(400); +const area = { + pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } +} pixelmap.readPixels(area).then(() => { console.log('Succeeded in reading the image data in the area.'); //符合条件则进入 }).catch(error => { -- GitLab