!1013 新增PixelMap Native JS 互转接口

Merge pull request !1013 from duanhan/TS_API
This commit is contained in:
openharmony_ci 2024-08-01 02:46:02 +00:00 committed by Gitee
commit 0ff0a0e154
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 37 additions and 0 deletions

View File

@ -37,6 +37,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" {
@ -399,6 +400,34 @@ 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 <b>PixelMap</b> object to <b>PixelMap</b> napi object.
*
* @param env Indicates the NAPI environment pointer.
* @param pixelmapNative Indicates a pointer to the <b>PixelMap</b> object created at the native layer.
* @param pixelmapNapi the <b>PixelMap</b> pointer will be converted.
* @return Image functions result code.
* {@link IMAGE_SUCCESS} if the execution is successful.
* {@link IMAGE_BAD_PARAMETER} pixelmapNative is nullptr
* @since 12
*/
Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeToNapi(napi_env env, OH_PixelmapNative *pixelmapNative,
napi_value *pixelmapNapi);
/**
* @brief Convert a <b>PixelMap</b> napi object to native <b>PixelMap</b> object.
*
* @param env Indicates the NAPI environment pointer.
* @param pixelmapNapi Indicates napi <b>PixelMap</b> object.
* @param pixelmapNative Indicates native <b>PixelMap</b> pointer to created.
* @return Image functions result code.
* {@link IMAGE_SUCCESS} if the execution is successful.
* {@link IMAGE_BAD_PARAMETER} pixelmapNative is nullptr, or pixelmapNapi is not a PixelMap
* @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.

View File

@ -146,5 +146,13 @@
{
"first_introduced": "12",
"name": "OH_PixelmapNative_CreateEmptyPixelmap"
},
{
"first_introduced": "12",
"name": "OH_PixelmapNative_ConvertPixelmapToNapi"
},
{
"first_introduced": "12",
"name": "OH_PixelmapNative_ConvertPixelmapFromNapi"
}
]