openharmony 鸿蒙 capi-drawable-descriptor-h

2026-08-25 浏览 (1)

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

Nametypedef KeywordDescription
ArkUI_DrawableDescriptorArkUI_DrawableDescriptorDefines a struct for the DrawableDescriptor object.
OH_PixelmapNative-Defines an OH_PixelmapNative object on the native side using Image Kit.
OH_PixelmapNative*OH_PixelmapNativeHandleDefines a struct for the pointer to an OH_PixelmapNative object.
ArkUI_Node-Defines the ArkUI native component instance object.
Since: 22
ArkUI_Node*ArkUI_NodeHandleDefines the pointer type for an ArkUI native component instance object.
Since: 22
ArkUI_DrawableDescriptor_AnimationControllerArkUI_DrawableDescriptor_AnimationControllerDefines the DrawableDescriptor animation controller object.
Since: 22

Enums

Nametypedef KeywordDescription
DrawableDescriptor_AnimationStatusDrawableDescriptor_AnimationStatusEnumerates the playback states of DrawableDescriptor animations.
DrawableDescriptor_AnimationStopModeDrawableDescriptor_AnimationStopModeEnumerates the stop modes of DrawableDescriptor animations.
Since: 24

Functions

NameDescription
ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromPixelMap(OH_PixelmapNativeHandle pixelMap)Creates a DrawableDescriptor object from a PixelMap object.
ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_CreateFromAnimatedPixelMap(OH_PixelmapNativeHandle* array, int32_t size)Creates a DrawableDescriptor object from an array of PixelMap objects.
void OH_ArkUI_DrawableDescriptor_Dispose(ArkUI_DrawableDescriptor* drawableDescriptor)Disposes of the pointer to a DrawableDescriptor object.
OH_PixelmapNativeHandle OH_ArkUI_DrawableDescriptor_GetStaticPixelMap(ArkUI_DrawableDescriptor* drawableDescriptor)Obtains the pointer to a PixelMap object.
OH_PixelmapNativeHandle* OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray(ArkUI_DrawableDescriptor* drawableDescriptor)Obtains an array of PixelMap objects for playing an animation.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize(ArkUI_DrawableDescriptor* drawableDescriptor)Obtains an array of PixelMap objects for playing an animation.
void OH_ArkUI_DrawableDescriptor_SetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t duration)Sets the total playback duration for an array of PixelMap objects.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor)Obtains the total playback duration for an array of PixelMap objects.
void OH_ArkUI_DrawableDescriptor_SetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t iteration)Sets the number of times that an array of PixelMap objects is played.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor)Obtains the number of times that an array of PixelMap objects is played.
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationFrameDurations(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* durations, size_t size)Sets the duration for each frame in a DrawableDescriptor animation.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationFrameDurations(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* durations, size_t* size)Obtains the duration of each frame in a DrawableDescriptor animation.
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationAutoPlay(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t autoPlay)Specifies whether to enable autoplay for a DrawableDescriptor animation.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationAutoPlay(ArkUI_DrawableDescriptor* drawableDescriptor, uint32_t* autoPlay)Checks whether autoplay is enabled for a DrawableDescriptor animation.
int32_t OH_ArkUI_DrawableDescriptor_SetAnimationStopMode(ArkUI_DrawableDescriptor* drawableDescriptor, DrawableDescriptor_AnimationStopMode mode)Sets the stop mode for an animation.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationStopMode(const ArkUI_DrawableDescriptor* drawableDescriptor, DrawableDescriptor_AnimationStopMode* mode)Obtains the stop mode of an animation.
int32_t OH_ArkUI_DrawableDescriptor_CreateAnimationController(ArkUI_DrawableDescriptor* drawableDescriptor, ArkUI_NodeHandle node, ArkUI_DrawableDescriptor_AnimationController** controller)Creates an animation controller for the DrawableDescriptor.
void OH_ArkUI_DrawableDescriptor_DisposeAnimationController( ArkUI_DrawableDescriptor_AnimationController* controller)Disposes of the DrawableDescriptor animation controller.
int32_t OH_ArkUI_DrawableDescriptor_StartAnimation(ArkUI_DrawableDescriptor_AnimationController* controller)Starts the DrawableDescriptor animation from the first frame.
int32_t OH_ArkUI_DrawableDescriptor_StopAnimation(ArkUI_DrawableDescriptor_AnimationController* controller)Stops the DrawableDescriptor animation and returns to the first frame.
int32_t OH_ArkUI_DrawableDescriptor_ResumeAnimation(ArkUI_DrawableDescriptor_AnimationController* controller)Resumes the DrawableDescriptor animation from the current frame.
int32_t OH_ArkUI_DrawableDescriptor_PauseAnimation(ArkUI_DrawableDescriptor_AnimationController* controller)Pauses the DrawableDescriptor animation at the current frame.
int32_t OH_ArkUI_DrawableDescriptor_GetAnimationStatus(ArkUI_DrawableDescriptor_AnimationController* controller, DrawableDescriptor_AnimationStatus* status)Obtains the playback status of the DrawableDescriptor animation.

