From 8abeabc9b1e5b7df9adb11827e9fba0f75e262ef Mon Sep 17 00:00:00 2001 From: y00656910 Date: Mon, 5 May 2025 15:16:31 +0800 Subject: [PATCH] add cropRegion interface Signed-off-by: y00656910 Change-Id: Ia4a5a5f760ac92e590da7166b294f24a25613f5d Signed-off-by: y00656910 --- .../include/image/image_common.h | 5 ++++ .../include/image/image_source_native.h | 24 +++++++++++++++++++ .../image_framework/libimage_source.ndk.json | 8 +++++++ 3 files changed, 37 insertions(+) diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index d17f95a5d5e..753fddaeba4 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -203,6 +203,11 @@ typedef enum { * @since 15 */ IMAGE_SOURCE_UNSUPPORTED_OPTIONS = 7700203, + /** + * @error Invalid parameter. + * @since 19 + */ + IMAGE_SOURCE_INVALID_PARAMETER = 7700204, /** decode failed */ IMAGE_DECODE_FAILED = 7700301, /** diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index faa19206730..43000f09264 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -362,6 +362,30 @@ Image_ErrorCode OH_DecodingOptions_GetCropAndScaleStrategy(OH_DecodingOptions *o Image_ErrorCode OH_DecodingOptions_SetDesiredDynamicRange(OH_DecodingOptions *options, int32_t desiredDynamicRange); +/** + * @brief Sets the crop region for the decoding options. + * + * @param options Pointer to the decoding options. + * @param cropRegion The target region will be cropped from the image. + * @return Returns one of the following result codes: + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. + * @since 19 + */ +Image_ErrorCode OH_DecodingOptions_SetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); + +/** + * @brief Gets the crop region for the decoding options. + * + * @param options Pointer to the decoding options. + * @param cropRegion The target region will be cropped from the image. + * @return Returns one of the following result codes: + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer. + * @since 19 + */ +Image_ErrorCode OH_DecodingOptions_GetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion); + /** * @brief delete OH_DecodingOptions pointer. * diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index ca6fab1a3a7..104bb376a28 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -79,6 +79,14 @@ "first_introduced": "18", "name": "OH_DecodingOptions_GetCropAndScaleStrategy" }, + { + "first_introduced": "19", + "name": "OH_DecodingOptions_SetCropRegion" + }, + { + "first_introduced": "19", + "name": "OH_DecodingOptions_GetCropRegion" + }, { "first_introduced": "12", "name": "OH_DecodingOptions_Release" -- Gitee