| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
| callback | Callback<number> | Yes| Callback used to return the ID of the display.|
| callback | Callback<number> | Yes| Callback used to return the ID of the display, which is an integer. |
**Example**
...
...
@@ -279,7 +279,7 @@ Unsubscribes from display changes.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **add**, indicating the display addition event. Example: event that a display is connected.<br>- **remove**, indicating the display removal event. Example: event that a display is disconnected.<br>- **change**, indicating the display change event. Example: event that the display orientation is changed.|
| callback | Callback<number> | No| Callback used to return the ID of the display.|
| callback | Callback<number> | No| Callback used to return the ID of the display, which is an integer.|
**Example**
...
...
@@ -335,7 +335,7 @@ Unsubscribes from privacy mode changes of this display. When there is a privacy
| type | string | Yes | Event type. The value is fixed at **'privateModeChange'**, indicating the event of display private mode changes.|
| type | string | Yes | Event type. The value is fixed at **'privateModeChange'**, indicating the event of display privacy mode changes.|
| callback | Callback<boolean> | No | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.|
**Example**
...
...
@@ -479,22 +479,22 @@ Before calling any API in **Display**, you must use [getAllDisplays()](#displayg
| id | number | Yes| No| ID of the display. The value must be an integer. |
| 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. The value must be an integer. |
| rotation | number | Yes| No| Screen rotation angle of the display.<br>The value **0** indicates that the screen of the display rotates by 0°.<br>The value **1** indicates that the screen of the display rotates by 90°.<br>The value **2** indicates that the screen of the display rotates by 180°.<br>The value **3** indicates that the screen of the display rotates by 270°.|
| 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, that is, the number of dots per inch. Generally, the value is **160** or **480**.|
| orientation<sup>10+</sup> | [Orientation](#orientation10) | Yes| No| Orientation of the display.|
| densityPixels | number | Yes| No| Logical density of the display, which is a scaling coefficient independent of the pixel unit. Generally, the value is **1** or **3**.|
| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. Generally, the value is the same as that of **densityPixels**.|
| 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.|
| width | number | Yes| No| Width of the display, in pixels. The value must be an integer. |
| height | number | Yes| No| Height of the display, in pixels. The value must be an integer. |
| densityDPI | number | Yes| No| Screen density of the display, that is, the number of dots per inch. The value must be a floating point number. Generally, the value is **160.0** or **480.0**. |
| orientation<sup>10+</sup> | [Orientation](#orientation10) | Yes| No| Orientation of the display.|
| densityPixels | number | Yes| No| Logical density of the display, which is a scaling coefficient independent of the pixel unit. The value must be a floating point number. Generally, the value is **1.0** or **3.0**. |
| scaledDensity | number | Yes| No| Scaling factor for fonts displayed on the display. The value must be a floating point number. Generally, the value is the same as that of **densityPixels**. |
| xDPI | number | Yes| No| Exact physical dots per inch of the screen in the horizontal direction. The value must be a floating point number. |
| yDPI | number | Yes| No| Exact physical dots per inch of the screen in the vertical direction. The value must be a floating point number. |
| eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.|
| callback | Callback<number> | Yes | Callback used to return the screen ID. |
| callback | Callback<number> | Yes | Callback used to return the screen ID, which is an integer. |
**Example**
...
...
@@ -126,7 +126,7 @@ Unsubscribes from events related to the screen state.
| eventType | string | Yes | Event type.<br>- **connect**: an event indicating that the screen is connected.<br>- **disconnect**: an event indicating that the screen is disconnected.<br>- **change**: an event indicating that the screen state changes.|
| callback | Callback<number> | No | Callback used to return the screen ID. |
| callback | Callback<number> | No | Callback used to return the screen ID, which is an integer. |
**Example**
...
...
@@ -152,9 +152,9 @@ Sets the screen to the expanded mode. This API uses an asynchronous callback to
| expandScreen | Array<number> | Yes | IDs of the expanded screens. Each ID must be an integer. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the expanded mode is stopped, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
...
...
@@ -274,9 +274,9 @@ Stops the expanded mode. This API uses a promise to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If screen mirroring is stopped, **err** is **undefined**; otherwise, **err** is an error object.|
| mirrorScreen | Array<number> | Yes | IDs of secondary screens. Each ID must be an integer. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If screen mirroring is stopped, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
...
...
@@ -444,9 +444,9 @@ Stops screen mirroring. This API uses a promise to return the result.
| screenId | number | Yes | Screen ID. The value must be an integer. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the virtual screen is destroyed, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
...
...
@@ -630,7 +630,7 @@ Destroys a virtual screen. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| -------- | ------ | ---- | ---------- |
| screenId | number | Yes | Screen ID.|
| screenId | number | Yes | Screen ID. The value must be an integer.|
**Return value**
...
...
@@ -675,7 +675,7 @@ Sets the surface for a virtual screen. This API uses an asynchronous callback to
| screenId | number | Yes | Screen ID. The value must be an integer. |
| surfaceId | string | Yes | Surface ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the virtual screen surface is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
...
...
@@ -719,7 +719,7 @@ Sets the surface for a virtual screen. This API uses a promise to return the res
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ------------- |
| screenId | number | Yes | Screen ID. |
| screenId | number | Yes | Screen ID. The value must be an integer. |
| surfaceId | string | Yes | Surface ID.|
**Return value**
...
...
@@ -877,9 +877,9 @@ Defines the parameters for expanding a screen.
| id | number | Yes | No | Screen ID. The value must be an integer. |
| parent | number | Yes | No | ID of the group to which a screen belongs. The value must be an integer. |
| supportedModeInfo | Array<[ScreenModeInfo](#screenmodeinfo)> | Yes | No | Mode set supported by the screen. |
| activeModeIndex | number | Yes | No | Index of the active screen mode. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.|
| activeModeIndex | number | Yes | No | Index of the active screen mode. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.|
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the active mode is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
...
...
@@ -1040,7 +1040,7 @@ Sets the active mode of the screen. This API uses a promise to return the result
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ---------- |
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware.|
| modeIndex | number | Yes | Index of the mode to set. The current value and value range of this parameter vary according to the screen resolution, refresh rate, and device hardware. The value must be an integer.|
**Return value**
...
...
@@ -1081,8 +1081,8 @@ Sets the pixel density of the screen. This API uses an asynchronous callback to
| densityDpi | number | Yes | Pixel density. The value must be an integer in the range [80, 640]. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the pixel density is successfully set, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
...
...
@@ -1119,8 +1119,8 @@ Sets the pixel density of the screen. This API uses a promise to return the resu
| 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.|
| rotation | number | No | Rotation angle of the screenshot. Currently, the value can be **0** only. The default value is **0**. The value must be an integer. |
| 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. The value must be an integer.|
## Rect
...
...
@@ -37,10 +37,10 @@ Describes the region of the screen to capture.