Enum Description

DrawableDescriptor_AnimationStatus

enum DrawableDescriptor_AnimationStatus

Description

Enumerates the playback states of DrawableDescriptor animations.

Since: 22

ValueDescription
DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_INITIAL = 0The animation is in the initial state.
DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_RUNNING = 1The animation is being played.
DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_PAUSED = 2The animation is paused.
DRAWABLE_DESCRIPTOR_ANIMATION_STATUS_STOPPED = 3The animation is stopped.

DrawableDescriptor_AnimationStopMode

enum DrawableDescriptor_AnimationStopMode

Description

Enumerates the stop modes of DrawableDescriptor animations.

Since: 24

ValueDescription
DRAWABLE_DESCRIPTOR_ANIMATION_FIRST_FRAME = 0The animation returns to the first frame when it stops.
DRAWABLE_DESCRIPTOR_ANIMATION_LAST_FRAME = 1The 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

NameDescription
OH_PixelmapNativeHandle pixelMapPointer to the OH_PixelmapNative object.

Return value

TypeDescription
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

NameDescription
OH_PixelmapNativeHandle* arrayPointer to the array of PixelMap objects.
int32_t sizeSize of the PixelMap object array.

Return value

TypeDescription
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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.

Return value

TypeDescription
OH_PixelmapNativeHandlePointer 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.

Return value

TypeDescription
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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.

Return value

TypeDescription
int32_tSize 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
int32_t durationTotal 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.

Return value

TypeDescription
int32_tTotal 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
int32_t iterationNumber 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.

Return value

TypeDescription
int32_tNumber 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
uint32_t* durationsArray 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 sizeArray size.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
uint32_t* durationsArray of the playback durations for each frame in the animation, in ms.
size_t* sizeArray size.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
uint32_t autoPlayWhether to enable autoplay.
1 to enable, 0 otherwise.
The default value is 1.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
uint32_t* autoPlayWhether autoplay is enabled.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to the DrawableDescriptor object.
DrawableDescriptor_AnimationStopMode modeStop mode of an animation.
The value is an enumerated value of DrawableDescriptor_AnimationStopMode. The default value is DRAWABLE_DESCRIPTOR_ANIMATION_FIRST_FRAME.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to the DrawableDescriptor object.
DrawableDescriptor_AnimationStopMode* modeStop mode of an animation.
For details about the values, see DrawableDescriptor_AnimationStopMode.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor* drawableDescriptorPointer to a DrawableDescriptor object.
ArkUI_NodeHandle nodePointer to the component node.
ArkUI_DrawableDescriptor_AnimationController** controllerPointer to a DrawableDescriptor animation controller.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer to a DrawableDescriptor animation controller.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer to a DrawableDescriptor animation controller.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer to a DrawableDescriptor animation controller.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer to a DrawableDescriptor animation controller.

Return value

TypeDescription
int32_tResult 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

NameDescription
ArkUI_DrawableDescriptor_AnimationController* controllerPointer to a DrawableDescriptor animation controller.
DrawableDescriptor_AnimationStatus* statusPlayback state of the DrawableDescriptor animation.

Return value

TypeDescription
int32_tResult 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

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/fdSBkahc