| STATE_OFF | 1 | The display is shut down.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_ON | 2 | The display is powered on.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_DOZE | 3 | The display is in sleep mode.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_DOZE_SUSPEND | 4 | The display is in sleep mode, and the CPU is suspended.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_VR | 5 | The display is in VR mode.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_ON_SUSPEND | 6 | The display is powered on, and the CPU is suspended.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| STATE_UNKNOWN | 0 | Unknown.|
| STATE_OFF | 1 | The display is shut down.|
| STATE_ON | 2 | The display is powered on.|
| STATE_DOZE | 3 | The display is in sleep mode.|
| STATE_DOZE_SUSPEND | 4 | The display is in sleep mode, and the CPU is suspended.|
| STATE_VR | 5 | The display is in VR mode.|
| STATE_ON_SUSPEND | 6 | The display is powered on, and the CPU is suspended.|
| id | number | Yes| No| ID of the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| name | string | Yes| No| Name of the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| alive | boolean | Yes| No| Whether the display is alive.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| state | [DisplayState](#DisplayState) | Yes| No| State of the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| refreshRate | number | Yes| No| Refresh rate of the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| rotation | number | Yes| No| Screen rotation angle of the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| width | number | Yes| No| Width of the display, in pixels.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| height | number | Yes| No| Height of the display, in pixels.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| densityDPI | number | Yes| No| Screen density of the display, in DPI.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| densityPixels | number | Yes| No| Screen density of the display, in pixels.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction.<br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| id | number | Yes| No| ID of the display.|
| name | string | Yes| No| Name of the display.|
| alive | boolean | Yes| No| Whether the display is alive.|
| state | [DisplayState](#DisplayState) | Yes| No| State of the display.|
| refreshRate | number | Yes| No| Refresh rate of the display.|
| rotation | number | Yes| No| Screen rotation angle of the display.|
| width | number | Yes| No| Width of the display, in pixels.|
| height | number | Yes| No| Height of the display, in pixels.|
| densityDPI | number | Yes| No| Screen density of the display, in DPI.|
| densityPixels | number | Yes| No| Screen density of the display, in pixels.|
| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display.|
| xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction.|
| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction.|
## display.getDefaultDisplay
...
...
@@ -82,7 +86,7 @@ Obtains the default display object.
| Promise<Array<[Display](#Display)>> | Promise used to return an array containing all the display objects.|
...
...
@@ -159,7 +163,7 @@ Enables listening.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br/>- **add**: listening for whether a display is added <br/>- **remove**: listening for whether a display is removed <br/>- **change**: listening for whether a display is changed|
| type | string | Yes| Listening type. The available values are as follows:<br>- **add**: listening for whether a display is added<br>- **remove**: listening for whether a display is removed<br>- **change**: listening for whether a display is changed|
| callback | Callback<number> | Yes| Callback used to return the ID of the display.|
- Example
...
...
@@ -183,7 +187,7 @@ Disables listening.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The available values are as follows:<br/>- **add**: listening for whether a display is added <br/>- **remove**: listening for whether a display is removed <br/>- **change**: listening for whether a display is changed|
| type | string | Yes| Listening type. The available values are as follows:<br>- **add**: listening for whether a display is added<br>- **remove**: listening for whether a display is removed<br>- **change**: listening for whether a display is changed|
| callback | Callback<number> | No| Callback used to return the ID of the display.|
| screenRect | [Rect](#Rect) | No| Region of the screen to capture. If this parameter is null, the full screen will be captured. <br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| imageSize | [Size](#Size) | No| Size of the screen region to capture. If this parameter is null, the full screen will be captured. <br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| rotation | number | No| Rotation angle of the screenshot. The value can be **0**, **90**, **180**, or **270**. The default value is **0**. <br/>**System capabilities**: SystemCapability.WindowManager.WindowManager.Core|
| 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**.|
| options | [ScreenshotOptions](#ScreenshotOptions) | No| Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| callback | AsyncCallback<image.PixelMap> | Yes| Callback used to return a **PixelMap** object.|
| options | [ScreenshotOptions](#ScreenshotOptions) | No| Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return a **PixelMap** object. |
- Example
...
...
@@ -93,13 +100,13 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
| options | [ScreenshotOptions](#ScreenshotOptions) | No| Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|
| options | [ScreenshotOptions](#ScreenshotOptions) | No| Screenshot options, which consist of **screenRect**, **imageSize**, and **rotation**. You need to set these parameters.|