已合并
systemMaterial cAPI #5067
hehongyang3创建于 4月29日
systemMaterial cAPI #5067
已合并
共 5 个文件变更+481-0
| @@ -35,6 +35,7 @@ if (!is_arkui_x) { | |||
| 35 | "native_interface_accessibility.h", | 35 | "native_interface_accessibility.h", |
| 36 | "native_interface_focus.h", | 36 | "native_interface_focus.h", |
| 37 | "native_key_event.h", | 37 | "native_key_event.h", |
| 38 | + "native_material.h", | ||
| 38 | "native_node.h", | 39 | "native_node.h", |
| 39 | "native_node_ani.h", | 40 | "native_node_ani.h", |
| 40 | "native_node_napi.h", | 41 | "native_node_napi.h", |
| @@ -60,6 +61,7 @@ if (!is_arkui_x) { | |||
| 60 | "arkui/native_interface_accessibility.h", | 61 | "arkui/native_interface_accessibility.h", |
| 61 | "arkui/native_interface_focus.h", | 62 | "arkui/native_interface_focus.h", |
| 62 | "arkui/native_key_event.h", | 63 | "arkui/native_key_event.h", |
| 64 | + "arkui/native_material.h", | ||
| 63 | "arkui/native_node.h", | 65 | "arkui/native_node.h", |
| 64 | "arkui/native_node_napi.h", | 66 | "arkui/native_node_napi.h", |
| 65 | "arkui/native_render.h", | 67 | "arkui/native_render.h", |
| @@ -6821,5 +6821,73 @@ | |||
| 6821 | { | 6821 | { |
| 6822 | "first_introduced": "26.0.0", | 6822 | "first_introduced": "26.0.0", |
| 6823 | "name": "OH_ArkUI_ParagraphStyle_GetRadialGradient" | 6823 | "name": "OH_ArkUI_ParagraphStyle_GetRadialGradient" |
| 6824 | + }, | ||
| 6825 | + { | ||
| 6826 | + "first_introduced": "26.0.0", | ||
| 6827 | + "name": "OH_ArkUI_NativeModule_GetSystemMaterialSupported" | ||
| 6828 | + }, | ||
| 6829 | + { | ||
| 6830 | + "first_introduced": "26.0.0", | ||
| 6831 | + "name": "OH_ArkUI_NativeModule_GetGlobalMaterialLevel" | ||
| 6832 | + }, | ||
| 6833 | + { | ||
| 6834 | + "first_introduced": "26.0.0", | ||
| 6835 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_Create" | ||
| 6836 | + }, | ||
| 6837 | + { | ||
| 6838 | + "first_introduced": "26.0.0", | ||
| 6839 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_Destroy" | ||
| 6840 | + }, | ||
| 6841 | + { | ||
| 6842 | + "first_introduced": "26.0.0", | ||
| 6843 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_SetStyle" | ||
| 6844 | + }, | ||
| 6845 | + { | ||
| 6846 | + "first_introduced": "26.0.0", | ||
| 6847 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_GetStyle" | ||
| 6848 | + }, | ||
| 6849 | + { | ||
| 6850 | + "first_introduced": "26.0.0", | ||
| 6851 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_SetMaterialColor" | ||
| 6852 | + }, | ||
| 6853 | + { | ||
| 6854 | + "first_introduced": "26.0.0", | ||
| 6855 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_GetMaterialColor" | ||
| 6856 | + }, | ||
| 6857 | + { | ||
| 6858 | + "first_introduced": "26.0.0", | ||
| 6859 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_SetApplyShadow" | ||
| 6860 | + }, | ||
| 6861 | + { | ||
| 6862 | + "first_introduced": "26.0.0", | ||
| 6863 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_GetApplyShadow" | ||
| 6864 | + }, | ||
| 6865 | + { | ||
| 6866 | + "first_introduced": "26.0.0", | ||
| 6867 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_SetInteractive" | ||
| 6868 | + }, | ||
| 6869 | + { | ||
| 6870 | + "first_introduced": "26.0.0", | ||
| 6871 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_GetInteractive" | ||
| 6872 | + }, | ||
| 6873 | + { | ||
| 6874 | + "first_introduced": "26.0.0", | ||
| 6875 | + "name": "OH_ArkUI_NativeModule_LightEffectOptions_Create" | ||
| 6876 | + }, | ||
| 6877 | + { | ||
| 6878 | + "first_introduced": "26.0.0", | ||
| 6879 | + "name": "OH_ArkUI_NativeModule_LightEffectOptions_Destroy" | ||
| 6880 | + }, | ||
| 6881 | + { | ||
| 6882 | + "first_introduced": "26.0.0", | ||
| 6883 | + "name": "OH_ArkUI_NativeModule_LightEffectOptions_SetColor" | ||
| 6884 | + }, | ||
| 6885 | + { | ||
| 6886 | + "first_introduced": "26.0.0", | ||
| 6887 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_SetLightEffect" | ||
| 6888 | + }, | ||
| 6889 | + { | ||
| 6890 | + "first_introduced": "26.0.0", | ||
| 6891 | + "name": "OH_ArkUI_NativeModule_ImmersiveMaterial_GetLightEffectColor" | ||
| 6824 | } | 6892 | } |
| 6825 | ] | 6893 | ] |
| @@ -0,0 +1,383 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 2026 Huawei Device Co., Ltd. | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + */ | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @addtogroup ArkUI_NativeModule | ||
| 18 | + * @{ | ||
| 19 | + * | ||
| 20 | + * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction, | ||
| 21 | + * tree node operations, attribute setting, and event listening. | ||
| 22 | + * | ||
| 23 | + * @since 26.0.0 | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * @file native_material.h | ||
| 28 | + * | ||
| 29 | + * @brief Declares the immersive material types and APIs for ArkUI on the native side. | ||
| 30 | + * | ||
| 31 | + * @library libace_ndk.z.so | ||
| 32 | + * @syscap SystemCapability.ArkUI.ArkUI.Full | ||
| 33 | + * @kit ArkUI | ||
| 34 | + * @since 26.0.0 | ||
| 35 | + */ | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +extern "C" { | ||
| 43 | + | ||
| 44 | + | ||
| 45 | +/** | ||
| 46 | + * @brief Enumerates the immersive material styles. | ||
| 47 | + * Different styles correspond to different material parameters, which affect the thickness of the material. | ||
| 48 | + * | ||
| 49 | + * @since 26.0.0 | ||
| 50 | + */ | ||
| 51 | +typedef enum { | ||
| 52 | + /** | ||
| 53 | + * Ultra thin style. The material layer is ultra thin, with a very strong transparency effect. | ||
| 54 | + * | ||
| 55 | + * @since 26.0.0 | ||
| 56 | + */ | ||
| 57 | + ARKUI_IMMERSIVE_STYLE_ULTRA_THIN = 0, | ||
| 58 | + /** | ||
| 59 | + * Thin style. The material layer is thin, with a strong transparency effect. | ||
| 60 | + * | ||
| 61 | + * @since 26.0.0 | ||
| 62 | + */ | ||
| 63 | + ARKUI_IMMERSIVE_STYLE_THIN, | ||
| 64 | + /** | ||
| 65 | + * Regular style. The material layer has a standard thickness with balanced visual effect. | ||
| 66 | + * | ||
| 67 | + * @since 26.0.0 | ||
| 68 | + */ | ||
| 69 | + ARKUI_IMMERSIVE_STYLE_REGULAR, | ||
| 70 | + /** | ||
| 71 | + * Thick style. The blur effect is strong. | ||
| 72 | + * | ||
| 73 | + * @since 26.0.0 | ||
| 74 | + */ | ||
| 75 | + ARKUI_IMMERSIVE_STYLE_THICK, | ||
| 76 | + /** | ||
| 77 | + * Ultra thick style. | ||
| 78 | + * | ||
| 79 | + * @since 26.0.0 | ||
| 80 | + */ | ||
| 81 | + ARKUI_IMMERSIVE_STYLE_ULTRA_THICK, | ||
| 82 | +} ArkUI_ImmersiveStyle; | ||
| 83 | + | ||
| 84 | +/** | ||
| 85 | + * @brief Enumerates the material levels, which indicate the computing power level of the device. | ||
| 86 | + * Use {@link OH_ArkUI_NativeModule_GetGlobalMaterialLevel} to obtain the material level of the current device. | ||
| 87 | + * | ||
| 88 | + * @since 26.0.0 | ||
| 89 | + */ | ||
| 90 | +typedef enum { | ||
| 91 | + /** | ||
| 92 | + * Exquisite level. The effect is exquisite and is suitable for high-end computing device. | ||
| 93 | + * | ||
| 94 | + * @since 26.0.0 | ||
| 95 | + */ | ||
| 96 | + ARKUI_MATERIAL_LEVEL_EXQUISITE = 0, | ||
| 97 | + /** | ||
| 98 | + * Gentle level. The effect is gentle and is suitable for mid-range computing device. | ||
| 99 | + * | ||
| 100 | + * @since 26.0.0 | ||
| 101 | + */ | ||
| 102 | + ARKUI_MATERIAL_LEVEL_GENTLE, | ||
| 103 | + /** | ||
| 104 | + * Smooth level. The effect is smooth and is suitable for low-end computing device. | ||
| 105 | + * | ||
| 106 | + * @since 26.0.0 | ||
| 107 | + */ | ||
| 108 | + ARKUI_MATERIAL_LEVEL_SMOOTH, | ||
| 109 | +} ArkUI_MaterialLevel; | ||
| 110 | + | ||
| 111 | +/** | ||
| 112 | + * @brief Defines the immersive material object on the native side. | ||
| 113 | + * Immersive materials have different performance levels based on the computing power of the device. | ||
| 114 | + * The performance level is defined by {@link ArkUI_MaterialLevel}, which can be obtained | ||
| 115 | + * by {@link OH_ArkUI_NativeModule_GetGlobalMaterialLevel}. | ||
| 116 | + * On high-end and mid-range computing power devices, they affect the filter effect of the | ||
| 117 | + * material layer and shadow effect. On low-end computing power devices, it affects the | ||
| 118 | + * background color, border color, border width, and shadow effect. | ||
| 119 | + * | ||
| 120 | + * @since 26.0.0 | ||
| 121 | + */ | ||
| 122 | +typedef struct ArkUI_ImmersiveMaterial ArkUI_ImmersiveMaterial; | ||
| 123 | + | ||
| 124 | +/** | ||
| 125 | + * @brief Defines the pointer to the immersive material object. | ||
| 126 | + * | ||
| 127 | + * @since 26.0.0 | ||
| 128 | + */ | ||
| 129 | +typedef struct ArkUI_ImmersiveMaterial* ArkUI_ImmersiveMaterialHandle; | ||
| 130 | + | ||
| 131 | +/** | ||
| 132 | + * @brief Defines the light effect options for immersive material. | ||
| 133 | + * The object is created with a default white color. | ||
| 134 | + * | ||
| 135 | + * @since 26.0.0 | ||
| 136 | + */ | ||
| 137 | +typedef struct ArkUI_LightEffectOptions ArkUI_LightEffectOptions; | ||
| 138 | + | ||
| 139 | +/** | ||
| 140 | + * @brief Defines the pointer to the light effect options. | ||
| 141 | + * | ||
| 142 | + * @since 26.0.0 | ||
| 143 | + */ | ||
| 144 | +typedef ArkUI_LightEffectOptions* ArkUI_LightEffectOptionsHandle; | ||
| 145 | + | ||
| 146 | +/** | ||
| 147 | + * @brief Check whether systemMaterial is supported on the current device. | ||
| 148 | + * If it is true, the {@link NODE_SYSTEM_MATERIAL} attribute can be used; | ||
| 149 | + * otherwise, setting the NODE_SYSTEM_MATERIAL attribute will be ineffective. | ||
| 150 | + * It is defined by the device and cannot be modified. | ||
| 151 | + * | ||
| 152 | + * @return Returns whether systemMaterial is enabled on the device. | ||
| 153 | + * @since 26.0.0 | ||
| 154 | + */ | ||
| 155 | +bool OH_ArkUI_NativeModule_GetSystemMaterialSupported(); | ||
| 156 | + | ||
| 157 | +/** | ||
| 158 | + * @brief Obtain the global material level, which is related to the computing power of the device. It is defined by the | ||
| 159 | + * device and cannot be modified. | ||
| 160 | + * | ||
| 161 | + * @return Returns the material level of the device. The return type is {@link ArkUI_MaterialLevel}. | ||
| 162 | + * @since 26.0.0 | ||
| 163 | + */ | ||
| 164 | +ArkUI_MaterialLevel OH_ArkUI_NativeModule_GetGlobalMaterialLevel(); | ||
| 165 | + | ||
| 166 | +/** | ||
| 167 | + * @brief Creates an immersive material object with the specified style. The level of the created material follows | ||
| 168 | + * the global material level and can be obtained through {@link OH_ArkUI_NativeModule_GetGlobalMaterialLevel}. | ||
| 169 | + * | ||
| 170 | + * @param style The material style. The parameter type is {@link ArkUI_ImmersiveStyle}. | ||
| 171 | + * @return Returns the pointer to the created immersive material object. | ||
| 172 | + * If creation fails or the style is invalid, returns NULL. | ||
| 173 | + * @release native_material/OH_ArkUI_NativeModule_ImmersiveMaterial_Destroy {return} | ||
| 174 | + * @since 26.0.0 | ||
| 175 | + */ | ||
| 176 | +ArkUI_ImmersiveMaterialHandle OH_ArkUI_NativeModule_ImmersiveMaterial_Create(ArkUI_ImmersiveStyle style); | ||
| 177 | + | ||
| 178 | +/** | ||
| 179 | + * @brief Destroys an immersive material object. | ||
| 180 | + * | ||
| 181 | + * @param material Pointer to material object. | ||
| 182 | + * The type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 183 | + * @since 26.0.0 | ||
| 184 | + */ | ||
| 185 | +void OH_ArkUI_NativeModule_ImmersiveMaterial_Destroy(ArkUI_ImmersiveMaterialHandle material); | ||
| 186 | + | ||
| 187 | +/** | ||
| 188 | + * @brief Sets the style. Only effective for exquisite and gentle materials. | ||
| 189 | + * | ||
| 190 | + * @param material Pointer to material object. The type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 191 | + * @param style The material style. The type is {@link ArkUI_ImmersiveStyle}. | ||
| 192 | + * @return <ul> | ||
| 193 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 194 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 195 | + * </ul> | ||
| 196 | + * @since 26.0.0 | ||
| 197 | + */ | ||
| 198 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_SetStyle( | ||
| 199 | + ArkUI_ImmersiveMaterialHandle material, ArkUI_ImmersiveStyle style); | ||
| 200 | + | ||
| 201 | +/** | ||
| 202 | + * @brief Gets the style of an immersive material object. | ||
| 203 | + * | ||
| 204 | + * @param material Pointer to material object. The type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 205 | + * @param style Pointer to style. The type is {@link ArkUI_ImmersiveStyle}. | ||
| 206 | + * @return <ul> | ||
| 207 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 208 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 209 | + * </ul> | ||
| 210 | + * @since 26.0.0 | ||
| 211 | + */ | ||
| 212 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_GetStyle( | ||
| 213 | + ArkUI_ImmersiveMaterialHandle material, ArkUI_ImmersiveStyle* style); | ||
| 214 | + | ||
| 215 | +/** | ||
| 216 | + * @brief Sets the material color of an immersive material object. This parameter is only effective for exquisite | ||
| 217 | + * and gentle materials. If not set, the default value is 0 which means transparent color. | ||
| 218 | + * | ||
| 219 | + * @param material The pointer to the immersive material object. The parameter | ||
| 220 | + * type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 221 | + * @param color The material color in 0xAARRGGBB format. Pass 0 for transparent (default value). | ||
| 222 | + * @return <ul> | ||
| 223 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 224 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 225 | + * </ul> | ||
| 226 | + * @since 26.0.0 | ||
| 227 | + */ | ||
| 228 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_SetMaterialColor( | ||
| 229 | + ArkUI_ImmersiveMaterialHandle material, uint32_t color); | ||
| 230 | + | ||
| 231 | +/** | ||
| 232 | + * @brief Gets the material color of an immersive material object. | ||
| 233 | + * | ||
| 234 | + * @param material Pointer to material object. The type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 235 | + * @param color Pointer to color in 0xAARRGGBB format. | ||
| 236 | + * @return <ul> | ||
| 237 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 238 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 239 | + * </ul> | ||
| 240 | + * @since 26.0.0 | ||
| 241 | + */ | ||
| 242 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_GetMaterialColor( | ||
| 243 | + ArkUI_ImmersiveMaterialHandle material, uint32_t* color); | ||
| 244 | + | ||
| 245 | +/** | ||
| 246 | + * @brief Sets the apply shadow attribute of an immersive material object. This parameter is effective for all levels | ||
| 247 | + * of materials. When this parameter is true, the shadow effect in the material takes effect, taking precedence over | ||
| 248 | + * the shadow general property. When this parameter is false, the shadow general property takes effect, and the | ||
| 249 | + * material has no shadow effect. If not set, the default value is true. | ||
| 250 | + * | ||
| 251 | + * @param material Pointer to material object. The type is {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 252 | + * @param applyShadow Whether to add shadows of the material effect. Default value is true. | ||
| 253 | + * @return <ul> | ||
| 254 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 255 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 256 | + * </ul> | ||
| 257 | + * @since 26.0.0 | ||
| 258 | + */ | ||
| 259 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_SetApplyShadow( | ||
| 260 | + ArkUI_ImmersiveMaterialHandle material, bool applyShadow); | ||
| 261 | + | ||
| 262 | +/** | ||
| 263 | + * @brief Gets the apply shadow attribute of an immersive material object. | ||
| 264 | + * | ||
| 265 | + * @param material The pointer to the immersive material object. The parameter type is | ||
| 266 | + * {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 267 | + * @param applyShadow Pointer to the variable that receives whether to apply shadow. Default value is true. | ||
| 268 | + * @return <ul> | ||
| 269 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 270 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 271 | + * </ul> | ||
| 272 | + * @since 26.0.0 | ||
| 273 | + */ | ||
| 274 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_GetApplyShadow( | ||
| 275 | + ArkUI_ImmersiveMaterialHandle material, bool* applyShadow); | ||
| 276 | + | ||
| 277 | +/** | ||
| 278 | + * @brief Sets the interactive attribute of an immersive material object. This parameter is effective for all levels | ||
| 279 | + * of materials. When this parameter is true, the material is interactive. When this parameter is false, | ||
| 280 | + * the material is not interactive. If not set, it follows the behavior of the component. | ||
| 281 | + * | ||
| 282 | + * @param material The pointer to the immersive material object. The parameter type is | ||
| 283 | + * {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 284 | + * @param interactive Whether the material is interactive. | ||
| 285 | + * @return <ul> | ||
| 286 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 287 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 288 | + * </ul> | ||
| 289 | + * @since 26.0.0 | ||
| 290 | + */ | ||
| 291 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_SetInteractive( | ||
| 292 | + ArkUI_ImmersiveMaterialHandle material, bool interactive); | ||
| 293 | + | ||
| 294 | +/** | ||
| 295 | + * @brief Gets the interactive attribute of an immersive material object. | ||
| 296 | + * If the value is never set, the function will return {@link ARKUI_ERROR_CODE_PARAM_ERROR}. | ||
| 297 | + * | ||
| 298 | + * @param material The pointer to the immersive material object. The parameter type is | ||
| 299 | + * {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 300 | + * @param interactive Pointer to the variable that receives whether the material is interactive. | ||
| 301 | + * @return <ul> | ||
| 302 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 303 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 304 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_ERROR} if the value is never set.</li> | ||
| 305 | + * </ul> | ||
| 306 | + * @since 26.0.0 | ||
| 307 | + */ | ||
| 308 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_GetInteractive( | ||
| 309 | + ArkUI_ImmersiveMaterialHandle material, bool* interactive); | ||
| 310 | + | ||
| 311 | +/** | ||
| 312 | + * @brief Creates a light effect options object with default white color. | ||
| 313 | + * | ||
| 314 | + * @return Returns the pointer to the created object. | ||
| 315 | + * @release native_material/OH_ArkUI_NativeModule_LightEffectOptions_Destroy {return} | ||
| 316 | + * @since 26.0.0 | ||
| 317 | + */ | ||
| 318 | +ArkUI_LightEffectOptionsHandle OH_ArkUI_NativeModule_LightEffectOptions_Create(); | ||
| 319 | + | ||
| 320 | +/** | ||
| 321 | + * @brief Destroys a light effect options object. | ||
| 322 | + * | ||
| 323 | + * @param options The pointer to the options object. | ||
| 324 | + * @since 26.0.0 | ||
| 325 | + */ | ||
| 326 | +void OH_ArkUI_NativeModule_LightEffectOptions_Destroy(ArkUI_LightEffectOptionsHandle options); | ||
| 327 | + | ||
| 328 | +/** | ||
| 329 | + * @brief Sets the color of the light effect. | ||
| 330 | + * If not set, the default white color is white(0xffffffff). | ||
| 331 | + * | ||
| 332 | + * @param options The pointer to the options object. The parameter type is {@link ArkUI_LightEffectOptionsHandle}. | ||
| 333 | + * @param color The light effect color in 0xAARRGGBB format. | ||
| 334 | + * @return <ul> | ||
| 335 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 336 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 337 | + * </ul> | ||
| 338 | + * @since 26.0.0 | ||
| 339 | + */ | ||
| 340 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_LightEffectOptions_SetColor( | ||
| 341 | + ArkUI_LightEffectOptionsHandle options, uint32_t color); | ||
| 342 | + | ||
| 343 | +/** | ||
| 344 | + * @brief Sets the light effect of an immersive material object. | ||
| 345 | + * Passing NULL disables the light effect. Passing non-NULL enables it with the options. | ||
| 346 | + * If not set, it follows the behavior of the component. | ||
| 347 | + * | ||
| 348 | + * @param material The pointer to the immersive material object. The parameter type is | ||
| 349 | + * {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 350 | + * @param options The light effect options. Pass NULL to disable. | ||
| 351 | + * @return <ul> | ||
| 352 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 353 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 354 | + * </ul> | ||
| 355 | + * @since 26.0.0 | ||
| 356 | + */ | ||
| 357 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_SetLightEffect( | ||
| 358 | + ArkUI_ImmersiveMaterialHandle material, const ArkUI_LightEffectOptionsHandle options); | ||
| 359 | + | ||
| 360 | +/** | ||
| 361 | + * @brief Gets the color of the light effect of an immersive material object. | ||
| 362 | + * Only succeeds if {@link OH_ArkUI_NativeModule_ImmersiveMaterial_SetLightEffect} was called with non-NULL options. | ||
| 363 | + * If never set or disabled (NULL passed), returns {@link ARKUI_ERROR_CODE_PARAM_ERROR}. | ||
| 364 | + * | ||
| 365 | + * @param material The pointer to the immersive material object. The parameter type is | ||
| 366 | + * {@link ArkUI_ImmersiveMaterialHandle}. | ||
| 367 | + * @param color Pointer to the variable that receives the light effect color. | ||
| 368 | + * @return <ul> | ||
| 369 | + * <li>{@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.</li> | ||
| 370 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.</li> | ||
| 371 | + * <li>{@link ARKUI_ERROR_CODE_PARAM_ERROR} if lightEffect is never set or disabled.</li> | ||
| 372 | + * </ul> | ||
| 373 | + * @since 26.0.0 | ||
| 374 | + */ | ||
| 375 | +ArkUI_ErrorCode OH_ArkUI_NativeModule_ImmersiveMaterial_GetLightEffectColor( | ||
| 376 | + ArkUI_ImmersiveMaterialHandle material, uint32_t* color); | ||
| 377 | + | ||
| 378 | + | ||
| 379 | +}; | ||
| 380 | + | ||
| 381 | + | ||
| 382 | + | ||
| 383 | +/** @} */ | ||
| @@ -2414,6 +2414,33 @@ typedef enum { | |||
| 2414 | */ | 2414 | */ |
| 2415 | NODE_ACCESSIBILITY_DEFAULT_FOCUS = 125, | 2415 | NODE_ACCESSIBILITY_DEFAULT_FOCUS = 125, |
| 2416 | 2416 | ||
| 2417 | + /** | ||
| 2418 | + * @brief Defines the system material attribute, which can be set, reset, and obtained as required through APIs. | ||
| 2419 | + * Only devices that support systemMaterial can use this attribute. Otherwise, when setting this attribute, | ||
| 2420 | + * the error code {@link ARKUI_ERROR_CODE_ATTRIBUTE_OR_EVENT_NOT_SUPPORTED} will be returned. | ||
| 2421 | + * Whether a device supports materials can be determined by calling | ||
| 2422 | + * {@link OH_ArkUI_NativeModule_GetSystemMaterialSupported}. | ||
| 2423 | + * The material effect behaves differently on devices with different level of computing powers. | ||
| 2424 | + * The level is defined by {@link ArkUI_MaterialLevel}, which can be obtained by | ||
| 2425 | + * {@link OH_ArkUI_NativeModule_GetGlobalMaterialLevel}. | ||
| 2426 | + * On devices with the computing power level of ARKUI_MATERIAL_LEVEL_SMOOTH, it affects attributes such as the | ||
| 2427 | + * backgroundColor, borderWidth, borderColor, shadow. | ||
| 2428 | + * On devices with the computing power levels of ARKUI_MATERIAL_LEVEL_EXQUISITE or ARKUI_MATERIAL_LEVEL_GENTLE, | ||
| 2429 | + * it affects shadow attribute and adds a filter effect at the system material layer, which can produce an effect | ||
| 2430 | + * similar to glass. | ||
| 2431 | + * | ||
| 2432 | + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n | ||
徐 | |||
| 2433 | + * .object: system material object. The parameter type is {@link ArkUI_ImmersiveMaterialHandle}.\n | ||
| 2434 | + * \n | ||
| 2435 | + * Format of the return value {@link ArkUI_AttributeItem}:\n | ||
| 2436 | + * .object: system material object. The parameter type is {@link ArkUI_ImmersiveMaterialHandle}.\n | ||
| 2437 | + * The ArkUI_ImmersiveMaterialHandle object of the return value is a pointer to static member, so do not release | ||
| 2438 | + * the return object by calling {@link OH_ArkUI_NativeModule_ImmersiveMaterial_Destroy}.\n | ||
| 2439 | + * | ||
| 2440 | + * @since 26.0.0 | ||
| 2441 | + */ | ||
| 2442 | + NODE_SYSTEM_MATERIAL = 127, | ||
| 2443 | + | ||
| 2417 | /** | 2444 | /** |
| 2418 | * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. | 2445 | * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. |
| 2419 | * | 2446 | * |
| @@ -30,6 +30,7 @@ | |||
| 30 | { "filePath": "arkui/ace_engine/native/native_event.h", "kitName": "NA", "subSystem": "ArkUI开发框架" }, | 30 | { "filePath": "arkui/ace_engine/native/native_event.h", "kitName": "NA", "subSystem": "ArkUI开发框架" }, |
| 31 | { "filePath": "arkui/ace_engine/native/native_gesture.h", "kitName": "NA", "subSystem": "ArkUI开发框架" }, | 31 | { "filePath": "arkui/ace_engine/native/native_gesture.h", "kitName": "NA", "subSystem": "ArkUI开发框架" }, |
| 32 | { "filePath": "arkui/ace_engine/native/native_interface.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, | 32 | { "filePath": "arkui/ace_engine/native/native_interface.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, |
| 33 | + { "filePath": "arkui/ace_engine/native/native_material.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, | ||
| 33 | { "filePath": "arkui/ace_engine/native/native_node.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, | 34 | { "filePath": "arkui/ace_engine/native/native_node.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, |
| 34 | { "filePath": "arkui/ace_engine/native/native_node_napi.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, | 35 | { "filePath": "arkui/ace_engine/native/native_node_napi.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, |
| 35 | { "filePath": "arkui/ace_engine/native/native_type.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, | 36 | { "filePath": "arkui/ace_engine/native/native_type.h", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" }, |
这里把
ArkUI_ImmersiveMaterialHandle放进ArkUI_AttributeItem.object,但文档只写了类型,没有写所有权/生命周期:set时节点是 Borrow、Copy 还是 Move?get返回的 handle 由谁释放,调用方能否在set后立即Dispose?对句柄型公共 API,这些语义必须写成稳定契约,否则很容易出现 UAF/重复释放。