diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 87a9352cde4c724935fa1938fc407c4ff5b70786..ad7e2c16c19e583143107934f47101e08de08264 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -36,6 +36,7 @@ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXELMAP_NATIVE_H_ #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXELMAP_NATIVE_H_ #include "image_common.h" +#include "napi/native_api.h" #ifdef __cplusplus extern "C" { @@ -348,6 +349,30 @@ Image_ErrorCode OH_PixelmapImageInfo_Release(OH_Pixelmap_ImageInfo *info); Image_ErrorCode OH_PixelmapNative_CreatePixelmap(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap); +/** + * @brief Convert a native PixelMap object to PixelMap napi object. + * + * @param env Indicates a pointer to the Java Native Interface (JNI) environment. + * @param pixelmapNative The Pixelmap pointer will be operated. + * @param pixelmapNapi Indicates a pointer to the PixelMap object created at the native layer. + * @return Returns {@link Image_ErrorCode} + * @since 12 + */ +Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeToNapi(napi_env env, OH_PixelmapNative *pixelmapNative, + napi_value *pixelmapNapi); + +/** + * @brief Convert a PixelMap napi object to native PixelMap object. + * + * @param env Indicates the NAPI environment pointer. + * @param pixelmapNapi Indicates the options for setting the PixelMap object. + * @param pixelmapNative Pixelmap pointer for created. + * @return Returns {@link Image_ErrorCode} + * @since 12 + */ +Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeFromNapi(napi_env env, napi_value pixelmapNapi, + OH_PixelmapNative **pixelmapNative); + /** * @brief Reads data of this pixel map to an Buffer. If this pixel map is created in the BGRA_8888 format, * the data read is the same as the original data. diff --git a/multimedia/image_framework/libpixelmap.ndk.json b/multimedia/image_framework/libpixelmap.ndk.json index 05f677374f7eb1919a9769666bcdebdad59617a5..9031a4e95f49d16bff9e57396f3309abba3dd3b2 100644 --- a/multimedia/image_framework/libpixelmap.ndk.json +++ b/multimedia/image_framework/libpixelmap.ndk.json @@ -130,5 +130,13 @@ { "first_introduced": "12", "name": "OH_PixelmapNative_CreateEmptyPixelmap" + }, + { + "first_introduced": "12", + "name": "OH_PixelmapNative_ConvertPixelmapNativeToNapi" + }, + { + "first_introduced": "12", + "name": "OH_PixelmapNative_ConvertPixelmapNativeFromNapi" } ] \ No newline at end of file