提交 7b24e5ca 编写于 作者: W wusongqing

update docs against 5824

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 d35878b6
# Screenshot
Provides APIs for you to set information such as the region to capture and the size of the screen region when capturing a screen.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
## Modules to Import
......@@ -17,11 +20,12 @@ Describes screenshot options.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
| Name | Type | Mandatory| Description |
| ---------- | ------------- | ---- | ------------------------------------------------------------ |
| screenRect | [Rect](#rect) | No | Region of the screen to capture. If this parameter is null, the full screen will be captured.|
| imageSize | [Size](#size) | No | Size of the screen region to capture. If this parameter is null, the full screen will be captured.|
| rotation | number | No | Rotation angle of the screenshot. Currently, the value can be **0** only. The default value is **0**.|
| Name | Type | Mandatory| Description |
| ---------------------- | ------------- | ---- | ------------------------------------------------------------ |
| screenRect | [Rect](#rect) | No | Region of the screen to capture. If this parameter is null, the full screen will be captured. |
| imageSize | [Size](#size) | No | Size of the screen region to capture. If this parameter is null, the full screen will be captured. |
| rotation | number | No | Rotation angle of the screenshot. Currently, the value can be **0** only. The default value is **0**. |
| displayId<sup>8+</sup> | number | No | ID of the [display](js-apis-display.md#display) device on which the screen region is to be captured.|
## Rect
......@@ -63,7 +67,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| options | [ScreenshotOptions](#screenshotoptions) | No | Consists of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set them separately.|
| callback | AsyncCallback&lt;image.PixelMap&gt; | Yes | Callback used to return a **PixelMap** object. |
**Example**
......@@ -78,7 +82,8 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
"imageSize": {
"width": 300,
"height": 300},
"rotation": 0
"rotation": 0,
"displayId": 0
};
screenshot.save(ScreenshotOptions, (err, data) => {
if (err) {
......@@ -103,13 +108,13 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
| Name | Type | Mandatory| Description |
| ------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| options | [ScreenshotOptions](#screenshotoptions) | No | Consists of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set them separately.|
**Return value**
| Type | Description |
| ----------------------------- | ----------------------------------------------- |
| Promise&lt;image.PixelMap&gt; | Promise used to return an **image.PixelMap** object.|
| Promise&lt;image.PixelMap&gt; | Promise used to return a **PixelMap** object.|
**Example**
......@@ -123,7 +128,8 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
"imageSize": {
"width": 300,
"height": 300},
"rotation": 0
"rotation": 0,
"displayId": 0
};
let promise = screenshot.save(ScreenshotOptions);
promise.then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册