145 Star 1.4K Fork 1.7K

OpenHarmony/applications_app_samples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.gitee
code
AI/MindSporeLiteCDemoASR
BasicFeature
Ability
Ads/OAIDSample
ApplicationModels
Connectivity
DFX
DataManagement
DeviceManagement
Extension/Contexttest
FileManagement
Graphics
DisplaySoloist
AppScope
entry
hvigor
screenshots/device
.gitignore
README_zh.md
build-profile.json5
hvigorfile.ts
hvigorw
hvigorw.bat
oh-package.json5
ohosTest.md
DisplaySync
Graphics2d
Graphics3d
International/International
Media
Native
Notification
Print/ScanNapiInterfaceDemo
Resource/ResourceManager
Security
TaskManagement
Telephony
Web
Window/MediaFullScreen
DataMock
DocsSample
LanguageBaseClassLibrary
Performance
Project
Solutions
SuperFeature
SystemFeature
UI
.gitattributes
.gitignore
CodeCommitChecklist.md
LICENSE
OAT.xml
README.md
README_zh.md
SampleReadTemplate.md
changelog.md
ohosTestTemplate.md
releasenote.md
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

DisplaySoloist分级管控

介绍

本示例通过DisplaySoloist分级管控功能,使用UI以外的线程对XComponent的绘制内容设置开发者所期望的帧率。

效果预览

XComponent

使用说明

1.进入XComponent页面,依次点击“Start”,三个方块分别按照30Hz、60Hz、120Hz移动;点击“Stop”动画停止;

工程目录

├──entry/src/main
│  ├──cpp                                       // C++代码区
│  │  ├──CMakeLists.txt                         // CMake配置文件
│  │  ├──hello.cpp                              // Napi模块注册
│  │  ├──common
│  │  │  └──log_common.h                        // 日志封装定义文件
│  │  ├──plugin                                 // 生命周期管理模块
│  │  │  ├──plugin_manager.cpp
│  │  │  └──plugin_manager.h
│  │  ├──samples                                // samples渲染模块
│  │  │  ├──sample_xcomponent.cpp
│  │  │  └──sample_xcomponent.h
│  ├──ets                                       // ets代码区
│  │  ├──entryability
│  │  │  ├──EntryAbility.ts                     // 程序入口类
|  |  |  └──EntryAbility.ets
|  |  ├──interface
│  │  │  └──XComponentContext.ts                // XComponentContext
│  │  ├──pages                                  // 页面文件
│  │  |  └──Index.ets                           // XComponent页面
│  │  ├──utils                                  // 工具类
|  ├──resources         			      // 资源文件目录

具体实现

  • XComponent:通过在IDE中的Native c++ 工程,在c++代码中定义对外接口为register、unregister以及destroy,并调用NativeDisplaySoloist分级管控接口,可在页面上使用drawing根据设定的期望帧率来绘制。
    • 涉及到的相关接口(CAPI接口链接):

      接口名 描述
      OH_DisplaySoloist_Create 创建一个OH_DisplaySoloist实例
      OH_DisplaySoloist_Destroy 销毁一个OH_DisplaySoloist实例
      OH_DisplaySoloist_Start 设置每帧回调函数,每次vsync信号到来时启动每帧回调
      OH_DisplaySoloist_Stop 停止请求下一次vsync信号,并停止调用回调函数callback
      OH_DisplaySoloist_SetExpectedFrameRateRange 设置期望帧率范围

相关权限

不涉及

依赖

不涉及

约束与限制

1.本示例仅支持在标准系统上运行,支持设备:RK3568。

2.本示例为Stage模型,已适配API version 12版本SDK,SDK版本号(API Version 12 5.0.0.26),镜像版本号(5.0.0.26)。

3.本示例需要使用DevEco Studio 版本号(4.1.3.500)及以上版本才可编译运行。

下载

如需单独下载本工程,执行如下命令:

git init
git config core.sparsecheckout true
echo code/BasicFeature/Graphics/DisplaySoloist/ > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/applications_app_samples.git
git@gitee.com:openharmony/applications_app_samples.git
openharmony
applications_app_samples
applications_app_samples
master

搜索帮助