From 4d4cc5eafeb28cdca5b45cf5b41d82dd3050cf0d Mon Sep 17 00:00:00 2001 From: caochuan Date: Thu, 16 May 2024 18:29:25 +0800 Subject: [PATCH] =?UTF-8?q?NewFeature:=20=E5=A2=9E=E5=8A=A0PixelMap=20nati?= =?UTF-8?q?ve=E5=92=8Cnapi=E5=AF=B9=E8=B1=A1=E4=BA=92=E8=BD=AC=E8=83=BD?= =?UTF-8?q?=E5=8A=9BAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: caochuan --- .../include/image/pixelmap_native.h | 25 +++++++++++++++++++ .../image_framework/libpixelmap.ndk.json | 8 ++++++ 2 files changed, 33 insertions(+) diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 87a9352cd..ad7e2c16c 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 05f677374..9031a4e95 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 -- Gitee