diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 53ed97ad1aa3f86c392ba048f63e0f7cca5298f9..cfe8914b24599ca3038e0ab7850a7773743e5dd9 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -297,6 +297,21 @@ struct OH_NativeXComponent_KeyEvent; */ typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent; +/** + * @brief 定义期望帧率范围。 + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** 期望帧率范围最小值。 */ + int32_t min; + /** 期望帧率范围最大值。 */ + int32_t max; + /** 期望帧率 */ + int32_t expected; +} OH_NativeXComponent_ExpectedRateRange; + /** * @brief 获取ArkUI XComponent的id。 * @@ -528,6 +543,40 @@ int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* ke */ int32_t OH_NativeXComponent_GetKeyEventTimeStamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timeStamp); +/** + * @brief 设置期望帧率范围。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param range 表示指向期望帧率范围的指针 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetExpectedFrameRateRange( + OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range); + +/** + * @brief 为此OH_NativeXComponent实例注册显示更新回调。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向显示更新回调的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, + void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp)); + +/** + * @brief 为此OH_NativeXComponent实例取消注册回调函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_UnRegisterOnFrameCallback(OH_NativeXComponent* component); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/graphic/native_hgm.h b/zh-cn/native_sdk/graphic/native_hgm.h new file mode 100644 index 0000000000000000000000000000000000000000..86ea141d0c14d44447b51da3930248db1f176739 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_hgm.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NATIVE_HYPER_GRAPHIC_MANAGER_H_ +#define NATIVE_HYPER_GRAPHIC_MANAGER_H_ + +/** + * @addtogroup NativeHgm + * @{ + * + * @brief 提供Hgm模块的一些接口. + * + * 该模块主要是提供获取帧率及模式的接口,主要使用场景为系统设置应用调用. + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @since 10 + * @version 1.0 + */ + +/** + * @file native_hgm.h + * + * @brief 定义获取和使用NativeHgm的相关函数. + * + * @library libnative_hgm.so + * @since 10 + * @version 1.0 + */ +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 实现设置刷新率模式功能. + * + * 系统设置应用根据选择的刷新档位调用此接口,HGM会按照XML中的配置设置刷新率模式,并将这个数值做持久化 + * 重启之后,进入设置应用,上次选择的档位会被选中 + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param mode 刷新率模式(-1,1,2,3 分别代表智能,标准,中,高). + * @since 10 + * @version 1.0 + */ +void OH_NativeHgm_SetRefreshRateMode(int32_t mode); + +/** + * @brief 实现获取屏幕当前刷新率功能. + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen 屏幕id. + * @return 返回当前屏幕的刷新率(一般为60Hz,90Hz,120Hz). + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); + +/** + * @brief 实现获取当前的刷新率模式功能. + * + * 此接口只会在出厂后用户尚未选择一个刷新率档位的时候调用,来决定默认配置的刷新率档位. + * 设置应用会根据接口返回的值来设置默认的刷新率档位. + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @return 返回当前的刷新率模式(-1,1,2,3 分别代表智能,标准,中,高). + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeHgm_GetCurrentRefreshRateMode(void); + +/** + * @brief 实现获取屏幕支持的刷新率功能. + * + * 系统设置应用在进入显示子菜单时调用,根据接口返回的值确定给用户显示哪些刷新率模式的可选项. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen 屏幕id. + * @return 返回屏幕支持的刷新率数组. + * @since 10 + * @version 1.0 + */ +int32_t* OH_NativeHgm_GetScreenSupportedRefreshRates(int32_t screen); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif \ No newline at end of file