diff --git a/frameworks/kits/js/common/image_source_napi.cpp b/frameworks/kits/js/common/image_source_napi.cpp index f7506a91ffa812313db2f06418accec2e2e6be98..1f0b3aca833897b46d3683bd3a421763be66a62c 100644 --- a/frameworks/kits/js/common/image_source_napi.cpp +++ b/frameworks/kits/js/common/image_source_napi.cpp @@ -49,6 +49,7 @@ struct ImageSourceAsyncContext { size_t sourceBufferSize; std::string keyStr; std::string valueStr; + std::string defaultValueStr; int32_t valueInt; int32_t deufltValueInt; void *updataBuffer; @@ -142,8 +143,7 @@ napi_value ImageSourceNapi::Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("getImageInfo", GetImageInfo), - DECLARE_NAPI_FUNCTION("getImagePropertyInt", GetImagePropertyInt), - DECLARE_NAPI_FUNCTION("getImagePropertyString", GetImagePropertyString), + DECLARE_NAPI_FUNCTION("getImageProperty", GetImageProperty), DECLARE_NAPI_FUNCTION("createPixelMap", CreatePixelMap), DECLARE_NAPI_FUNCTION("updateData", UpdateData), DECLARE_NAPI_FUNCTION("release", Release), @@ -352,11 +352,15 @@ static PixelFormat ParsePixlForamt(int32_t val) return PixelFormat::UNKNOWN; } -static bool ParseDecodeOptions(napi_env env, napi_value root, DecodeOptions* opts) +static bool ParseDecodeOptions(napi_env env, napi_value root, DecodeOptions* opts, uint32_t* pIndex) { uint32_t tmpNumber = 0; napi_value tmpValue = nullptr; + if (!ImageNapiUtils::GetUint32ByName(env, root, "index", pIndex)) { + HiLog::Debug(LABEL, "no index"); + } + if (!GET_UINT32_BY_NAME(root, "sampleSize", opts->sampleSize)) { HiLog::Debug(LABEL, "no sampleSize"); } @@ -616,8 +620,8 @@ napi_value ImageSourceNapi::CreatePixelMap(napi_env env, napi_callback_info info int32_t refCount = 1; napi_status status; napi_value thisVar = nullptr; - napi_value argValue[NUM_3] = {0}; - size_t argCount = 3; + napi_value argValue[NUM_2] = {0}; + size_t argCount = NUM_2; IMG_JS_ARGS(env, info, status, argCount, argValue, thisVar); IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, thisVar), nullptr, HiLog::Error(LABEL, "fail to get thisVar")); IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to napi_get_cb_info")); @@ -635,33 +639,22 @@ napi_value ImageSourceNapi::CreatePixelMap(napi_env env, napi_callback_info info IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->rImageSource), nullptr, HiLog::Error(LABEL, "empty native rImageSource")); - if (argCount == NUM_2) { - if (ImageNapiUtils::getType(env, argValue[NUM_1]) == napi_function) { - napi_create_reference(env, argValue[NUM_1], refCount, &asyncContext->callbackRef); - } + if (argCount == NUM_0) { + HiLog::Debug(LABEL, "CreatePixelMap with no arg"); + } else if (argCount == NUM_1 || argCount == NUM_2) { if (ImageNapiUtils::getType(env, argValue[NUM_0]) == napi_object) { - IMG_NAPI_CHECK_RET_D(ParseDecodeOptions(env, argValue[NUM_0], &(asyncContext->decodeOpts)), - nullptr, HiLog::Error(LABEL, "DecodeOptions mismatch")); - } - } else if (argCount == NUM_3) { - if (ImageNapiUtils::getType(env, argValue[NUM_0]) == napi_number) { - napi_get_value_uint32(env, argValue[NUM_0], &asyncContext->index); - } - - if (ImageNapiUtils::getType(env, argValue[NUM_1]) == napi_object) { - IMG_NAPI_CHECK_RET_D(ParseDecodeOptions(env, argValue[NUM_1], &(asyncContext->decodeOpts)), + IMG_NAPI_CHECK_RET_D(ParseDecodeOptions(env, argValue[NUM_0], + &(asyncContext->decodeOpts), + &asyncContext->index), nullptr, HiLog::Error(LABEL, "DecodeOptions mismatch")); } - - if (ImageNapiUtils::getType(env, argValue[NUM_2]) == napi_function) { - napi_create_reference(env, argValue[NUM_2], refCount, &asyncContext->callbackRef); + if (ImageNapiUtils::getType(env, argValue[argCount - 1]) == napi_function) { + napi_create_reference(env, argValue[argCount - 1], refCount, &asyncContext->callbackRef); } - } else { HiLog::Error(LABEL, "argCount missmatch"); return result; } - if (asyncContext->callbackRef == nullptr) { napi_create_promise(env, &(asyncContext->deferred), &result); } else { @@ -677,129 +670,101 @@ napi_value ImageSourceNapi::CreatePixelMap(napi_env env, napi_callback_info info return result; } -static void GetImagePropertyIntComplete(napi_env env, napi_status status, void *data) +static bool ParsePropertyOptions(napi_env env, napi_value root, ImageSourceAsyncContext* context) { - HiLog::Debug(LABEL, "GetImagePropertyIntComplete IN"); - napi_value result = nullptr; - napi_get_undefined(env, &result); - - auto context = static_cast(data); - napi_create_int32(env, context->valueInt, &result); - HiLog::Debug(LABEL, "GetImagePropertyIntComplete OUT"); - ImageSourceCallbackRoutine(env, context, result); -} - -napi_value ImageSourceNapi::GetImagePropertyInt(napi_env env, napi_callback_info info) -{ - napi_value result = nullptr; - napi_get_undefined(env, &result); - - int32_t refCount = 1; - napi_status status; - napi_value thisVar = nullptr; - napi_value argValue[NUM_4] = {0}; - size_t argCount = 4; - IMG_JS_ARGS(env, info, status, argCount, argValue, thisVar); - IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to napi_get_cb_info")); - - std::unique_ptr asyncContext = std::make_unique(); - status = napi_unwrap(env, thisVar, reinterpret_cast(&asyncContext->constructor_)); - - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->constructor_), - nullptr, HiLog::Error(LABEL, "fail to unwrap context")); - - asyncContext->rImageSource = asyncContext->constructor_->nativeImgSrc; - - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->rImageSource), - nullptr, HiLog::Error(LABEL, "empty native rImageSource")); - if (argCount > NUM_0 && ImageNapiUtils::getType(env, argValue[NUM_0]) == napi_number) { - napi_get_value_uint32(env, argValue[NUM_0], &asyncContext->index); - HiLog::Debug(LABEL, "asyncContext->index is [%{public}u]", asyncContext->index); - } - - if (argCount > NUM_2 && ImageNapiUtils::getType(env, argValue[NUM_1]) == napi_string) { - asyncContext->keyStr = GetStringArgument(env, argValue[NUM_1]); - HiLog::Debug(LABEL, "asyncContext->index is [%{public}s]", asyncContext->keyStr.c_str()); - } - - if (argCount > NUM_3 && ImageNapiUtils::getType(env, argValue[NUM_2]) == napi_number) { - napi_get_value_int32(env, argValue[NUM_2], &asyncContext->deufltValueInt); - HiLog::Debug(LABEL, "asyncContext->deufltValueInt is [%{public}u]", asyncContext->deufltValueInt); - } - - if (argCount == NUM_4 && ImageNapiUtils::getType(env, argValue[NUM_3]) == napi_function) { - napi_create_reference(env, argValue[NUM_1], refCount, &asyncContext->callbackRef); + napi_value tmpValue = nullptr; + if (!GET_UINT32_BY_NAME(root, "index", context->index)) { + HiLog::Debug(LABEL, "no index"); + return false; } - - if (asyncContext->callbackRef == nullptr) { - napi_create_promise(env, &(asyncContext->deferred), &result); + if (!GET_NODE_BY_NAME(root, "defaultValue", tmpValue)) { + HiLog::Debug(LABEL, "no defaultValue"); } else { - napi_get_undefined(env, &result); + if (tmpValue != nullptr) { + context->defaultValueStr = GetStringArgument(env, tmpValue); + } } - - IMG_CREATE_CREATE_ASYNC_WORK(env, status, "GetImagePropertyInt", - [](napi_env env, void *data) { - auto context = static_cast(data); - uint32_t errorCode = context->rImageSource->GetImagePropertyInt(context->index, context->keyStr, - context->valueInt); - if (errorCode != SUCCESS) { - context->valueInt = context->deufltValueInt; - } - context->status = SUCCESS; - - }, GetImagePropertyIntComplete, asyncContext, asyncContext->work); - - IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), - nullptr, HiLog::Error(LABEL, "fail to create async work")); - return result; + return true; } -static void GetImagePropertyStringComplete(napi_env env, napi_status status, void *data) +static void GetImagePropertyComplete(napi_env env, napi_status status, ImageSourceAsyncContext *context) { - HiLog::Debug(LABEL, "GetImagePropertyStringComplete IN"); + HiLog::Debug(LABEL, "GetImagePropertyComplete IN"); + + if (context == nullptr) { + HiLog::Error(LABEL, "context is nullptr"); + return; + } napi_value result = nullptr; napi_create_object(env, &result); - auto context = static_cast(data); - - napi_create_string_utf8(env, context->valueStr.c_str(), context->valueStr.length(), &result); - HiLog::Debug(LABEL, "GetImagePropertyStringComplete OUT"); + if (context->status == SUCCESS) { + napi_create_string_utf8(env, context->valueStr.c_str(), context->valueStr.length(), &result); + } else { + napi_create_string_utf8(env, context->defaultValueStr.c_str(), context->defaultValueStr.length(), &result); + context->status = SUCCESS; + } + HiLog::Debug(LABEL, "GetImagePropertyComplete OUT"); ImageSourceCallbackRoutine(env, context, result); } -napi_value ImageSourceNapi::GetImagePropertyString(napi_env env, napi_callback_info info) +static std::unique_ptr UnwrapContext(napi_env env, napi_callback_info info) { - napi_value result = nullptr; - napi_get_undefined(env, &result); - int32_t refCount = 1; napi_status status; napi_value thisVar = nullptr; - napi_value argValue[NUM_2] = {0}; - size_t argCount = 2; - HiLog::Debug(LABEL, "GetImagePropertyString IN"); + napi_value argValue[NUM_3] = {0}; + size_t argCount = NUM_3; + HiLog::Debug(LABEL, "GetImageProperty UnwrapContext"); IMG_JS_ARGS(env, info, status, argCount, argValue, thisVar); - HiLog::Debug(LABEL, "GetImagePropertyString argCount is [%{public}zu]", argCount); + HiLog::Debug(LABEL, "GetImageProperty argCount is [%{public}zu]", argCount); IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to napi_get_cb_info")); - std::unique_ptr asyncContext = std::make_unique(); - status = napi_unwrap(env, thisVar, reinterpret_cast(&asyncContext->constructor_)); + std::unique_ptr context = std::make_unique(); + status = napi_unwrap(env, thisVar, reinterpret_cast(&context->constructor_)); - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->constructor_), + IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, context->constructor_), nullptr, HiLog::Error(LABEL, "fail to unwrap context")); - asyncContext->rImageSource = asyncContext->constructor_->nativeImgSrc; + context->rImageSource = context->constructor_->nativeImgSrc; - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->rImageSource), + IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, context->rImageSource), nullptr, HiLog::Error(LABEL, "empty native rImageSource")); - if (argCount > NUM_0 && ImageNapiUtils::getType(env, argValue[NUM_0]) == napi_string) { - asyncContext->keyStr = GetStringArgument(env, argValue[NUM_0]); + if (argCount < NUM_1 || argCount > NUM_3) { + HiLog::Error(LABEL, "argCount missmatch"); + return nullptr; + } + if (ImageNapiUtils::getType(env, argValue[NUM_0]) == napi_string) { + context->keyStr = GetStringArgument(env, argValue[NUM_0]); + } else { + HiLog::Error(LABEL, "arg 0 type missmatch"); + return nullptr; + } + if (argCount == NUM_2 || argCount == NUM_3) { + if (ImageNapiUtils::getType(env, argValue[NUM_1]) == napi_object) { + IMG_NAPI_CHECK_RET_D(ParsePropertyOptions(env, argValue[NUM_1], context.get()), + nullptr, HiLog::Error(LABEL, "PropertyOptions mismatch")); + } + if (ImageNapiUtils::getType(env, argValue[argCount - 1]) == napi_function) { + napi_create_reference(env, argValue[argCount - 1], refCount, &context->callbackRef); + } } + return context; +} - if (argCount == NUM_2 && ImageNapiUtils::getType(env, argValue[NUM_1]) == napi_function) { - napi_create_reference(env, argValue[NUM_1], refCount, &asyncContext->callbackRef); +napi_value ImageSourceNapi::GetImageProperty(napi_env env, napi_callback_info info) +{ + napi_value result = nullptr; + napi_get_undefined(env, &result); + + napi_status status; + HiLog::Debug(LABEL, "GetImageProperty IN"); + std::unique_ptr asyncContext = UnwrapContext(env, info); + if (asyncContext == nullptr) { + HiLog::Error(LABEL, "async context unwrap failed"); + return result; } if (asyncContext->callbackRef == nullptr) { @@ -808,14 +773,17 @@ napi_value ImageSourceNapi::GetImagePropertyString(napi_env env, napi_callback_i napi_get_undefined(env, &result); } - IMG_CREATE_CREATE_ASYNC_WORK(env, status, "GetImagePropertyString", + IMG_CREATE_CREATE_ASYNC_WORK(env, status, "GetImageProperty", [](napi_env env, void *data) { auto context = static_cast(data); - context->rImageSource->GetImagePropertyString(NUM_0, context->keyStr, context->valueStr); - context->status = SUCCESS; - - }, GetImagePropertyStringComplete, asyncContext, asyncContext->work); + context->status = context->rImageSource->GetImagePropertyString(context->index, + context->keyStr, + context->valueStr); + }, + reinterpret_cast(GetImagePropertyComplete), + asyncContext, + asyncContext->work); IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to create async work")); diff --git a/frameworks/kits/js/common/pixel_map_napi.cpp b/frameworks/kits/js/common/pixel_map_napi.cpp index 43df6226ffeacbc706864eebf9eb7da45cc1c404..daa32b240bd3e3e7e9063d419e54964b5d3f4f02 100644 --- a/frameworks/kits/js/common/pixel_map_napi.cpp +++ b/frameworks/kits/js/common/pixel_map_napi.cpp @@ -231,26 +231,6 @@ STATIC_COMPLETE_FUNC(EmptyResult) CommonCallbackRoutine(env, context, result); } -STATIC_COMPLETE_FUNC(Uint32Result) -{ - napi_value result = nullptr; - napi_get_undefined(env, &result); - - auto context = static_cast(data); - - status = napi_create_int32(env, context->resultUint32, &result); - - if (!IMG_IS_OK(status)) { - context->status = ERROR; - HiLog::Error(LABEL, "napi_create_int32 failed!"); - napi_get_undefined(env, &result); - } else { - context->status = SUCCESS; - } - - CommonCallbackRoutine(env, context, result); -} - PixelMapNapi::PixelMapNapi() :env_(nullptr), wrapper_(nullptr) { @@ -814,51 +794,62 @@ napi_value PixelMapNapi::GetBytesNumberPerRow(napi_env env, napi_callback_info i napi_value result = nullptr; napi_get_undefined(env, &result); - int32_t refCount = 1; napi_status status; napi_value thisVar = nullptr; - napi_value argValue[NUM_1] = {0}; - size_t argCount = NUM_1; + size_t argCount = 0; HiLog::Debug(LABEL, "GetBytesNumberPerRow IN"); - IMG_JS_ARGS(env, info, status, argCount, argValue, thisVar); + IMG_JS_ARGS(env, info, status, argCount, nullptr, thisVar); - IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to napi_get_cb_info")); + IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), result, HiLog::Error(LABEL, "fail to napi_get_cb_info")); - std::unique_ptr asyncContext = std::make_unique(); - status = napi_unwrap(env, thisVar, reinterpret_cast(&asyncContext->nConstructor)); + std::unique_ptr pixelMapNapi = std::make_unique(); + status = napi_unwrap(env, thisVar, reinterpret_cast(&pixelMapNapi)); - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->nConstructor), - nullptr, HiLog::Error(LABEL, "fail to unwrap context")); + IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, pixelMapNapi), result, HiLog::Error(LABEL, "fail to unwrap context")); + if (pixelMapNapi->nativePixelMap_ != nullptr) { + uint32_t rowBytes = pixelMapNapi->nativePixelMap_->GetRowBytes(); + status = napi_create_int32(env, rowBytes, &result); + if (!IMG_IS_OK(status)) { + HiLog::Error(LABEL, "napi_create_int32 failed!"); + } + } else { + HiLog::Error(LABEL, "native pixelmap is nullptr!"); + } + return result; +} - asyncContext->rPixelMap = asyncContext->nConstructor->nativePixelMap_; +napi_value PixelMapNapi::GetPixelBytesNumber(napi_env env, napi_callback_info info) +{ + napi_value result = nullptr; + napi_get_undefined(env, &result); - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->rPixelMap), - nullptr, HiLog::Error(LABEL, "empty native pixelmap")); + napi_status status; + napi_value thisVar = nullptr; + size_t argCount = 0; - if (argCount == 1 && ImageNapiUtils::getType(env, argValue[argCount - 1]) == napi_function) { - napi_create_reference(env, argValue[argCount - 1], refCount, &asyncContext->callbackRef); - } + HiLog::Debug(LABEL, "GetPixelBytesNumber IN"); + IMG_JS_ARGS(env, info, status, argCount, nullptr, thisVar); - if (asyncContext->callbackRef == nullptr) { - napi_create_promise(env, &(asyncContext->deferred), &result); - } else { - napi_get_undefined(env, &result); - } + IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), result, HiLog::Error(LABEL, "fail to napi_get_cb_info")); - IMG_CREATE_CREATE_ASYNC_WORK(env, status, "GetBytesNumberPerRow", - [](napi_env env, void *data) { - auto context = static_cast(data); - context->resultUint32 = context->rPixelMap->GetRowBytes(); - context->status = SUCCESS; - }, Uint32ResultComplete, asyncContext, asyncContext->work); + std::unique_ptr pixelMapNapi = std::make_unique(); + status = napi_unwrap(env, thisVar, reinterpret_cast(&pixelMapNapi)); - IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), - nullptr, HiLog::Error(LABEL, "fail to create async work")); + IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, pixelMapNapi), result, HiLog::Error(LABEL, "fail to unwrap context")); + if (pixelMapNapi->nativePixelMap_ != nullptr) { + uint32_t byteCount = pixelMapNapi->nativePixelMap_->GetByteCount(); + status = napi_create_int32(env, byteCount, &result); + if (!IMG_IS_OK(status)) { + HiLog::Error(LABEL, "napi_create_int32 failed!"); + } + } else { + HiLog::Error(LABEL, "native pixelmap is nullptr!"); + } return result; } -napi_value PixelMapNapi::GetPixelBytesNumber(napi_env env, napi_callback_info info) +napi_value PixelMapNapi::Release(napi_env env, napi_callback_info info) { napi_value result = nullptr; napi_get_undefined(env, &result); @@ -869,7 +860,7 @@ napi_value PixelMapNapi::GetPixelBytesNumber(napi_env env, napi_callback_info in napi_value argValue[1] = {0}; size_t argCount = 1; - HiLog::Debug(LABEL, "GetPixelBytesNumber IN"); + HiLog::Debug(LABEL, "Release IN"); IMG_JS_ARGS(env, info, status, argCount, argValue, thisVar); IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to napi_get_cb_info")); @@ -880,11 +871,6 @@ napi_value PixelMapNapi::GetPixelBytesNumber(napi_env env, napi_callback_info in IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->nConstructor), nullptr, HiLog::Error(LABEL, "fail to unwrap context")); - asyncContext->rPixelMap = asyncContext->nConstructor->nativePixelMap_; - - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, asyncContext->rPixelMap), - nullptr, HiLog::Error(LABEL, "empty native pixelmap")); - if (argCount == 1 && ImageNapiUtils::getType(env, argValue[argCount - 1]) == napi_function) { napi_create_reference(env, argValue[argCount - 1], refCount, &asyncContext->callbackRef); } @@ -895,40 +881,17 @@ napi_value PixelMapNapi::GetPixelBytesNumber(napi_env env, napi_callback_info in napi_get_undefined(env, &result); } - IMG_CREATE_CREATE_ASYNC_WORK(env, status, "GetPixelBytesNumber", + IMG_CREATE_CREATE_ASYNC_WORK(env, status, "Release", [](napi_env env, void *data) { auto context = static_cast(data); - context->resultUint32 = context->rPixelMap->GetByteCount(); + context->nConstructor->nativePixelMap_ = nullptr; context->status = SUCCESS; - }, Uint32ResultComplete, asyncContext, asyncContext->work); + }, EmptyResultComplete, asyncContext, asyncContext->work); IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), nullptr, HiLog::Error(LABEL, "fail to create async work")); return result; } - -napi_value PixelMapNapi::Release(napi_env env, napi_callback_info info) -{ - napi_value result = nullptr; - napi_get_undefined(env, &result); - - napi_status status; - napi_value thisVar = nullptr; - size_t argCount = 0; - - IMG_JS_ARGS(env, info, status, argCount, nullptr, thisVar); - - IMG_NAPI_CHECK_RET_D(IMG_IS_OK(status), result, HiLog::Error(LABEL, "fail to napi_get_cb_info")); - - std::unique_ptr pixelMapNapi = std::make_unique(); - status = napi_unwrap(env, thisVar, reinterpret_cast(&pixelMapNapi)); - - IMG_NAPI_CHECK_RET_D(IMG_IS_READY(status, pixelMapNapi), result, HiLog::Error(LABEL, "fail to unwrap context")); - - pixelMapNapi->nativePixelMap_ = nullptr; - - return result; -} } // namespace Media } // namespace OHOS diff --git a/interfaces/kits/js/common/include/image_source_napi.h b/interfaces/kits/js/common/include/image_source_napi.h index b2125c11ebede1f9403c988170eb145ebf315997..e63fdb21756a54ac7b6682a0ac73778f55ce229e 100644 --- a/interfaces/kits/js/common/include/image_source_napi.h +++ b/interfaces/kits/js/common/include/image_source_napi.h @@ -47,8 +47,7 @@ private: // methods static napi_value GetImageInfo(napi_env env, napi_callback_info info); static napi_value CreatePixelMap(napi_env env, napi_callback_info info); - static napi_value GetImagePropertyInt(napi_env env, napi_callback_info info); - static napi_value GetImagePropertyString(napi_env env, napi_callback_info info); + static napi_value GetImageProperty(napi_env env, napi_callback_info info); static napi_value UpdateData(napi_env env, napi_callback_info info); static napi_value Release(napi_env env, napi_callback_info info);