diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index 7e54b94ef5f383016d0166855b7eb20ffd07396e..fbcccf0cb2dc285eb9785d29ce881f83694e40d4 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -394,6 +394,104 @@ Image_ErrorCode OH_ImageSourceNative_CreatePixelmapList(OH_ImageSourceNative *so Image_ErrorCode OH_ImageSourceNative_CreatePicture(OH_ImageSourceNative *source, OH_DecodingOptionsForPicture *options, OH_PictureNative **picture); +/** + * @brief Defines the options for decoding the thumbnail. + * It is used in {@link OH_ImageSourceNative_CreateThumbnail}. + * + * @since 18 + */ +struct OH_DecodingOptionsForThumbnail; +typedef struct OH_DecodingOptionsForThumbnail OH_DecodingOptionsForThumbnail; + +/** + * @brief Create a pointer for DecodingOptionsForThumbnail struct. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} options is nullptr. + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_Create(OH_DecodingOptionsForThumbnail **options); + +/** + * @brief Get desiredSize number for DecodingOptionsForThumbnail struct. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @param desiredSize The number of image desiredSize. + * @return Returns {@link Image_ErrorCode} + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_GetDesiredSize(OH_DecodingOptionsForThumbnail *options, + Image_Size *desiredSize); + +/** + * @brief Set desiredSize number for DecodingOptionsForThumbnail struct. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @param desiredSize The number of image desiredSize. + * @return Returns {@link Image_ErrorCode} + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_SetDesiredSize(OH_DecodingOptionsForThumbnail *options, + Image_Size *desiredSize); + +/** + * @brief Get needGenerate number for DecodingOptionsForThumbnail struct. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @param needGenerate Whether the thumbnail should be generated, if the image does not have a thumbnail. + * Default is false. + * @return Returns {@link Image_ErrorCode} + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_GetNeedGenerate(OH_DecodingOptionsForThumbnail *options, + bool *needGenerate); + +/** + * @brief Set needGenerate number for DecodingOptionsForThumbnail struct. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @param needGenerate Whether the thumbnail should be generated, if the image does not have a thumbnail. + * Default is false. + * @return Returns {@link Image_ErrorCode} + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_SetNeedGenerate(OH_DecodingOptionsForThumbnail *options, + bool *needGenerate); + +/** + * @brief Delete DecodingOptionsForThumbnail pointer. + * + * @param options The DecodingOptionsForThumbnail pointer will be operated. + * @return Returns {@link Image_ErrorCode} + * @since 18 + */ +Image_ErrorCode OH_DecodingOptionsForThumbnail_Release(OH_DecodingOptionsForThumbnail *options); + +/** + * @brief Create Thumbnail pointer from ImageSource + * based on the specified {@link OH_DecodingOptionsForThumbnail} struct. + * + * @param source Indicates a void pointer(from ImageSource pointer convert). + * @param options Indicates a pointer to the options for decoding the image source. + * For details, see {@link OH_DecodingOptionsForThumbnail}. + * @param pixelmap Indicates a void pointer to the Thumbnail Pixelmap object obtained at the C++ native layer. + * @return Error code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} source is nullptr, or picture is nullptr. + * {@link IMAGE_BAD_SOURCE} data source exception. + * {@link IMAGE_SOURCE_UNSUPPORTED_MIMETYPE} unsupported mime type. + * {@link IMAGE_SOURCE_TOO_LARGE} image to large. + * {@link IMAGE_SOURCE_UNSUPPORTED_OPTIONS} unsupported options, + * e.g, cannot convert image into desired pixel format. + * {@link IMAGE_DECODE_FAILED} decode failed. + * {@link IMAGE_SOURCE_ALLOC_FAILED} memory allocation failed. + * @since 18 + */ +Image_ErrorCode OH_ImageSourceNative_CreateThumbnail(OH_ImageSourceNative *source, + OH_DecodingOptionsForThumbnail *options, OH_PixelmapNative **pixelmap); + /** * @brief Obtains the delay time list from some ImageSource objects (such as GIF image sources). * diff --git a/multimedia/image_framework/include/image/picture_native.h b/multimedia/image_framework/include/image/picture_native.h index 42eed5065322b58ecc4cece094d222f4d51080f0..c0b4fb438b6382fa804be5b8751cc9a9efcc99cb 100644 --- a/multimedia/image_framework/include/image/picture_native.h +++ b/multimedia/image_framework/include/image/picture_native.h @@ -114,6 +114,11 @@ typedef enum { * Fragment map */ AUXILIARY_PICTURE_TYPE_FRAGMENT_MAP = 5, + /* + * Thumbnail + * @since 18 + */ + AUXILIARY_PICTURE_TYPE_THUMBNAIL = 6, } Image_AuxiliaryPictureType; /** diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index 37312763efbe5c189c070d93a8d3e90281c6eea7..975fcbc5e81fb5441097d16b2d9ba2cf86c6bc27 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -103,6 +103,34 @@ "first_introduced": "13", "name": "OH_ImageSourceNative_CreatePicture" }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_Create" + }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_GetDesiredSize" + }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_SetDesiredSize" + }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_GetNeedGenerate" + }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_SetNeedGenerate" + }, + { + "first_introduced": "18", + "name": "OH_DecodingOptionsForThumbnail_Release" + }, + { + "first_introduced": "18", + "name": "OH_ImageSourceNative_CreateThumbnail" + }, { "first_introduced": "12", "name": "OH_ImageSourceNative_GetDelayTimeList"