Go to file
openharmony_ci 6b667132a9
!38 hypium版本修改1.0.9
Merge pull request !38 from 秦炜杰/master
2023-10-10 08:12:07 +00:00
AppScope update screenshot code 2022-04-25 20:15:44 +08:00
common update common/src/main/ets/default/Log.ets. 2023-05-23 08:04:47 +00:00
features/screenshot update features/screenshot/src/main/ets/com/ohos/model/screenShotModel.ets. 2023-05-23 08:07:11 +00:00
figures update readme 2022-03-11 14:33:30 +08:00
hvigor 切换ohpm 2023-09-27 17:14:18 +08:00
product/phone 切换ohpm 2023-09-27 17:14:18 +08:00
signature 更新p7b签名证书文件 2022-11-21 14:52:20 +08:00
.gitignore 修改gitignore范围 2022-11-19 14:46:32 +08:00
build-profile.json5 修改build-profile.json5文件 2023-02-01 14:31:33 +08:00
hvigorfile.js update screenshot code 2022-04-25 20:15:44 +08:00
hvigorw 切换ohpm 2023-09-27 17:14:18 +08:00
hvigorw.bat 切换ohpm 2023-09-27 17:14:18 +08:00
LICENSE [screenShot]update LICENSE 2022-03-08 21:38:10 +08:00
OAT.xml 切换ohpm 2023-09-27 17:14:18 +08:00
oh-package.json5 切换ohpm 2023-10-10 15:48:15 +08:00
README_EN.md update readme 2022-03-12 11:34:04 +08:00
README.md 更新代码 2022-04-11 10:59:35 +08:00

ScreenShot

Introduction

The 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.

Architecture diagram

feature

Screen capture management layer, providing screen capture window display control and picture save control.

common

A general tool class that provides log printing and external interface management functions.

content

/applications/standard/screenshot
     ├── entry             # entry module directory
     ├── common            # Common tool class directory
     ├── build.gradle      # Global build configuration file
     ├── settings.gradle   # Compile the module configuration file
     ├── LICENSE           # License file
     ├── signature         # Certificate file directory
     ├── features          # subcomponent directory
     │ ├── screenshot      # screenshot component
     │ ├── screenShotModel # Save screenshots, etc.
     ├── product           # ScreenShot general function catalog

Function description

features

sub-component directory, provides screen capture window display control, and image save control.

product

ScreenShot general function catalog, screenshot service entrance.

sign

  1. For each module under product/phone, configure signingConfigs in build.gradle

  2. Put screenshot.p7b in the signature directory on the corresponding path configured in the build.gradle directory.

Instructions

Create a small screen capture window to display pictures through create, the sample code is as follows

// Create a small screen capture window to display pictures
window.create(context, windowName, WINDOW_TYPE).then((win) => {
  win.moveTo(0, WINDOW_Y).then(() => {
    win.resetSize(dis.width * ZOOM_RATIO, dis.height * ZOOM_RATIO).then(() => {
      win.loadContent(INDEX_PAGE).then(() => {
      })
    })
  })
}, (error) => {
  Log.showInfo(TAG, " window createFailed, error.code = " + error.code)
})


// Take a screenshot of the current screen, the return value can be directly displayed on the control
Screenshot.save().then(async (data) => {
  if (!!data) {
    show();
  }
}).catch((err) => {
  Log.showInfo(TAG, `save err`);
})
    

Relevant warehouse

Relevant warehouse

applications_screenshot