From 92c8c844a938af6cd99a82d3af439311f7052439 Mon Sep 17 00:00:00 2001 From: zhaona45 Date: Tue, 3 Jun 2025 15:36:42 +0800 Subject: [PATCH] Add OH_ImageSourceNative_CreatePictureAtIndex(). Signed-off-by: zhaona45 --- .../include/image/image_common.h | 34 +++++++++++++++---- .../include/image/image_source_native.h | 18 ++++++++++ .../image_framework/libimage_source.ndk.json | 4 +++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index da856df52..0c19aaffa 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -246,14 +246,22 @@ typedef enum { * @since 13 */ typedef enum { - /* - * EXIF metadata. - */ + /** + * EXIF metadata. + */ EXIF_METADATA = 1, - /* - * Fragment metadata. - */ + + /** + * Fragment metadata. + */ FRAGMENT_METADATA = 2, + + /** + * Metadata of a GIF image. + * + * @since 20 + */ + GIF_METADATA = 5 } Image_MetadataType; /** @@ -1586,6 +1594,20 @@ static const char *OHOS_IMAGE_PROPERTY_FRAGMENT_WIDTH = "FragmentImageWidth"; * @since 13 */ static const char *OHOS_IMAGE_PROPERTY_FRAGMENT_HEIGHT = "FragmentImageHeight"; + +/** + * @brief Delay of each frame in a GIF image. + * + * @since 20 + */ +static const char *IMAGE_PROPERTY_GIF_DELAY_TIME = "GifDelayTime"; + +/** + * @brief Disposal type of each frame in gif + * + * @since 20 + */ +static const char *IMAGE_PROPERTY_GIF_DISPOSAL_TYPE = "GifDisposalType"; #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index 3513d6095..9c89270a4 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -550,6 +550,24 @@ Image_ErrorCode OH_ImageSourceNative_CreatePixelmapList(OH_ImageSourceNative *so Image_ErrorCode OH_ImageSourceNative_CreatePicture(OH_ImageSourceNative *source, OH_DecodingOptionsForPicture *options, OH_PictureNative **picture); +/** + * @brief Decodes an image at the specified index into a Picture object. + * + * @param source Pointer to the image source. + * @param index Image index. + * @param picture Double pointer to the Picture object obtained after decoding. + * @return Returns one of the following result codes: + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_SOURCE} if the data source is abnormal. + * {@link IMAGE_SOURCE_UNSUPPORTED_MIMETYPE} if the image format is unsupported. + * {@link IMAGE_SOURCE_TOO_LARGE} if the image is too large. + * {@link IMAGE_SOURCE_UNSUPPORTED_OPTIONS} if the operation is not supported, for example, invalid index. + * {@link IMAGE_DECODE_FAILED} if decoding failed. + * @since 20 + */ +Image_ErrorCode OH_ImageSourceNative_CreatePictureAtIndex(OH_ImageSourceNative *source, uint32_t index, + OH_PictureNative **picture); + /** * @brief Obtains the delay time list from some ImageSource objects (such as GIF image sources). * diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index e95669459..552c473f8 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -182,5 +182,9 @@ { "first_introduced": "20", "name": "OH_ImageSourceNative_GetSupportedFormats" + }, + { + "first_introduced": "20", + "name": "OH_ImageSourceNative_CreatePictureAtIndex" } ] \ No newline at end of file -- Gitee