Name Date Size

..25-Oct-20244 KiB

.gitignoreH A D25-Oct-2024119

AppScope/H25-Oct-20244 KiB

build-profile.json5H A D25-Oct-20241.1 KiB

entry/H25-Oct-20244 KiB

hvigor/H25-Oct-20244 KiB

hvigorfile.tsH A D25-Oct-2024657

hvigorwH A D25-Oct-20241.4 KiB

hvigorw.batH A D25-Oct-20241.5 KiB

oh-package.json5H A D25-Oct-2024242

ohosTest.mdH A D25-Oct-20241.3 KiB

README_zh.mdH A D25-Oct-20243.4 KiB

screenshots/device/H25-Oct-20244 KiB

README_zh.md

1# DisplaySoloist分级管控
2
3### 介绍
4
5本示例通过DisplaySoloist分级管控功能,使用UI以外的线程对XComponent的绘制内容设置开发者所期望的帧率。
6### 效果预览
7
8| XComponent                                                    |
9|---------------------------------------------------------------|
10| <img src="./screenshots/device/displaySoloist.jpg" width="100%"/> |
11
12使用说明
13
141.进入XComponent页面,依次点击“**Start**”,三个方块分别按照30Hz、60Hz、120Hz移动;点击“**Stop**”动画停止;
15
16### 工程目录
17```
18├──entry/src/main
19│  ├──cpp                                       // C++代码区
20│  │  ├──CMakeLists.txt                         // CMake配置文件
21│  │  ├──hello.cpp                              // Napi模块注册
22│  │  ├──common
23│  │  │  └──log_common.h                        // 日志封装定义文件
24│  │  ├──plugin                                 // 生命周期管理模块
25│  │  │  ├──plugin_manager.cpp
26│  │  │  └──plugin_manager.h
27│  │  ├──samples                                // samples渲染模块
28│  │  │  ├──sample_xcomponent.cpp
29│  │  │  └──sample_xcomponent.h
30│  ├──ets                                       // ets代码区
31│  │  ├──entryability
32│  │  │  ├──EntryAbility.ts                     // 程序入口类
33|  |  |  └──EntryAbility.ets
34|  |  ├──interface
35│  │  │  └──XComponentContext.ts                // XComponentContext
36│  │  ├──pages                                  // 页面文件
37│  │  |  └──Index.ets                           // XComponent页面
38│  │  ├──utils                                  // 工具类
39|  ├──resources         			      // 资源文件目录
40```
41
42### 具体实现
43
44* XComponent:通过在IDE中的Native c++ 工程,在c++代码中定义对外接口为register、unregister以及destroy,并调用NativeDisplaySoloist分级管控接口,可在页面上使用drawing根据设定的期望帧率来绘制。
45    * 涉及到的相关接口([CAPI接口链接](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkgraphics2d/_native_display_soloist.md)):
46
47      | 接口名 | 描述 | 
48      | -------- | -------- |
49      | OH_DisplaySoloist_Create| 创建一个OH_DisplaySoloist实例 |
50      | OH_DisplaySoloist_Destroy  | 销毁一个OH_DisplaySoloist实例 |
51      | OH_DisplaySoloist_Start  | 设置每帧回调函数,每次vsync信号到来时启动每帧回调 |
52      | OH_DisplaySoloist_Stop  | 停止请求下一次vsync信号,并停止调用回调函数callback |
53      | OH_DisplaySoloist_SetExpectedFrameRateRange  | 设置期望帧率范围 |
54
55
56### 相关权限
57
58不涉及
59
60### 依赖
61
62不涉及
63
64### 约束与限制
65
661.本示例仅支持在标准系统上运行,支持设备:RK3568。
67
682.本示例为Stage模型,已适配API version 12版本SDK,SDK版本号(API Version 12 5.0.0.26),镜像版本号(5.0.0.26)。
69
703.本示例需要使用DevEco Studio 版本号(4.1.3.500)及以上版本才可编译运行。
71
72
73### 下载
74
75如需单独下载本工程,执行如下命令:
76```
77git init
78git config core.sparsecheckout true
79echo code/BasicFeature/Graphics/DisplaySoloist/ > .git/info/sparse-checkout
80git remote add origin https://gitee.com/openharmony/applications_app_samples.git
81git pull origin master
82
83```
84