From 9735fa8c65f8ce898fed1aa03ce54a98aae95b17 Mon Sep 17 00:00:00 2001 From: wangxinqiang007 Date: Mon, 29 Apr 2024 22:23:39 +0800 Subject: [PATCH] NDK-CAPI: add swiper/image/image_span attribute --- arkui/ace_engine/native/libace.ndk.json | 140 ++++++++++ arkui/ace_engine/native/native_node.h | 69 +++++ arkui/ace_engine/native/native_type.h | 340 ++++++++++++++++++++++++ 3 files changed, 549 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index a7c27f13b..bef95d3c0 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -714,5 +714,145 @@ { "first_introduced": "12", "name": "OH_NativeXComponent_GetNativeXComponent" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_Dispose" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetLeftPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetLeftPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetTopPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetTopPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetRightPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetRightPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetBottomPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetBottomPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetItemWidth" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetItemWidth" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetItemHeight" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetItemHeight" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetSelectedItemHeight" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetSelectedItemHeight" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetSelectedItemWidth" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetSelectedItemWidth" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetMask" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetMask" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetColor" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetColor" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_SetSelectedColor" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwiperIndicator_GetSelectedColor" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_Dispose" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_SetPixelMap" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_GetPixelMap" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_SetAnimatedPixelMapArray" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_SetAnimationDuration" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_GetAnimationDuration" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_SetAnimationIteration" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_DrawableDescriptor_GetAnimationIteration" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index c1fc53bc0..9a8fda90c 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -174,11 +174,13 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .string: image address;\n * .value[0]?.i32: whether to repeat the image. Optional. The parameter type is {@link ArkUI_ImageRepeat}. + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}. Either .string or .object must be set.\n * The default value is ARKUI_IMAGE_REPEAT_NONE.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: image address;\n * .value[0].i32: whether to repeat the image. The parameter type is {@link ArkUI_ImageRepeat}.\n + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}.\n * */ NODE_BACKGROUND_IMAGE, @@ -1705,9 +1707,11 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .string: image address of the image span.\n + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}. Either .string or .object must be set.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: image address of the image span.\n + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}.\n * */ NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, @@ -1731,9 +1735,11 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .string: image source.\n + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}. Either .string or .object must be set.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: image source.\n + * .objcet: The parameter type is {@link ArkUI_DrawableDescriptor}.\n * */ NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, @@ -1833,6 +1839,30 @@ typedef enum { * */ NODE_IMAGE_RENDER_MODE, + /** + * @brief Defines whether the image display size follows the image source size. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: wheter to follow, true means to follow.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: wheter to follow, true means to follow.\n + * + */ + NODE_IMAGE_FIT_ORIGINAL_SIZE, + /** + * @brief Defines the fill color of the swiper. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: fill color, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: fill color, in 0xARGB format. \n + * + */ + NODE_IMAGE_FILL_COLOR, /** * @brief Defines the color of the component when it is selected. * This attribute can be set, reset, and obtained as required through APIs. @@ -3532,6 +3562,45 @@ typedef enum { */ NODE_SWIPER_CACHED_COUNT, + /** + * @brief Defines the front margin of the wiper. + * The attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: the front margin. The unit is vp. The default value is 0.0\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: the front margin, the unit is vp. \n + * + */ + NODE_SWIPER_PREV_MARGIN, + + /** + * @brief Defines the back margin of the wiper. + * The attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: the back margin. The unit is vp. The default value is 0.0\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: the back margin, the unit is vp. \n + */ + NODE_SWIPER_NEXT_MARGIN, + + /** + * @brief Defines the navigation indicator type of the swiper. + * The attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n + * .object: The parameter type is {@link ArkUI_SwiperIndicator}.\n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n + * .object: The parameter type is {@link ArkUI_SwiperIndicator}.\n + * + */ + NODE_SWIPER_INDICATOR, + /** * @brief Defines the header of the list item group. * This attribute can be set, reset, and obtained as required through APIs. diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index f9038b369..4b8bfe110 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -37,6 +37,7 @@ #define ARKUI_NATIVE_TYPE_H #include +#include <> #ifdef __cplusplus extern "C" { @@ -112,6 +113,20 @@ struct ArkUI_Context; */ typedef struct ArkUI_Context* ArkUI_ContextHandle; +/** + * @brief Defines the navigation indicator style for the swiper. + * + * @since 12 + */ +typedef struct ArkUI_SwiperIndicator ArkUI_SwiperIndicator; + +/** + * @brief Defines the PixelMap operation capability supported by the swiper. + * + * @since 12 + */ +typedef struct ArkUI_DrawableDescriptor ArkUI_DrawableDescriptor; + /** * @brief Defines the event callback type. * @@ -1446,6 +1461,18 @@ typedef enum { ARKUI_LENGTH_METRIC_UNIT_FP } ArkUI_LengthMetricUnit; +/** + * @brief Define the navigation indicator type of the swiper. + * + * @since 12 + */ +typedef enum { + /** dot type. */ + ARKUI_SWIPER_INDICATOR_TYPE_DOT, + /** digit type. */ + ARKUI_SWIPER_INDICATOR_TYPE_DIGIT, +} ArkUI_SwiperIndicatorType; + /** * @brief Creates a size constraint. * @@ -1731,6 +1758,319 @@ ArkUI_Margin OH_ArkUI_WaterFlowSectionOption_GetMargin(ArkUI_WaterFlowSectionOpt * @since 12 */ int32_t OH_ArkUI_WaterFlowSectionOption_GetItemCount(ArkUI_WaterFlowSectionOption* option, int32_t index); + +/** + * @brief Creates a navigation indicator. + * + * @param type Indicates the type of the indicator. + * @return Returns the pointer to the new indicator. + * @since 12 +*/ +ArkUI_SwiperIndicator* OH_ArkUI_SwiperIndicator_Create(ArkUI_SwiperIndicatorType type); + +/** + * @brief Destroys the pointer to the indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_Dispose(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the distance between the navigation point and the left of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the distance between the navigation point and the left of the swiper. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetLeftPosition(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the distance between the navigation point and the left of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the distance between the navigation point and the left of the swiper. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetLeftPosition(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the distance between the navigation point and the top of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the distance between the navigation point and the top of the swiper. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetTopPosition(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the distance between the navigation point and the top of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the distance between the navigation point and the top of the swiper. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetTopPosition(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the distance between the navigation point and the right of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the distance between the navigation point and the right of the swiper. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetRightPosition(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the distance between the navigation point and the right of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the distance between the navigation point and the right of the swiper. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetRightPosition(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the distance between the navigation point and the bottom of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the distance between the navigation point and the bottom of the swiper. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetBottomPosition(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the distance between the navigation point and the bottom of the swiper. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the distance between the navigation point and the bottom of the swiper. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetBottomPosition(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the width of the dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the width of the dot for the dot indicator. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetItemWidth(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the width of the dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the width of the dot for the dot indicator. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetItemWidth(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the height of the dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the height of the dot for the dot indicator. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetItemHeight(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the height of the dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the height of the dot for the dot indicator. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetItemHeight(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the width of the selected dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the width of the selected dot for the dot indicator. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetSelectedItemWidth(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the width of the selected dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the width of the selected dot for the dot indicator. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetSelectedItemWidth(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the height of the selected dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param value Indicates the height of the selected dot for the dot indicator. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetSelectedItemHeight(ArkUI_SwiperIndicator* indicator, float value); + +/** + * @brief Obtains the height of the selected dot for the dot indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the height of the selected dot for the dot indicator. + * @since 12 +*/ +float OH_ArkUI_SwiperIndicator_GetSelectedItemHeight(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets whether to display the mask style of the dot navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param mask Whether to display the mask style. True means to display. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetMask(ArkUI_SwiperIndicator* indicator, int32_t mask); + +/** + * @brief Obtains whether to display the mask style of the dot navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns whether to display the mask style. True means to display. + * @since 12 +*/ +int32_t OH_ArkUI_SwiperIndicator_GetMask(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the color of the dot navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param color the color of the dot navigation indicator, in 0xARGB format. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetColor(ArkUI_SwiperIndicator* indicator, uint32_t color); + +/** + * @brief Obtains the color of the dot navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the color of the dot navigation indicator, in 0xARGB format. + * @since 12 +*/ +uint32_t OH_ArkUI_SwiperIndicator_GetColor(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Sets the color of the selected dot for the navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @param color the color of the selected dot, in 0xARGB format. + * @since 12 +*/ +void OH_ArkUI_SwiperIndicator_SetSelectedColor(ArkUI_SwiperIndicator* indicator, uint32_t selectedColor); + +/** + * @brief Obtains the color of the selected dot for the dot navigation indicator. + * + * @param indicator Indicates the pointer to the indicator. + * @return Returns the color of the selected dot, in 0xARGB format. + * @since 12 +*/ +uint32_t OH_ArkUI_SwiperIndicator_GetSelectedColor(ArkUI_SwiperIndicator* indicator); + +/** + * @brief Creates a DrawableDescriptor. + * + * @since 12 +*/ +ArkUI_DrawableDescriptor* OH_ArkUI_DrawableDescriptor_Create(); + +/** + * @brief Destroys the pointer to the drawableDescriptor. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @since 12 +*/ +void OH_ArkUI_DrawableDescriptor_Dispose(ArkUI_DrawableDescriptor* drawableDescriptor); + +/** + * @brief Sets the PixelMap for the drawableDescriptor. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @param map Indicates the pointer to the PixelMap. + * @since 12 +*/ +void OH_ArkUI_DrawableDescriptor_SetPixelMap(ArkUI_DrawableDescriptor* drawableDescriptor, NativePixelMap* map); + +/** + * @brief Obtains the PixelMap for the drawableDescriptor. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @return Returns the pointer to the PixelMap. + * @since 12 +*/ +NativePixelMap* OH_ArkUI_DrawableDescriptor_GetPixelMap(ArkUI_DrawableDescriptor* drawableDescriptor); + +/** + * @brief Sets the PixelMap array used to play the animation. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @param array Indicates the PixelMap array. + * @param size Indicates the size of the PixelMap array. + * @since 12 +*/ +void OH_ArkUI_DrawableDescriptor_SetAnimatedPixelMapArray( + ArkUI_DrawableDescriptor* drawableDescriptor, NativePixelMap** array, int32_t size); + +/** + * @brief Obtains the PixelMap array used to play the animation. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @return Returns the PixelMap array. + * @since 12 +*/ +NativePixelMap** OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArray(ArkUI_DrawableDescriptor* drawableDescriptor); + +/** + * @brief Obtains the size of the PixelMap array used to play the animation. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @return Returns the size of the PixelMap array. + * @since 12 +*/ +int32_t OH_ArkUI_DrawableDescriptor_GetAnimatedPixelMapArraySize(ArkUI_DrawableDescriptor* drawableDescriptor); + +/** + * @brief Sets the total playback duration. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @param duration Indicates the total playback duration. The unit is millisecond. + * @since 12 +*/ +void OH_ArkUI_DrawableDescriptor_SetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t duration); + +/** + * @brief Obtains the total playback duration. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @return Return the total playback duration. The unit is millisecond. + * @since 12 +*/ +int32_t OH_ArkUI_DrawableDescriptor_GetAnimationDuration(ArkUI_DrawableDescriptor* drawableDescriptor); + +/** + * @brief Sets the number of playback times. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @param iterations Indicates the number of playback times. + * @since 12 +*/ +void OH_ArkUI_DrawableDescriptor_SetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor, int32_t iteration); + +/** + * @brief Obtains the number of playback times. + * + * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. + * @return Returns the number of playback times. + * @since 12 +*/ +int32_t OH_ArkUI_DrawableDescriptor_GetAnimationIteration(ArkUI_DrawableDescriptor* drawableDescriptor); #ifdef __cplusplus }; #endif -- Gitee