mirror of
https://gitee.com/openharmony/applications_screenshot
synced 2024-11-22 22:51:26 +00:00
更新代码
Signed-off-by: username <1037761763@qq.com>
This commit is contained in:
parent
bb24ae5160
commit
31ed642e1a
@ -30,7 +30,7 @@ ScreenShot应用是OpenHarmony中预置的系统应用,为用户提供截取
|
||||
├── product # ScreenShot总体功能目录
|
||||
```
|
||||
|
||||
###功能描述
|
||||
### 功能描述
|
||||
#### features
|
||||
子组件目录,提供截屏窗口显示控制,图片保存控制。
|
||||
|
@ -26,15 +26,17 @@ const TAG = 'ScreenShot-ScreenShotModel';
|
||||
const SCREEN_SHOT_PATH = "Screenshots/";
|
||||
const SCREENSHOT_PREFIX = "Screenshot";
|
||||
const PICTURE_TYPE = ".jpg";
|
||||
const SAVE_IMAGE_DELAY = 500;
|
||||
const SAVE_IMAGE_DELAY = 300;
|
||||
const OPTIONS_QUALITY = 100;
|
||||
const CREATE_WINDOW_DELAY = 300;
|
||||
|
||||
export class ScreenShotModel {
|
||||
captureImage: any = null;
|
||||
captureImage: any;
|
||||
imageFilename: string = '';
|
||||
|
||||
shotScreen() {
|
||||
async shotScreen() {
|
||||
Log.showInfo(TAG, `shotScreen`)
|
||||
await new Promise((resolve) => setTimeout(resolve, CREATE_WINDOW_DELAY));
|
||||
ScreenshotManager.save().then(async (data) => {
|
||||
Log.showInfo(TAG, `ScreenshotManager.save data:${JSON.stringify(data)}`)
|
||||
if (!!data) {
|
||||
@ -56,7 +58,7 @@ export class ScreenShotModel {
|
||||
var packer = ImageMar.createImagePacker();
|
||||
Log.showInfo(TAG, `saveImage packer:${JSON.stringify(packer)}`);
|
||||
this.showWindow();
|
||||
await new Promise((resolve) => setTimeout(resolve, SAVE_IMAGE_DELAY))
|
||||
await new Promise((resolve) => setTimeout(resolve, SAVE_IMAGE_DELAY));
|
||||
packer.packingFromPixelMap(pixelMap, options).then((jpegData) => {
|
||||
Log.showInfo(TAG, `packing jpegData type:` + jpegData.constructor.name + ' value : ' + jpegData);
|
||||
media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE, (err, rp) => {
|
||||
|
@ -21,7 +21,7 @@ const TAG = 'ScreenShot-Index';
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@StorageLink("captureImage") captureImage: any = undefined;
|
||||
@StorageLink("captureImage") captureImage: any = "";
|
||||
@StorageLink("imageFilename") imageFilename: string = "";
|
||||
|
||||
build() {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Loading…
Reference in New Issue
Block a user