提交 6649ffcd 编写于 作者: W wusongqing

updated docs against 5232

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 9024154a
...@@ -57,7 +57,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal ...@@ -57,7 +57,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN **Required permissions**: ohos.permission.CAPTURE_SCREEN (available only to system applications)
**Parameters** **Parameters**
...@@ -68,26 +68,26 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal ...@@ -68,26 +68,26 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a cal
**Example** **Example**
```js ```js
var ScreenshotOptions = { var ScreenshotOptions = {
"screenRect": { "screenRect": {
"left": 200, "left": 200,
"top": 100, "top": 100,
"width": 200, "width": 200,
"height": 200}, "height": 200},
"imageSize": { "imageSize": {
"width": 300, "width": 300,
"height": 300}, "height": 300},
"rotation": 0 "rotation": 0
}; };
screenshot.save(ScreenshotOptions, (err, data) => { screenshot.save(ScreenshotOptions, (err, data) => {
if (err) { if (err) {
console.error('Failed to save the screenshot. Error: ' + JSON.stringify(err)); console.error('Failed to save the screenshot. Error: ' + JSON.stringify(err));
return; return;
} }
console.info('Screenshot saved. Data: ' + JSON.stringify(data)); console.info('Screenshot saved. Data: ' + JSON.stringify(data));
}); });
``` ```
## screenshot.save ## screenshot.save
...@@ -97,7 +97,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro ...@@ -97,7 +97,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
**Required permissions**: ohos.permission.CAPTURE_SCREEN **Required permissions**: ohos.permission.CAPTURE_SCREEN (available only to system applications)
**Parameters** **Parameters**
...@@ -113,22 +113,22 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro ...@@ -113,22 +113,22 @@ Takes a screenshot and saves it as a **PixelMap** object. This method uses a pro
**Example** **Example**
```js ```js
var ScreenshotOptions = { var ScreenshotOptions = {
"screenRect": { "screenRect": {
"left": 200, "left": 200,
"top": 100, "top": 100,
"width": 200, "width": 200,
"height": 200}, "height": 200},
"imageSize": { "imageSize": {
"width": 300, "width": 300,
"height": 300}, "height": 300},
"rotation": 0 "rotation": 0
}; };
let promise = screenshot.save(ScreenshotOptions); let promise = screenshot.save(ScreenshotOptions);
promise.then(() => { promise.then(() => {
console.log('screenshot save success'); console.log('screenshot save success');
}).catch((err) => { }).catch((err) => {
console.log('screenshot save fail: ' + JSON.stringify(err)); console.log('screenshot save fail: ' + JSON.stringify(err));
}); });
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册