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

!11038 翻译完成:10212+10709+10772+10978+10989+9885+11065 窗口子系统模块文档更新

Merge pull request !11038 from wusongqing/TR10212
......@@ -73,7 +73,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
**Example**
```js
var screenshotOptions = {
let screenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -85,14 +85,18 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
"rotation": 0,
"displayId": 0
};
screenshot.save(screenshotOptions, (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(); // Release the memory in time after the PixelMap is used.
});
try {
screenshot.save(screenshotOptions, (err, pixelMap) => {
if (err) {
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
return;
}
console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used.
});
} catch (exception) {
console.error('Failed to save screenshot. Code: ' + JSON.stringify(exception));
};
```
## screenshot.save
......@@ -114,14 +118,18 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
**Example**
```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(); // Release the memory in time after the PixelMap is used.
});
try {
screenshot.save((err, pixelMap) => {
if (err) {
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
return;
}
console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used.
});
} catch (exception) {
console.error('Failed to save screenshot. Code: ' + JSON.stringify(exception));
};
```
## screenshot.save
......@@ -149,7 +157,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses a promis
**Example**
```js
var screenshotOptions = {
let screenshotOptions = {
"screenRect": {
"left": 200,
"top": 100,
......@@ -161,11 +169,15 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses a promis
"rotation": 0,
"displayId": 0
};
let promise = screenshot.save(screenshotOptions);
promise.then((pixelMap) => {
console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used.
}).catch((err) => {
console.log('Failed to save screenshot: ' + JSON.stringify(err));
});
try {
let promise = screenshot.save(screenshotOptions);
promise.then((pixelMap) => {
console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
pixelMap.release(); // Release the memory in time after the PixelMap is used.
}).catch((err) => {
console.log('Failed to save screenshot. Code: ' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to save screenshot. Code: ' + JSON.stringify(exception));
};
```
# Display Error Codes
## 1400001 Invalid Display or Screen
**Error Message**
Invalid display or screen.
**Description**
This error code is reported when an invalid display, including a virtual screen, is operated.
**Possible Causes**
1. The virtual screen has not been created.
2. The virtual screen has been destroyed.
**Procedure**
1. Before operating the virtual screen, check whether the virtual screen has been created.
2. Check whether the virtual screen has been destroyed.
## 1400002 Unauthorized Operation
**Error Message**
Unauthorized operation.
**Description**
This error code is reported when the API does not have the required permissions to operate an object.
**Possible Causes**
The virtual screen object of another process is operated.
**Procedure**
Check whether unauthorized operations are performed on the object of another process. If yes, delete the operations.
## 1400003 Abnormal Display Manager Service
**Error Message**
This display manager service works abnormally.
**Description**
This error code is reported when the display manager service is abnormal.
**Possible Causes**
1. The display manager service is not started normally.
2. The bottom-layer graphics synthesis and rendering are abnormal.
**Procedure**
Try again later or restart the device.
# Window Error Codes
## 1300001 Repeated Operation
**Error Message**
Repeated operation.
**Description**
This error code is reported when a repeated operation is performed.
**Possible Causes**
The window to create already exists.
**Procedure**
Before creating a window, check whether the window already exists. If it already exists, use it directly.
## 1300002 Abnormal Window State
**Error Message**
This window state is abnormal.
**Description**
This error code is reported when you operate a window in an abnormal state, for example, a window that has been destroyed.
**Possible Causes**
The window has been destroyed when being operated.
**Procedure**
Before operating the window, check whether it exists.
## 1300003 Abnormal Window Manager Service
**Error Message**
This window manager service works abnormally.
**Description**
This error code is reported when the window manager service is abnormal.
**Possible Causes**
The internal services of the window are not started normally.
**Procedure**
Try again later or restart the device.
## 1300004 Unauthorized Operation
**Error Message**
Unauthorized operation.
**Description**
This error code is reported when the API does not have the required permissions to operate an object.
**Possible Causes**
The window object of another process is operated.
**Procedure**
Check whether unauthorized operations are performed on the object of another process. If yes, delete the operations.
## 1300005 Abnormal Window Stage
**Error Message**
This window stage is abnormal.
**Description**
This error code is reported when you operate a window stage in the abnormal state, for example, a window stage that has been destroyed.
**Possible Causes**
The window stage has been destroyed when being operated.
**Procedure**
Before operating a window stage, check whether it exists.
## 1300006 Abnormal Window Context
**Error Message**
This window context is abnormal.
**Description**
This error code is reported when you operate a window context in the abnormal state, for example, a window context that has been destroyed.
**Possible Causes**
The window context has been destroyed when being operated.
**Procedure**
Before operating the window context, check whether it exists.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册