未验证 提交 c19f86b0 编写于 作者: O openharmony_ci 提交者: Gitee

!9854 修改js-apis-screenshot.md中save接口

Merge pull request !9854 from yangfei/dev_revise_screenshot
......@@ -55,7 +55,7 @@ import screenshot from '@ohos.screenshot';
## screenshot.save
save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>): void
save(options: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>): void
获取屏幕截图。
......@@ -67,7 +67,7 @@ save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | 否 | 该类型的参数包含screenRect,imageSize,rotation, displayId四个参数,可以分别设置这四个参数。 |
| options | [ScreenshotOptions](#screenshotoptions) | 是 | 该类型的参数包含screenRect、imageSize、rotation、displayId四个参数,可以分别设置这四个参数。 |
| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | 是 | 回调函数。返回一个PixelMap对象。 |
**示例:**
......@@ -97,6 +97,35 @@ save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>)
## screenshot.save
save(callback: AsyncCallback<image.PixelMap>): void
获取屏幕截图。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**需要权限**:ohos.permission.CAPTURE_SCREEN,仅系统应用可用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | 是 | 回调函数。返回一个PixelMap对象。 |
**示例:**
```js
screenshot.save((err, pixelMap) => {
if (err) {
console.log('Failed to save screenshot: ' + JSON.stringify(err));
return;
}
console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // PixelMap使用完后及时释放内存
});
```
## screenshot.save
save(options?: ScreenshotOptions): Promise<image.PixelMap>
获取屏幕截图。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册