1# ScreenShot 2 3## Introduction 4 5The ScreenShot application is a preset system application in OpenHarmony, which provides users with the function of capturing the current screen and saving the current picture. 6 7### Architecture diagram 8 9![](figures/en_diagram.png) 10 11#### feature 12 Screen capture management layer, providing screen capture window display control and picture save control. 13#### common 14 A general tool class that provides log printing and external interface management functions. 15 16## content 17 18``` 19/applications/standard/screenshot 20 ├── entry # entry module directory 21 ├── common # Common tool class directory 22 ├── build.gradle # Global build configuration file 23 ├── settings.gradle # Compile the module configuration file 24 ├── LICENSE # License file 25 ├── signature # Certificate file directory 26 ├── features # subcomponent directory 27 │ ├── screenshot # screenshot component 28 │ ├── screenShotModel # Save screenshots, etc. 29 ├── product # ScreenShot general function catalog 30``` 31 32### Function description 33#### features 34 sub-component directory, provides screen capture window display control, and image save control. 35 36#### product 37 ScreenShot general function catalog, screenshot service entrance. 38 39## sign 401. For each module under product/phone, configure signingConfigs in build.gradle 41 422. Put screenshot.p7b in the signature directory on the corresponding path configured in the build.gradle directory. 43 44## Instructions 45 46Create a small screen capture window to display pictures through create, the sample code is as follows 47 48```js 49// Create a small screen capture window to display pictures 50window.create(context, windowName, WINDOW_TYPE).then((win) => { 51 win.moveTo(0, WINDOW_Y).then(() => { 52 win.resetSize(dis.width * ZOOM_RATIO, dis.height * ZOOM_RATIO).then(() => { 53 win.loadContent(INDEX_PAGE).then(() => { 54 }) 55 }) 56 }) 57}, (error) => { 58 Log.showInfo(TAG, " window createFailed, error.code = " + error.code) 59}) 60 61 62// Take a screenshot of the current screen, the return value can be directly displayed on the control 63Screenshot.save().then(async (data) => { 64 if (!!data) { 65 show(); 66 } 67}).catch((err) => { 68 Log.showInfo(TAG, `save err`); 69}) 70 71``` 72 73## Relevant warehouse 74 75Relevant warehouse 76 77**applications\_screenshot**