From 08154bbb7c4145ed523a3c492a774a0c56747fd0 Mon Sep 17 00:00:00 2001 From: caochuan Date: Tue, 6 Aug 2024 09:52:49 +0800 Subject: [PATCH] =?UTF-8?q?Add=20ndk=20API=20for=20Picture=20=EF=BC=88cher?= =?UTF-8?q?ry=20picked=20commit=20from=20=20S?= =?UTF-8?q?igned-off-by:=20caochuan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multimedia/image_effect/image_effect.h | 28 + .../image_effect/libimage_effect.ndk.json | 8 + multimedia/image_framework/BUILD.gn | 37 +- .../include/image/image_common.h | 133 +++++ .../include/image/image_packer_native.h | 34 ++ .../include/image/image_source_native.h | 85 +++ .../include/image/picture_native.h | 490 ++++++++++++++++++ .../include/image/pixelmap_native.h | 8 +- .../image_framework/libimage_common.ndk.json | 22 + .../image_framework/libimage_packer.ndk.json | 8 + .../image_framework/libimage_source.ndk.json | 20 + .../image_framework/libpicture.ndk.json | 114 ++++ 12 files changed, 979 insertions(+), 8 deletions(-) create mode 100644 multimedia/image_framework/include/image/picture_native.h create mode 100644 multimedia/image_framework/libimage_common.ndk.json create mode 100644 multimedia/image_framework/libpicture.ndk.json diff --git a/multimedia/image_effect/image_effect.h b/multimedia/image_effect/image_effect.h index 921d8a5b0..b1bb66de6 100644 --- a/multimedia/image_effect/image_effect.h +++ b/multimedia/image_effect/image_effect.h @@ -40,6 +40,7 @@ #include "image_effect_filter.h" #include "native_buffer/native_buffer.h" #include "native_window/external_window.h" +#include "multimedia/image_framework/image/picture_native.h" #ifdef __cplusplus extern "C" { @@ -315,6 +316,33 @@ ImageEffect_ErrorCode OH_ImageEffect_SetInputUri(OH_ImageEffect *imageEffect, co */ ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri(OH_ImageEffect *imageEffect, const char *uri); +/** + * @brief Set input picture that contains the image information. It should be noted that the input picture will be + * directly rendered and modified if the output is not set + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer + * @param picture Indicates the OH_PictureNative that contains the image information + * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to + * {@link ImageEffect_ErrorCode} + * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. + * @since 12 + */ +ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture); + +/** + * @brief Set output picture that contains the image information + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @param imageEffect Encapsulate OH_ImageEffect structure instance pointer + * @param picture Indicates the OH_PictureNative that contains the image information + * @return Returns EFFECT_SUCCESS if the execution is successful, otherwise returns a specific error code, refer to + * {@link ImageEffect_ErrorCode} + * {@link EFFECT_ERROR_PARAM_INVALID}, the input parameter is a null pointer. + * @since 12 + */ +ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture); + /** * @brief Render the filter effects that can be a single filter or a chain of filters * diff --git a/multimedia/image_effect/libimage_effect.ndk.json b/multimedia/image_effect/libimage_effect.ndk.json index 6b3c6abab..99226c04a 100644 --- a/multimedia/image_effect/libimage_effect.ndk.json +++ b/multimedia/image_effect/libimage_effect.ndk.json @@ -203,6 +203,14 @@ "first_introduced": "12", "name": "OH_ImageEffect_SetOutputUri" }, + { + "first_introduced": "12", + "name": "OH_ImageEffect_SetInputPicture" + }, + { + "first_introduced": "12", + "name": "OH_ImageEffect_SetOutputPicture" + }, { "first_introduced": "12", "name": "OH_ImageEffect_Start" diff --git a/multimedia/image_framework/BUILD.gn b/multimedia/image_framework/BUILD.gn index be2610e97..9b5e9895a 100644 --- a/multimedia/image_framework/BUILD.gn +++ b/multimedia/image_framework/BUILD.gn @@ -44,6 +44,38 @@ ohos_ndk_headers("libpixelmap_header") { sources = [ "./include/image/pixelmap_native.h" ] } +ohos_ndk_library("libpicture") { + ndk_description_file = "./libpicture.ndk.json" + output_name = "picture" + output_extension = "so" + min_compact_version = "12" + system_capability = "SystemCapability.Multimedia.Image.Core" + system_capability_headers = [ + "multimedia/image_framework/image/picture_native.h", + "multimedia/image_framework/image/image_common.h", + ] +} + +ohos_ndk_headers("libpicture_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework/image" + sources = [ "./include/image/picture_native.h" ] +} + +ohos_ndk_library("libimage_common") { + ndk_description_file = "./libimage_common.ndk.json" + output_name = "image_common" + output_extension = "so" + min_compact_version = "12" + system_capability = "SystemCapability.Multimedia.Image.Core" + system_capability_headers = + [ "multimedia/image_framework/image/image_common.h" ] +} + +ohos_ndk_headers("libimage_common_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/image_framework/image" + sources = [ "./include/image/image_common.h" ] +} + ohos_ndk_library("libimage_ndk") { ndk_description_file = "./libimage_ndk.ndk.json" min_compact_version = "1" @@ -119,10 +151,7 @@ ohos_ndk_library("libohimage") { ohos_ndk_headers("ohimage_header") { dest_dir = "$ndk_headers_out_dir/multimedia/image_framework/image" - sources = [ - "./include/image/image_common.h", - "./include/image/image_native.h", - ] + sources = [ "./include/image/image_native.h" ] } ohos_ndk_library("libimage_receiver") { diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index 6e50d7764..f44cf9b9a 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -95,6 +95,20 @@ struct Image_String { size_t size = 0; }; +/** + * @brief Define a PictureMetadata struct type, used for picture metadata. + * + * @since 12 + */ +struct OH_PictureMetadata; + +/** + * @brief Define a PictureMetadata struct type, used for picture metadata. + * + * @since 12 + */ +typedef struct OH_PictureMetadata OH_PictureMetadata; + /** * @brief Defines the property string (in key-value format) of the image source. * @@ -147,6 +161,89 @@ typedef enum { IMAGE_ENCODE_FAILED = 7800301, } Image_ErrorCode; +/** + * @brief Define the metadata type. + * + * @since 12 + */ +typedef enum { + /* + * EXIF metadata. + */ + EXIF_METADATA = 1, + /* + * Fragment metadata. + */ + FRAGMENT_METADATA = 2, +} Image_MetadataType; + +/** + * @brief Creates a PictureMetadata object. + * + * @param metadataType The type of metadata. + * @param metadata The PictureMetadata pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} metadata is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureMetadata_Create(Image_MetadataType metadataType, OH_PictureMetadata **metadata); + +/** + * @brief Obtains the property of picture metadata. + * + * @param metadata The PictureMetadata pointer will be operated. + * @param key The property's key. + * @param value The property's value. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} metadata is nullptr, or key is nullptr, or value is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type, or the metadata type does not match the + * auxiliary picture type. + * @since 12 + */ +Image_ErrorCode OH_PictureMetadata_GetProperty(OH_PictureMetadata *metadata, Image_String *key, Image_String *value); + +/** + * @brief Set picture metadata property. + * + * @param metadata The PictureMetadata pointer will be operated. + * @param key The property's key. + * @param value The property's value. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} metadata is nullptr, or key is nullptr, or value is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type, or the metadata type does not match the + * auxiliary picture type. + * @since 12 + */ +Image_ErrorCode OH_PictureMetadata_SetProperty(OH_PictureMetadata *metadata, Image_String *key, Image_String *value); + +/** + * @brief Releases this PictureMetadata object. + * + * @param metadata The PictureMetadata pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} metadata is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureMetadata_Release(OH_PictureMetadata *metadata); + +/** + * @brief Obtains a clone of metadata. + * + * @param oldMetadata The PictureMetadata pointer will be operated. + * @param newMetadata The PictureMetadata pointer will be cloned. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} metadata is nullptr. + * {@link IMAGE_ALLOC_FAILED} memory alloc failed. + * {@link IMAGE_COPY_FAILED} memory copy failed. + * @since 12 + */ +Image_ErrorCode OH_PictureMetadata_Clone(OH_PictureMetadata *oldMetadata, OH_PictureMetadata **newMetadata); + /** * @brief Defines the bmp mime type. * @@ -1333,6 +1430,42 @@ static const char *OHOS_IMAGE_PROPERTY_WIND_SNAPSHOT_MODE = "HwMnoteWindSnapshot * @since 12 */ static const char *OHOS_IMAGE_PROPERTY_GIF_LOOP_COUNT = "GIFLoopCount"; + +/** + * @brief X in original + * It is used in {@link OH_ImageSource_GetImageProperty}. + * The top left corner of the fragment image is at the X-coordinate of the original image + * + * @since 12 + */ +static const char *OHOS_IMAGE_PROPERTY_X_IN_ORIGINAL = "XInOriginal"; + +/** + * @brief Y in original + * It is used in {@link OH_ImageSource_GetImageProperty}. + * The top left corner of the fragment image is at the Y-coordinate of the original image + * + * @since 12 + */ +static const char *OHOS_IMAGE_PROPERTY_Y_IN_ORIGINAL = "YInOriginal"; + +/** + * @brief Fragment map width + * It is used in {@link OH_ImageSource_GetImageProperty}. + * The width of the fragment image + * + * @since 12 + */ +static const char *OHOS_IMAGE_PROPERTY_FRAGMENT_WIDTH = "FragmentImageWidth"; + +/** + * @brief Fragment map height + * It is used in {@link OH_ImageSource_GetImageProperty}. + * The height of the fragment image + * + * @since 12 + */ +static const char *OHOS_IMAGE_PROPERTY_FRAGMENT_HEIGHT = "FragmentImageHeight"; #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/include/image/image_packer_native.h b/multimedia/image_framework/include/image/image_packer_native.h index 6a5a4e9b5..bef398006 100644 --- a/multimedia/image_framework/include/image/image_packer_native.h +++ b/multimedia/image_framework/include/image/image_packer_native.h @@ -219,6 +219,24 @@ Image_ErrorCode OH_ImagePackerNative_PackToDataFromImageSource(OH_ImagePackerNat Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmap(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PixelmapNative *pixelmap, uint8_t *outData, size_t *size); +/** + * @brief Encoding a Picture into the data with required format. + * + * @param imagePacker The imagePacker to use for packing. + * @param options Indicates the encoding {@link OH_PackingOptions}. + * @param picture The picture to be packed. + * @param outData The output data buffer to store the packed image. + * @param size A pointer to the size of the output data buffer. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} imagePacker is nullptr, or picture is nullptr, or outData is nullptr, + * or size is invalid. + * {@link IMAGE_ENCODE_FAILED} encode failed. + * @since 12 + */ +Image_ErrorCode OH_ImagePackerNative_PackToDataFromPicture(OH_ImagePackerNative *imagePacker, + OH_PackingOptions *options, OH_PictureNative *picture, uint8_t *outData, size_t *size); + /** * @brief Encoding an ImageSource into the a file with fd with required format. * @@ -245,6 +263,22 @@ Image_ErrorCode OH_ImagePackerNative_PackToFileFromImageSource(OH_ImagePackerNat Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmap(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PixelmapNative *pixelmap, int32_t fd); +/** + * @brief Encoding a Picture into the a file with fd with required format. + * + * @param imagePacker The imagePacker to use for packing. + * @param options Indicates the encoding {@link OH_PackingOptions}. + * @param picture The picture to be packed. + * @param fd Indicates a writable file descriptor. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} imagePacker is nullptr, or picture is nullptr, or fd is invalid. + * {@link IMAGE_ENCODE_FAILED} encode failed. + * @since 12 + */ +Image_ErrorCode OH_ImagePackerNative_PackToFileFromPicture(OH_ImagePackerNative *imagePacker, + OH_PackingOptions *options, OH_PictureNative *picture, int32_t fd); + /** * @brief Releases an imagePacker object. * diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index 72cf4dae2..803fe4928 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -38,6 +38,7 @@ #include "image_common.h" #include "pixelmap_native.h" +#include "picture_native.h" #include "rawfile/raw_file.h" #ifdef __cplusplus @@ -61,6 +62,22 @@ typedef struct OH_ImageSourceNative OH_ImageSourceNative; struct OH_ImageSource_Info; typedef struct OH_ImageSource_Info OH_ImageSource_Info; +/** + * @brief Defines decoding options for picture + * {@link OH_DecodingOptionsForPicture_Create}. + * + * @since 12 + */ +struct OH_DecodingOptionsForPicture; + +/** + * @brief Defines decoding options for picture + * {@link OH_DecodingOptionsForPicture_Create}. + * + * @since 12 + */ +typedef struct OH_DecodingOptionsForPicture OH_DecodingOptionsForPicture; + /** * @brief Enumerates decoding dynamic range.. * @@ -360,6 +377,23 @@ Image_ErrorCode OH_ImageSourceNative_CreatePixelmap(OH_ImageSourceNative *source Image_ErrorCode OH_ImageSourceNative_CreatePixelmapList(OH_ImageSourceNative *source, OH_DecodingOptions *options, OH_PixelmapNative *resVecPixMap[], size_t size); +/** + * @brief Create Picture pointer from ImageSource + * based on the specified {@link OH_DecodingOptionsForPicture} 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_DecodingOptionsForPicture}. + * @param picture Indicates a void pointer to the Picture object obtained at the C++ native layer. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} source is nullptr, or picture is nullptr. + * {@link IMAGE_DECODE_FAILED} decode failed. + * @since 12 + */ +Image_ErrorCode OH_ImageSourceNative_CreatePicture(OH_ImageSourceNative *source, OH_DecodingOptionsForPicture *options, + OH_PictureNative **picture); + /** * @brief Obtains the delay time list from some ImageSource objects (such as GIF image sources). * @@ -429,6 +463,57 @@ Image_ErrorCode OH_ImageSourceNative_GetFrameCount(OH_ImageSourceNative *source, */ Image_ErrorCode OH_ImageSourceNative_Release(OH_ImageSourceNative *source); +/** + * @brief Create a pointer for OH_DecodingOptionsForPicture struct. + * + * @param options The OH_DecodingOptionsForPicture 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 12 + */ +Image_ErrorCode OH_DecodingOptionsForPicture_Create(OH_DecodingOptionsForPicture **options); + +/** + * @brief Obtains the desired auxiliary pictures of decoding options. + * + * @param options The OH_DecodingOptionsForPicture pointer will be operated. + * @param desiredAuxiliaryPictures The desired auxiliary pictures in DecodingOptionsForPicture. + * @param length The length of desired auxiliary pictures. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} options is nullptr, desiredAuxiliaryPictures is nullptr, + * or length is invalid. + * @since 12 + */ +Image_ErrorCode OH_DecodingOptionsForPicture_GetDesiredAuxiliaryPictures(OH_DecodingOptionsForPicture *options, + Image_AuxiliaryPictureType **desiredAuxiliaryPictures, size_t *length); + +/** + * @brief Set decoding options desired auxiliary pictures. + * + * @param options The OH_DecodingOptionsForPicture pointer will be operated. + * @param desiredAuxiliaryPictures The desired auxiliary pictures will be set. + * @param length The length of desired auxiliary pictures. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} options is nullptr, desiredAuxiliaryPictures is nullptr, + * or length is invalid. + * @since 12 + */ +Image_ErrorCode OH_DecodingOptionsForPicture_SetDesiredAuxiliaryPictures(OH_DecodingOptionsForPicture *options, + Image_AuxiliaryPictureType *desiredAuxiliaryPictures, size_t length); + +/** + * @brief Releases an DecodingOptionsForPicture object. + * + * @param options Indicates a DecodingOptionsForPicture pointer. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} options is nullptr. + * @since 12 + */ +Image_ErrorCode OH_DecodingOptionsForPicture_Release(OH_DecodingOptionsForPicture *options); #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/include/image/picture_native.h b/multimedia/image_framework/include/image/picture_native.h new file mode 100644 index 000000000..36b012402 --- /dev/null +++ b/multimedia/image_framework/include/image/picture_native.h @@ -0,0 +1,490 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief Provides APIs for obtaining picture data and information. + * + * @Syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + +/** + * @file picture_native.h + * + * @brief Declares the APIs that can access a picture. + * + * @library libpicture.so + * @Syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PICTURE_NATIVE_H_ +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PICTURE_NATIVE_H_ +#include "image_common.h" +#include "pixelmap_native.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define a Picture struct type, used for picture pointer controls. + * + * @since 12 + */ +struct OH_PictureNative; + +/** + * @brief Define a Picture struct type, used for picture pointer controls. + * + * @since 12 + */ +typedef struct OH_PictureNative OH_PictureNative; + +/** + * @brief Define a AuxiliaryPicture struct type, used for auxiliary + * picture pointer controls. + * + * @since 12 + */ +struct OH_AuxiliaryPictureNative; + +/** + * @brief Define a AuxiliaryPicture struct type, used for auxiliary + * picture pointer controls. + * + * @since 12 + */ +typedef struct OH_AuxiliaryPictureNative OH_AuxiliaryPictureNative; + +/** + * @brief Define a AuxiliaryPictureInfo struct type, used for auxiliary + * picture info controls. + * + * @since 12 + */ +struct OH_AuxiliaryPictureInfo; + +/** + * @brief Define a AuxiliaryPictureInfo struct type, used for auxiliary + * picture info controls. + * + * @since 12 + */ +typedef struct OH_AuxiliaryPictureInfo OH_AuxiliaryPictureInfo; + +/** + * @brief Define a auxiliary picture type. + * + * @since 12 + */ +typedef enum { + /* + * Gainmap + */ + AUXILIARY_PICTURE_TYPE_GAINMAP = 1, + /* + * Depth map + */ + AUXILIARY_PICTURE_TYPE_DEPTH_MAP = 2, + /* + * Unrefocus map + */ + AUXILIARY_PICTURE_TYPE_UNREFOCUS_MAP = 3, + /* + * Linear map + */ + AUXILIARY_PICTURE_TYPE_LINEAR_MAP = 4, + /* + * Fragment map + */ + AUXILIARY_PICTURE_TYPE_FRAGMENT_MAP = 5, +} Image_AuxiliaryPictureType; + +/** + * @brief Create a Picture object. + * + * @param mainPixelmap The pixel map of the main image. + * @param picture Picture pointer for created. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} mainPixelmap is nullptr, or picture is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_CreatePicture(OH_PixelmapNative *mainPixelmap, OH_PictureNative **picture); + +/** + * @brief Obtains the pixel map of the main image. + * + * @param picture The Picture pointer will be operated. + * @param mainPixelmap Main pixel map pointer for obtained. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or mainPixelmap is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_GetMainPixelmap(OH_PictureNative *picture, OH_PixelmapNative **mainPixelmap); + +/** + * @brief Obtains the hdr pixel map. + * + * @param picture The Picture pointer will be operated. + * @param hdrPixelmap Hdr pixel map pointer for obtained. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or hdrPixelmap is nullptr. + * {@link IMAGE_UNSUPPORTED_OPERATION} Unsupported operation, e.g. the picture does not has a gainmap + * @since 12 + */ +Image_ErrorCode OH_PictureNative_GetHdrComposedPixelmap(OH_PictureNative *picture, OH_PixelmapNative **hdrPixelmap); + +/** + * @brief Obtains the gainmap pixel map. + * + * @param picture The Picture pointer will be operated. + * @param gainmapPixelmap Gainmap pointer for obtained. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or gainmapPixelmap is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_GetGainmapPixelmap(OH_PictureNative *picture, OH_PixelmapNative **gainmapPixelmap); + +/** + * @brief Set auxiliary picture. + * + * @param picture The Picture pointer will be operated. + * @param type The type of auxiliary picture. + * @param auxiliaryPicture AuxiliaryPicture object. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or auxiliaryPicture is nullptr, or the type is invalid. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_SetAuxiliaryPicture(OH_PictureNative *picture, Image_AuxiliaryPictureType type, + OH_AuxiliaryPictureNative *auxiliaryPicture); + +/** + * @brief Obtains the auxiliary picture based on type. + * + * @param picture The Picture pointer will be operated. + * @param type The type of auxiliary picture. + * @param auxiliaryPicture AuxiliaryPicture pointer for obtained. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or auxiliaryPicture is nullptr, or the type is invalid. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_GetAuxiliaryPicture(OH_PictureNative *picture, Image_AuxiliaryPictureType type, + OH_AuxiliaryPictureNative **auxiliaryPicture); + +/** + * @brief Obtains the metadata of main picture. + * + * @param picture The Picture pointer will be operated. + * @param metadataType The type of metadata. + * @param metadata The metadata of main picture. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or metadata is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_GetMetadata(OH_PictureNative *picture, Image_MetadataType metadataType, + OH_PictureMetadata **metadata); + +/** + * @brief Set main picture metadata. + * + * @param picture The Picture pointer will be operated. + * @param metadataType The type of metadata. + * @param metadata The metadata will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr, or metadata is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_SetMetadata(OH_PictureNative *picture, Image_MetadataType metadataType, + OH_PictureMetadata *metadata); + +/** + * @brief Releases this Picture object. + * + * @param picture The Picture pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr. + * @since 12 + */ +Image_ErrorCode OH_PictureNative_Release(OH_PictureNative *picture); + +/** + * @brief Create a AuxiliaryPicture object. + * + * @param data The image data buffer. + * @param dataLength The length of data. + * @param size The size of auxiliary picture. + * @param type The type of auxiliary picture. + * @param auxiliaryPicture AuxiliaryPicture pointer for created. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} data is nullptr, or dataLength is invalid, or size is nullptr, or the type + * is invalid, or auxiliaryPicture is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_Create(uint8_t *data, size_t dataLength, Image_Size *size, + Image_AuxiliaryPictureType type, OH_AuxiliaryPictureNative **auxiliaryPicture); + +/** + * @brief Write pixels to auxiliary picture. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param source The pixels will be written. + * @param bufferSize The size of pixels. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or source is nullptr, or the bufferSize is invalid. + * {@link IMAGE_ALLOC_FAILED} memory alloc failed. + * {@link IMAGE_COPY_FAILED} memory copy failed. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_WritePixels(OH_AuxiliaryPictureNative *auxiliaryPicture, uint8_t *source, + size_t bufferSize); + +/** + * @brief Read pixels from auxiliary picture. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param destination The pixels will be read. + * @param bufferSize The size of pixels for reading. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or destination is nullptr, + * or the bufferSize is invalid. + * {@link IMAGE_ALLOC_FAILED} memory alloc failed. + * {@link IMAGE_COPY_FAILED} memory copy failed. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_ReadPixels(OH_AuxiliaryPictureNative *auxiliaryPicture, uint8_t *destination, + size_t *bufferSize); + +/** + * @brief Obtains the type of auxiliary picture. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param type The type of auxiliary picture. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or type is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_GetType(OH_AuxiliaryPictureNative *auxiliaryPicture, + Image_AuxiliaryPictureType *type); + +/** + * @brief Obtains the info of auxiliary picture. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param info The info of auxiliary picture. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or info is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_GetInfo(OH_AuxiliaryPictureNative *auxiliaryPicture, + OH_AuxiliaryPictureInfo **info); + +/** + * @brief Set auxiliary picture info. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param info The info will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or info is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_SetInfo(OH_AuxiliaryPictureNative *auxiliaryPicture, + OH_AuxiliaryPictureInfo *info); + +/** + * @brief Obtains the metadata of auxiliary picture. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param metadataType The type of metadata. + * @param metadata The metadata of auxiliary picture. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or metadata is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type, or the metadata type does not match the + * auxiliary picture type. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_GetMetadata(OH_AuxiliaryPictureNative *auxiliaryPicture, + Image_MetadataType metadataType, OH_PictureMetadata **metadata); + +/** + * @brief Set auxiliary picture metadata. + * + * @param auxiliaryPicture The AuxiliaryPicture pointer will be operated. + * @param metadataType The type of metadata. + * @param metadata The metadata will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} auxiliaryPicture is nullptr, or metadata is nullptr. + * {@link IMAGE_UNSUPPORTED_METADATA} unsupported metadata type, or the metadata type does not match the + * auxiliary picture type. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_SetMetadata(OH_AuxiliaryPictureNative *auxiliaryPicture, + Image_MetadataType metadataType, OH_PictureMetadata *metadata); + +/** + * @brief Releases this AuxiliaryPicture object. + * + * @param picture The Picture pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} picture is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureNative_Release(OH_AuxiliaryPictureNative *picture); + +/** + * @brief Create a AuxiliaryPictureInfo object. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_Create(OH_AuxiliaryPictureInfo **info); + +/** + * @brief Obtains the type of auxiliary picture info. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param type The type of auxiliary picture info. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or type is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_GetType(OH_AuxiliaryPictureInfo *info, Image_AuxiliaryPictureType *type); + +/** + * @brief Set auxiliary picture info type. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param type The type will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or type is invalid. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_SetType(OH_AuxiliaryPictureInfo *info, Image_AuxiliaryPictureType type); + +/** + * @brief Obtains the size of auxiliary picture info. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param size The size of auxiliary picture info. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or size is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_GetSize(OH_AuxiliaryPictureInfo *info, Image_Size *size); + +/** + * @brief Set auxiliary picture info size. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param size The size will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or size is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_SetSize(OH_AuxiliaryPictureInfo *info, Image_Size *size); + +/** + * @brief Obtains the rowStride of auxiliary picture info. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param rowStride The rowStride of auxiliary picture info. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or rowStride is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_GetRowStride(OH_AuxiliaryPictureInfo *info, uint32_t *rowStride); + +/** + * @brief Set auxiliary picture info rowStride. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param rowStride The rowStride will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or rowStride is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_SetRowStride(OH_AuxiliaryPictureInfo *info, uint32_t rowStride); + +/** + * @brief Obtains the pixelFormat of auxiliary picture info. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param pixelFormat The pixelFormat will be get. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr, or pixelFormat is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_GetPixelFormat(OH_AuxiliaryPictureInfo *info, PIXEL_FORMAT *pixelFormat); + +/** + * @brief Set auxiliary picture info pixelFormat. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @param pixelFormat The pixelFormat will be set. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_SetPixelFormat(OH_AuxiliaryPictureInfo *info, PIXEL_FORMAT pixelFormat); + +/** + * @brief Releases this AuxiliaryPictureInfo object. + * + * @param info The AuxiliaryPictureInfo pointer will be operated. + * @return Image functions result code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} info is nullptr. + * @since 12 + */ +Image_ErrorCode OH_AuxiliaryPictureInfo_Release(OH_AuxiliaryPictureInfo *info); + +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif //INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PICTURE_NATIVE_H_ \ No newline at end of file diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 5f8be7c78..875bafe5b 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -171,19 +171,19 @@ typedef enum { /** * No metadata. */ - NONE = 0, + HDR_METADATA_TYPE_NONE = 0, /** * Indicates that metadata will be used for the base image. */ - BASE = 1, + HDR_METADATA_TYPE_BASE = 1, /** * Indicates that metadata will be used for the gainmap image. */ - GAINMAP = 2, + HDR_METADATA_TYPE_GAINMAP = 2, /** * Indicates that metadata will be used for the alternate image. */ - ALTERNATE = 3, + HDR_METADATA_TYPE_ALTERNATE = 3, } OH_Pixelmap_HdrMetadataType; /** diff --git a/multimedia/image_framework/libimage_common.ndk.json b/multimedia/image_framework/libimage_common.ndk.json new file mode 100644 index 000000000..9faa63b59 --- /dev/null +++ b/multimedia/image_framework/libimage_common.ndk.json @@ -0,0 +1,22 @@ +[ + { + "first_introduced": "12", + "name": "OH_PictureMetadata_Create" + }, + { + "first_introduced": "12", + "name": "OH_PictureMetadata_GetProperty" + }, + { + "first_introduced": "12", + "name": "OH_PictureMetadata_SetProperty" + }, + { + "first_introduced": "12", + "name": "OH_PictureMetadata_Release" + }, + { + "first_introduced": "12", + "name": "OH_PictureMetadata_Clone" + } +] \ No newline at end of file diff --git a/multimedia/image_framework/libimage_packer.ndk.json b/multimedia/image_framework/libimage_packer.ndk.json index 0b5efcecf..3488cb646 100644 --- a/multimedia/image_framework/libimage_packer.ndk.json +++ b/multimedia/image_framework/libimage_packer.ndk.json @@ -51,6 +51,10 @@ "first_introduced": "12", "name": "OH_ImagePackerNative_PackToDataFromPixelmap" }, + { + "first_introduced": "12", + "name": "OH_ImagePackerNative_PackToDataFromPicture" + }, { "first_introduced": "12", "name": "OH_ImagePackerNative_PackToFileFromImageSource" @@ -59,6 +63,10 @@ "first_introduced": "12", "name": "OH_ImagePackerNative_PackToFileFromPixelmap" }, + { + "first_introduced": "12", + "name": "OH_ImagePackerNative_PackToFileFromPicture" + }, { "first_introduced": "12", "name": "OH_ImagePackerNative_Release" diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index 562ec53ca..133bba8ec 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -99,6 +99,10 @@ "first_introduced": "12", "name": "OH_ImageSourceNative_CreatePixelmapList" }, + { + "first_introduced": "12", + "name": "OH_ImageSourceNative_CreatePicture" + }, { "first_introduced": "12", "name": "OH_ImageSourceNative_GetDelayTimeList" @@ -122,5 +126,21 @@ { "first_introduced": "12", "name": "OH_ImageSourceNative_Release" + }, + { + "first_introduced": "12", + "name": "OH_DecodingOptionsForPicture_Create" + }, + { + "first_introduced": "12", + "name": "OH_DecodingOptionsForPicture_GetDesiredAuxiliaryPictures" + }, + { + "first_introduced": "12", + "name": "OH_DecodingOptionsForPicture_SetDesiredAuxiliaryPictures" + }, + { + "first_introduced": "12", + "name": "OH_DecodingOptionsForPicture_Release" } ] \ No newline at end of file diff --git a/multimedia/image_framework/libpicture.ndk.json b/multimedia/image_framework/libpicture.ndk.json new file mode 100644 index 000000000..d74f9c0f2 --- /dev/null +++ b/multimedia/image_framework/libpicture.ndk.json @@ -0,0 +1,114 @@ +[ + { + "first_introduced": "12", + "name": "OH_PictureNative_CreatePicture" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_GetMainPixelmap" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_GetHdrComposedPixelmap" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_GetGainmapPixelmap" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_SetAuxiliaryPicture" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_GetAuxiliaryPicture" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_GetMetadata" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_SetMetadata" + }, + { + "first_introduced": "12", + "name": "OH_PictureNative_Release" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_Create" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_WritePixels" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_ReadPixels" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_GetType" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_GetInfo" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_SetInfo" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_GetMetadata" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_SetMetadata" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureNative_Release" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_Create" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_GetType" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_SetType" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_GetSize" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_SetSize" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_GetRowStride" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_SetRowStride" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_GetPixelFormat" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_SetPixelFormat" + }, + { + "first_introduced": "12", + "name": "OH_AuxiliaryPictureInfo_Release" + } + ] \ No newline at end of file -- Gitee