mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-27 09:10:54 +00:00
commit
c02e94a228
@ -119,7 +119,7 @@ napi_value JsColorFilter::CreateBlendModeColorFilter(napi_env env, napi_callback
|
||||
}
|
||||
|
||||
int32_t jsMode = 0;
|
||||
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ONE, jsMode);
|
||||
GET_ENUM_PARAM(ARGC_ONE, jsMode, 0, static_cast<int32_t>(BlendMode::LUMINOSITY));
|
||||
|
||||
auto color = Color::ColorQuadSetARGB(argb[ARGC_ZERO], argb[ARGC_ONE], argb[ARGC_TWO], argb[ARGC_THREE]);
|
||||
std::shared_ptr<ColorFilter> colorFilter = ColorFilter::CreateBlendModeColorFilter(color, BlendMode(jsMode));
|
||||
|
@ -84,6 +84,10 @@ napi_value JsFont::Constructor(napi_env env, napi_callback_info info)
|
||||
std::shared_ptr<Font> font = std::make_shared<Font>();
|
||||
font->SetTypeface(JsTypeface::LoadZhCnTypeface());
|
||||
JsFont *jsFont = new(std::nothrow) JsFont(font);
|
||||
if (!jsFont) {
|
||||
ROSEN_LOGE("Failed to create JsFont");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
status = napi_wrap(env, jsThis, jsFont,
|
||||
JsFont::Destructor, nullptr, nullptr);
|
||||
|
@ -103,7 +103,7 @@ napi_value JsMaskFilter::CreateBlurMaskFilter(napi_env env, napi_callback_info i
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_TWO);
|
||||
|
||||
int32_t blurType = 0;
|
||||
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ZERO, blurType);
|
||||
GET_ENUM_PARAM(ARGC_ZERO, blurType, 0, static_cast<int32_t>(BlurType::INNER));
|
||||
|
||||
double sigma = 0.0;
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, sigma);
|
||||
|
@ -105,10 +105,10 @@ napi_value JsPathEffect::CreateDashPathEffect(napi_env env, napi_callback_info i
|
||||
|
||||
uint32_t arrayLength = 0;
|
||||
if ((napi_get_array_length(env, argv[ARGC_ZERO], &arrayLength) != napi_ok)) {
|
||||
ROSEN_LOGE("JsPathEffect::CreateDashPathEffect count of intervals is not even : %{public}u", arrayLength);
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid array length params.");
|
||||
}
|
||||
if (arrayLength % NUMBER_TWO || arrayLength < NUMBER_TWO) { // arrayLength must be an even number greater than 0
|
||||
ROSEN_LOGE("JsPathEffect::CreateDashPathEffect count of intervals is not even : %{public}u", arrayLength);
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM,
|
||||
"parameter array length verification failed.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user