drawable_descriptor.h
Overview
Declares the APIs of NativeDrawableDescriptor.
File to include: <arkui/drawable_descriptor.h>
Library: libace_ndk.z.so
System capability: SystemCapability.ArkUI.ArkUI.Full
Since: 12
Related module: ArkUI_NativeModule
Sample: DrawableDescriptorSample
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| ArkUI_DrawableDescriptor | ArkUI_DrawableDescriptor | Defines a struct for the DrawableDescriptor object. |
| OH_PixelmapNative | - | Defines an OH_PixelmapNative object on the native side using Image Kit. |
| OH_PixelmapNative* | OH_PixelmapNativeHandle | Defines a struct for the pointer to an OH_PixelmapNative object. |
| ArkUI_Node | - | Defines the ArkUI native component instance object. Since: 22 |
| ArkUI_Node* | ArkUI_NodeHandle | Defines the pointer type for an ArkUI native component instance object. Since: 22 |
| ArkUI_DrawableDescriptor_AnimationController | ArkUI_DrawableDescriptor_AnimationController | Defines the DrawableDescriptor animation controller object. Since: 22 |
Enums
| Name | typedef Keyword | Description |
|---|---|---|
| DrawableDescriptor_AnimationStatus | DrawableDescriptor_AnimationStatus | Enumerates the playback states of DrawableDescriptor animations. |
| DrawableDescriptor_AnimationStopMode | DrawableDescriptor_AnimationStopMode | Enumerates the stop modes of DrawableDescriptor animations. Since: 24 |
Functions
Enum Description
DrawableDescriptor_AnimationStatus
enum DrawableDescriptor_AnimationStatus
Description
Enumerates the playback states of DrawableDescriptor animations.
Since: 22
| Value | Description |
|---|---|
| DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_INITIAL = 0 | The animation is in the initial state. |
| DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_RUNNING = 1 | The animation is being played. |
| DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_PAUSED = 2 | The animation is paused. |
| DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_STOPPED = 3 | The animation is stopped. |
DrawableDescriptor_AnimationStopMode
enum DrawableDescriptor_AnimationStopMode
Description
Enumerates the stop modes of DrawableDescriptor animations.
Since: 24
| Value | Description |
|---|---|
| DRAWABLE_DESCRIPTOR_ANIMATION_FIRST_FRAME = 0 | The animation returns to the first frame when it stops. |
| DRAWABLE_DESCRIPTOR_ANIMATION_LAST_FRAME = 1 | The animation stays at the last frame when it stops. |
Function Description
OH_ArkUI_DrawableDescriptor_CreateFromPixelMap()
ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromPixelMap(OH_PixelmapNativeHandle pixelMap)
Description
Creates a DrawableDescriptor object from a PixelMap object.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_PixelmapNativeHandle pixelMap | Pointer to the OH_PixelmapNative object. |
Return value
| Type | Description |
|---|---|
| ArkUI_DrawableDescriptor* | Pointer to the DrawableDescriptor object. |
OH_ArkUI_DrawableDescriptor_CreateFromAnimatedPixelMap()
ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromAnimatedPixelMap(OH_PixelmapNativeHandle* array, int32_t size)
Description
Creates a DrawableDescriptor object from an array of PixelMap objects.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_PixelmapNativeHandle* array | Pointer to the array of PixelMap objects. |
| int32_t size | Size of the PixelMap object array. |
Return value
| Type | Description |
|---|---|
| ArkUI_DrawableDescriptor* | Pointer to the DrawableDescriptor object. |
OH_ArkUI_DrawableDescriptor_Dispose()
void OH_ArkUI_DrawableDescriptor_Dispose(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Disposes of the pointer to a DrawableDescriptor object.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
OH_ArkUI_DrawableDescriptor_GetStaticPixelMap()
OH_PixelmapNativeHandle OH_ArkUI_DrawableDescriptor_GetStaticPixelMap(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Obtains the pointer to a PixelMap object.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
Return value
| Type | Description |
|---|---|
| OH_PixelmapNativeHandle | Pointer to the OH_PixelmapNative object. |
OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray()
OH_PixelmapNativeHandle* OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Obtains an array of PixelMap objects for playing an animation.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
Return value
| Type | Description |
|---|---|
| OH_PixelmapNativeHandle* | Pointer to the array of PixelMap objects. |
OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Obtains an array of PixelMap objects for playing an animation.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
Return value
| Type | Description |
|---|---|
| int32_t | Size of the PixelMap object array. |
OH_ArkUI_DrawableDescriptor_SetAnimationDuration()
void OH_ArkUI_DrawableDescriptor_SetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t duration)
Description
Sets the total playback duration for an array of PixelMap objects.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| int32_t duration | Total playback duration, in ms. Value range: [0, +∞). If a negative value is passed in, 0 is used. |
OH_ArkUI_DrawableDescriptor_GetAnimationDuration()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Obtains the total playback duration for an array of PixelMap objects.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
Return value
| Type | Description |
|---|---|
| int32_t | Total playback duration, in ms. |
OH_ArkUI_DrawableDescriptor_SetAnimationIteration()
void OH_ArkUI_DrawableDescriptor_SetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t iteration)
Description
Sets the number of times that an array of PixelMap objects is played.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| int32_t iteration | Number of playback times. Value range: [0, +∞). The value 0 indicates infinite playback. If a negative value is passed in, 0 is used. |
OH_ArkUI_DrawableDescriptor_GetAnimationIteration()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor)
Description
Obtains the number of times that an array of PixelMap objects is played.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
Return value
| Type | Description |
|---|---|
| int32_t | Number of playback times. |
OH_ArkUI_DrawableDescriptor_SetAnimationFrameDurations()
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationFrameDurations(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* durations, size_t size)
Description
Sets the duration for each frame in a DrawableDescriptor animation.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| uint32_t* durations | Array of the playback durations for each frame in the animation, in ms. If this parameter is not set, the playback follows the total duration. This parameter takes precedence over OH_ArkUI_DrawableDescriptor_SetAnimationDuration. That is, if both OH_ArkUI_DrawableDescriptor_SetAnimationDuration and OH_ArkUI_DrawableDescriptor_SetAnimationFrameDurations are set, OH_ArkUI_DrawableDescriptor_SetAnimationDuration does not take effect. The array size must match the number of frames in the PixelMap image array. Valid range for each frame's playback duration: [0, +∞). Default value: evenly distributed total duration. |
| size_t size | Array size. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_GetAnimationFrameDurations()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationFrameDurations(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* durations, size_t* size)
Description
Obtains the duration of each frame in a DrawableDescriptor animation.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| uint32_t* durations | Array of the playback durations for each frame in the animation, in ms. |
| size_t* size | Array size. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_SetAnimationAutoPlay()
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationAutoPlay(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t autoPlay)
Description
Specifies whether to enable autoplay for a DrawableDescriptor animation.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| uint32_t autoPlay | Whether to enable autoplay. 1 to enable, 0 otherwise. The default value is 1. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_GetAnimationAutoPlay()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationAutoPlay(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* autoPlay)
Description
Checks whether autoplay is enabled for a DrawableDescriptor animation.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| uint32_t* autoPlay | Whether autoplay is enabled. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_SetAnimationStopMode()
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationStopMode(ArkUI_DrawableDescriptor* drawableDescriptor, DrawableDescriptor_AnimationStopMode mode)
Description
Sets the stop mode for an animation.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to the DrawableDescriptor object. |
| DrawableDescriptor_AnimationStopMode mode | Stop mode of an animation. The value is an enumerated value of DrawableDescriptor_AnimationStopMode. The default value is DRAWABLE_DESCRIPTOR_ANIMATION_FIRST_FRAME. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_GetAnimationStopMode()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationStopMode(const ArkUI_DrawableDescriptor* drawableDescriptor, DrawableDescriptor_AnimationStopMode* mode)
Description
Obtains the stop mode of an animation.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to the DrawableDescriptor object. |
| DrawableDescriptor_AnimationStopMode* mode | Stop mode of an animation. For details about the values, see DrawableDescriptor_AnimationStopMode. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_CreateAnimationController()
int32_t OH_ArkUI_DrawableDescriptor_CreateAnimationController(ArkUI_DrawableDescriptor* drawableDescriptor, ArkUI_NodeHandle node, ArkUI_DrawableDescriptor_AnimationController** controller)
Description
Creates an animation controller for the DrawableDescriptor.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor* drawableDescriptor | Pointer to a DrawableDescriptor object. |
| ArkUI_NodeHandle node | Pointer to the component node. |
| ArkUI_DrawableDescriptor_AnimationController** controller | Pointer to a DrawableDescriptor animation controller. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_DisposeAnimationController()
void OH_ArkUI_DrawableDescriptor_DisposeAnimationController(ArkUI_DrawableDescriptor_AnimationController* controller)
Description
Disposes of the DrawableDescriptor animation controller.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
OH_ArkUI_DrawableDescriptor_StartAnimation()
int32_t OH_ArkUI_DrawableDescriptor_StartAnimation(ArkUI_DrawableDescriptor_AnimationController* controller);
Description
Starts playback from the first frame.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_StopAnimation()
int32_t OH_ArkUI_DrawableDescriptor_StopAnimation(ArkUI_DrawableDescriptor_AnimationController* controller);
Description
Stops the DrawableDescriptor animation and returns to the first frame.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_ResumeAnimation()
int32_t OH_ArkUI_DrawableDescriptor_ResumeAnimation(ArkUI_DrawableDescriptor_AnimationController* controller);
Description
Resumes the DrawableDescriptor animation from the current frame.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_PauseAnimation()
int32_t OH_ArkUI_DrawableDescriptor_PauseAnimation(ArkUI_DrawableDescriptor_AnimationController* controller);
Description
Pauses playback on the current frame.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DrawableDescriptor_GetAnimationStatus()
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationStatus(ArkUI_DrawableDescriptor_AnimationController* controller, DrawableDescriptor_AnimationStatus* status);
Description
Obtains the playback status of the DrawableDescriptor animation.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_DrawableDescriptor_AnimationController* controller | Pointer to a DrawableDescriptor animation controller. |
| DrawableDescriptor_AnimationStatus* status | Playback state of the DrawableDescriptor animation. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller
openharmony 鸿蒙 errorcode-canvas
openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent
openharmony 鸿蒙 errorcode-bindSheet
openharmony 鸿蒙 js-apis-arkui-uiExtension-sys
openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo
openharmony 鸿蒙 capi-arkui-rendernodeutils
openharmony 鸿蒙 js-apis-arkui-node
openharmony 鸿蒙 capi-native-node-h
openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem