1 /* 2 * Copyright (c) 2024 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 12 24 */ 25 26 /** 27 * @file drawable_descriptor.h 28 * 29 * @brief Defines theNativeDrawableDescriptor for the native module. 30 * 31 * @library libace_ndk.z.so 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @since 12 34 */ 35 36 #ifndef ARKUI_NATIVE_DRAWABLE_DESCRIPTOR_H 37 #define ARKUI_NATIVE_DRAWABLE_DESCRIPTOR_H 38 39 #include <stdint.h> 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /** 46 * @brief Defines the drawable descriptor. 47 * 48 * @since 12 49 */ 50 typedef struct ArkUI_DrawableDescriptor ArkUI_DrawableDescriptor; 51 52 /** 53 * @brief Introduces the native pixel map information defined by Image Kit. 54 * 55 * @since 12 56 */ 57 struct OH_PixelmapNative; 58 59 /** 60 * @brief Defines the pointer to OH_PixelmapNative. 61 * 62 * @since 12 63 */ 64 typedef struct OH_PixelmapNative* OH_PixelmapNativeHandle; 65 66 /** 67 * @brief Creates a DrawableDescriptor from a Pixelmap. 68 * 69 * @param pixelMap Indicates the pointer to a Pixelmap 70 * @return Returns the pointer to the drawableDescriptor. 71 * @since 12 72 */ 73 ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromPixelMap(OH_PixelmapNativeHandle pixelMap); 74 75 /** 76 * @brief Creates a DrawableDescriptor from a Pixelmap array. 77 * 78 * @param array Indicates the pointer to a Pixelmap array. 79 * @param size Indicates the size of the Pixelmap array. 80 * @return Returns the pointer to the drawableDescriptor. 81 * @since 12 82 */ 83 ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromAnimatedPixelMap( 84 OH_PixelmapNativeHandle* array, int32_t size); 85 86 /** 87 * @brief Destroys the pointer to the drawableDescriptor. 88 * 89 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 90 * @since 12 91 */ 92 void OH_ArkUI_DrawableDescriptor_Dispose(ArkUI_DrawableDescriptor* drawableDescriptor); 93 94 /** 95 * @brief Obtains the Pixelmap object. 96 * 97 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 98 * @return Returns the pointer to the PixelMap. 99 * @since 12 100 */ 101 OH_PixelmapNativeHandle OH_ArkUI_DrawableDescriptor_GetStaticPixelMap(ArkUI_DrawableDescriptor* drawableDescriptor); 102 103 /** 104 * @brief Obtains the Pixelmap array used to play the animation. 105 * 106 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 107 * @return Returns the pointer to the PixelMap array. 108 * @since 12 109 */ 110 OH_PixelmapNativeHandle* OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray( 111 ArkUI_DrawableDescriptor* drawableDescriptor); 112 113 /** 114 * @brief Obtains the size of the Pixelmap array used to play the animation. 115 * 116 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 117 * @return Returns the size of the Pixelmap array. 118 * @since 12 119 */ 120 int32_t OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize(ArkUI_DrawableDescriptor* drawableDescriptor); 121 122 /** 123 * @brief Sets the total playback duration. 124 * 125 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 126 * @param duration Indicates the total playback duration. The unit is millisecond. 127 * @since 12 128 */ 129 void OH_ArkUI_DrawableDescriptor_SetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t duration); 130 131 /** 132 * @brief Obtains the total playback duration. 133 * 134 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 135 * @return Return the total playback duration. The unit is millisecond. 136 * @since 12 137 */ 138 int32_t OH_ArkUI_DrawableDescriptor_GetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor); 139 140 /** 141 * @brief Sets the number of playback times. 142 * 143 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 144 * @param iterations Indicates the number of playback times. 145 * @since 12 146 */ 147 void OH_ArkUI_DrawableDescriptor_SetAnimationIteration( 148 ArkUI_DrawableDescriptor* drawableDescriptor, int32_t iteration); 149 150 /** 151 * @brief Obtains the number of playback times. 152 * 153 * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. 154 * @return Returns the number of playback times. 155 * @since 12 156 */ 157 int32_t OH_ArkUI_DrawableDescriptor_GetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor); 158 #ifdef __cplusplus 159 }; 160 #endif 161 162 #endif // ARKUI_NATIVE_DRAWABLE_DESCRIPTOR_H 163 /** @} */ 164