From 687e94703987f6712603eece68b4745b504f5b80 Mon Sep 17 00:00:00 2001 From: yanzhimo Date: Tue, 2 Sep 2025 20:21:45 +0800 Subject: [PATCH] Animation and Rotation ANI stage3 Signed-off-by: yanzhimo --- .../window_stage_ani/ets/@ohos.window.ets | 57 ++++ .../window_stage_ani/include/ani_window.h | 14 + .../window_stage_ani/src/ani_window.cpp | 309 ++++++++++++++++++ 3 files changed, 380 insertions(+) diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets index b8c30dcca3..c8ae58b29e 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets @@ -717,6 +717,13 @@ export enum RectType { RELATIVE_TO_PARENT_WINDOW = 1 } +export enum BlurStyle { + OFF = 0, + THIN = 1, + REGULAR = 2, + THICK = 3 +} + export interface SystemBarProperties { /** * The color of the status bar. @@ -2121,9 +2128,16 @@ export class WindowInternal implements Window { private native rotate(nativeObj: long, rotateOptions: RotateOptions): void; private native setShadow(nativeObj: long, radius: double, color?: string, offsetX?: double, offsetY?: double): void; + private native setBlur(nativeObj: long, radius: double): void; + private native setBackdropBlurStyle(nativeObj: long, blurStyle: int): void; + private native setBackdropBlur(nativeObj: long, radius: double): void; + private native getWindowCornerRadius(nativeObj: long): double; + private native setWindowCornerRadiusSync(nativeObj: long, cornerRadius: double): void; + private native setWindowShadowRadius(nativeObj: long, radius: double): void; private native setCornerRadiusSync(nativeObj: long, cornerRadius: double): void; private native setWindowColorSpaceSync(nativeObj: long, colorSpace: int): void; private native setPreferredOrientationSync(nativeObj: long, orientation: int): void; + private native getPreferredOrientation(nativeObj: long): int; private native setWindowPrivacyModeSync(nativeObj: long, isPrivacyMode: boolean): void; private native recoverSync(nativeObj: long): void; private native setUIContentSync(nativeObj: long, path: string): void; @@ -2669,6 +2683,10 @@ export class WindowInternal implements Window { }); } + public getPreferredOrientation(): Orientation { + return this.getPreferredOrientation(this.nativeObj) as Orientation; + } + public setWindowPrivacyMode(isPrivacyMode: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { @@ -2909,6 +2927,38 @@ export class WindowInternal implements Window { this.setCornerRadiusSync(this.nativeObj, cornerRadius); } + public setBlur(radius: double): void { + this.setBlur(this.nativeObj, radius); + } + + public setBackdropBlurStyle(blurStyle: BlurStyle): void { + this.setBackdropBlurStyle(this.nativeObj, blurStyle); + } + + public setBackdropBlur(radius: double): void { + this.setBackdropBlur(this.nativeObj, radius); + } + + public getWindowCornerRadius(): double { + return this.getWindowCornerRadius(this.nativeObj); + } + + public setWindowCornerRadius(cornerRadius: double): Promise { + return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { + taskpool.execute((): void => { + this.setWindowCornerRadiusSync(this.nativeObj, cornerRadius); + }).then((ret: NullishType) => { + resolve(undefined); + }).catch((err: NullishType) => { + reject(err as BusinessError); + }); + }); + } + + public setWindowShadowRadius(radius: double): void { + this.setWindowShadowRadius(this.nativeObj, radius); + } + public on(type: string, callback: Callback): void { this.onSync(this.nativeObj, type, callback); } @@ -3069,6 +3119,7 @@ export interface Window { setWindowColorSpace(colorSpace: ColorSpace, callback: AsyncCallback): void; setPreferredOrientation(orientation: Orientation): Promise; setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void; + getPreferredOrientation(): Orientation; setWindowPrivacyMode(isPrivacyMode: boolean): Promise; setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; recover(): Promise; @@ -3106,6 +3157,12 @@ export interface Window { rotate(rotateOptions: RotateOptions): void; setShadow(radius: double, color?: string, offsetX?: double, offsetY?: double): void; setCornerRadius(cornerRadius: double): void; + setBlur(radius: double): void; + setBackdropBlurStyle(blurStyle: BlurStyle): void; + setBackdropBlur(radius: double): void; + getWindowCornerRadius(): double; + setWindowCornerRadius(cornerRadius: double): Promise; + setWindowShadowRadius(radius: double): void; on(type: string, callback: Callback): void; on(type: 'noInteractionDetected', timeout: long, callback: Callback): void; off(type: string, callback?: Callback): void; diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/include/ani_window.h b/interfaces/kits/ani/window_runtime/window_stage_ani/include/ani_window.h index d8ab3fdfbf..070a7754cf 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/include/ani_window.h +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/include/ani_window.h @@ -46,6 +46,7 @@ public: static void SetWindowColorSpace(ani_env* env, ani_object obj, ani_long nativeObj, ani_int colorSpace); static void SetPreferredOrientation(ani_env* env, ani_object obj, ani_long nativeObj, ani_int orientation); + static ani_int GetPreferredOrientation(ani_env* env, ani_object obj, ani_long nativeObj); static void SetWindowPrivacyMode(ani_env* env, ani_object obj, ani_long nativeObj, ani_boolean isPrivacyMode); static void Recover(ani_env* env, ani_object obj, ani_long nativeObj); static void SetUIContent(ani_env* env, ani_object obj, ani_long nativeObj, ani_string path); @@ -77,6 +78,12 @@ public: static void SetShadow(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius, ani_string color, ani_object offsetX, ani_object offsetY); static void SetCornerRadius(ani_env* env, ani_object obj, ani_long nativeObj, ani_double cornerRadius); + static void SetBlur(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius); + static void SetBackdropBlurStyle(ani_env* env, ani_object obj, ani_long nativeObj, ani_int blurStyle); + static void SetBackdropBlur(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius); + static ani_double GetWindowCornerRadius(ani_env* env, ani_object obj, ani_long nativeObj); + static void SetWindowCornerRadius(ani_env* env, ani_object obj, ani_long nativeObj, ani_double cornerRadius); + static void SetWindowShadowRadius(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius); static void Finalizer(ani_env* env, ani_long nativeObj); void SetFollowParentWindowLayoutEnabled(ani_env* env, ani_boolean enabled); @@ -126,6 +133,7 @@ public: private: void OnSetWindowColorSpace(ani_env* env, ani_int colorSpace); void OnSetPreferredOrientation(ani_env* env, ani_int orientation); + ani_int OnGetPreferredOrientation(ani_env* env); void OnSetWindowPrivacyMode(ani_env* env, ani_boolean isPrivacyMode); void OnSetWindowTouchable(ani_env* env, ani_boolean isTouchable); void OnRecover(ani_env* env); @@ -154,6 +162,12 @@ private: static bool ParseScaleOption(ani_env* env, ani_object scaleOptions, Transform& trans); static bool ParseTranslateOption(ani_env* env, ani_object translateOptions, Transform& trans); static bool ParseRotateOption(ani_env* env, ani_object rotateOptions, Transform& trans); + void OnSetBlur(ani_env* env, ani_double radius); + void OnSetBackdropBlurStyle(ani_env* env, ani_int blurStyle); + void OnSetBackdropBlur(ani_env* env, ani_double radius); + ani_double OnGetWindowCornerRadius(ani_env* env); + void OnSetWindowCornerRadius(ani_env* env, ani_double cornerRadius); + void OnSetWindowShadowRadius(ani_env* env, ani_double radius); bool GetSystemBarStatus(std::map& systemBarProperties, std::map& systemBarpropertyFlags, const std::vector& names, sptr& window); diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp index ab109414ae..751479c847 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp @@ -206,6 +206,44 @@ void AniWindow::OnSetPreferredOrientation(ani_env* env, ani_int orientation) window->GetWindowId(), window->GetWindowName().c_str(), orientationValue); } +ani_int AniWindow::GetPreferredOrientation(ani_env* env, ani_object obj, ani_long nativeObj) +{ + TLOGI(WmsLogTag::WMS_ROTATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + return aniWindow->OnGetPreferredOrientation(env); + } else { + TLOGE(WmsLogTag::WMS_ROTATION, "[ANI] aniWindow is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return ani_int(0); + } +} + +ani_int AniWindow::OnGetPreferredOrientation(ani_env* env) +{ + TLOGI(WmsLogTag::WMS_ROTATION, "[ANI]"); + Orientation requestedOrientation = Orientation::UNSPECIFIED; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ROTATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return static_cast(requestedOrientation); + } + requestedOrientation = window->GetRequestedOrientation(); + ApiOrientation apiOrientation = ApiOrientation::UNSPECIFIED; + if (requestedOrientation >= Orientation::BEGIN && + requestedOrientation <= Orientation::END) { + apiOrientation = NATIVE_TO_JS_ORIENTATION_MAP.at(requestedOrientation); + } else { + TLOGE(WmsLogTag::WMS_ROTATION, "[ANI] Orientation %{public}u invalid!", + static_cast(requestedOrientation)); + } + TLOGNI(WmsLogTag::WMS_ROTATION, "[ANI] Window [%{public}u, %{public}s] Get PreferredOrientation end, " + "orientation=%{public}u", window->GetWindowId(), window->GetWindowName().c_str(), + static_cast(apiOrientation)); + return static_cast(apiOrientation); +} + void AniWindow::Opacity(ani_env* env, ani_object obj, ani_long nativeObj, ani_double opacity) { TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI] opacity: %{public}f", static_cast(opacity)); @@ -630,6 +668,263 @@ void AniWindow::OnSetCornerRadius(ani_env* env, ani_double cornerRadius) windowToken_->GetWindowId(), windowToken_->GetWindowName().c_str(), radius); } +void AniWindow::SetBlur(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + aniWindow->OnSetBlur(env, radius); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + } +} + +void AniWindow::OnSetBlur(ani_env* env, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return; + } + if (!WindowHelper::IsSystemWindow(window->GetType())) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Unexpected window type:%{public}d", window->GetType()); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING); + return; + } + double radiusValue = static_cast(radius); + if (MathHelper::LessNotEqual(radiusValue, 0.0)) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Invalid radius:%{public}f", radiusValue); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->SetBlur(radiusValue)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Set blur failed"); + AniWindowUtils::AniThrowError(env, ret); + return; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Set blur end, " + "radius=%{public}f", window->GetWindowId(), window->GetWindowName().c_str(), radiusValue); +} + +void AniWindow::SetBackdropBlurStyle(ani_env* env, ani_object obj, ani_long nativeObj, ani_int blurStyle) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + aniWindow->OnSetBackdropBlurStyle(env, blurStyle); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + } +} + +void AniWindow::OnSetBackdropBlurStyle(ani_env* env, ani_int blurStyle) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return; + } + if (!WindowHelper::IsSystemWindow(window->GetType())) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Unexpected window type:%{public}d", window->GetType()); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING); + return; + } + uint32_t resultValue = static_cast(blurStyle); + if (resultValue > static_cast(WindowBlurStyle::WINDOW_BLUR_THICK)) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Invalid window blur style:%{public}u", resultValue); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } + WindowBlurStyle style = static_cast(resultValue); + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->SetBackdropBlurStyle(style)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Set backdrop blur style failed"); + AniWindowUtils::AniThrowError(env, ret); + return; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Set backdrop blur style end, " + "style=%{public}u", window->GetWindowId(), window->GetWindowName().c_str(), static_cast(style)); +} + +void AniWindow::SetBackdropBlur(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + aniWindow->OnSetBackdropBlur(env, radius); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + } +} + +void AniWindow::OnSetBackdropBlur(ani_env* env, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return; + } + if (!WindowHelper::IsSystemWindow(window->GetType())) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Unexpected window type:%{public}d", window->GetType()); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING); + return; + } + + double radiusValue = static_cast(radius); + if (MathHelper::LessNotEqual(radiusValue, 0.0)) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Invalid radius:%{public}f", radiusValue); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->SetBackdropBlur(radiusValue)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Set backdrop blur failed"); + AniWindowUtils::AniThrowError(env, ret); + return; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Set backdrop blur end, " + "radius=%{public}f", window->GetWindowId(), window->GetWindowName().c_str(), radiusValue); +} + +ani_double AniWindow::GetWindowCornerRadius(ani_env* env, ani_object obj, ani_long nativeObj) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + return aniWindow->OnGetWindowCornerRadius(env); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return ani_double(0.0); + } +} + +ani_double AniWindow::OnGetWindowCornerRadius(ani_env* env) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + float cornerRadius = 0.0f; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return cornerRadius; + } + if (!WindowHelper::IsFloatOrSubWindow(window->GetType())) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] This is not sub window or float window"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING); + return cornerRadius; + } + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->GetWindowCornerRadius(cornerRadius)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Get window corner radius failed"); + AniWindowUtils::AniThrowError(env, ret); + return cornerRadius; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Get window corner radius end, " + "cornerRadius=%{public}f", window->GetWindowId(), window->GetWindowName().c_str(), cornerRadius); + return cornerRadius; +} + +void AniWindow::SetWindowCornerRadius(ani_env* env, ani_object obj, ani_long nativeObj, ani_double cornerRadius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + aniWindow->OnSetWindowCornerRadius(env, cornerRadius); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + } +} + +void AniWindow::OnSetWindowCornerRadius(ani_env* env, ani_double cornerRadius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return; + } + float cornerRadiusValue = static_cast(cornerRadius); + if (MathHelper::LessNotEqual(cornerRadiusValue, 0.0f)) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] The corner radius is less than zero"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->SetWindowCornerRadius(cornerRadiusValue)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Set window corner radius failed"); + AniWindowUtils::AniThrowError(env, ret); + return; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Set window corner radius end, " + "cornerRadius=%{public}f", window->GetWindowId(), window->GetWindowName().c_str(), cornerRadiusValue); +} + +void AniWindow::SetWindowShadowRadius(ani_env* env, ani_object obj, ani_long nativeObj, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + AniWindow* aniWindow = reinterpret_cast(nativeObj); + if (aniWindow != nullptr) { + aniWindow->OnSetWindowShadowRadius(env, radius); + } else { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] aniWindow is nullptr"); + } +} + +void AniWindow::OnSetWindowShadowRadius(ani_env* env, ani_double radius) +{ + TLOGI(WmsLogTag::WMS_ANIMATION, "[ANI]"); + WmErrorCode ret = WmErrorCode::WM_OK; + auto window = GetWindow(); + if (window == nullptr) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] window is nullptr"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY); + return; + } + if (!WindowHelper::IsFloatOrSubWindow(window->GetType())) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] This is not sub window or float window"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_CALLING); + return; + } + float radiusValue = static_cast(radius); + std::shared_ptr shadowsInfo = std::make_shared(); + if (MathHelper::LessNotEqual(radiusValue, 0.0f)) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] The shadow radius is less than zero"); + AniWindowUtils::AniThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM); + return; + } + shadowsInfo->radius_ = radiusValue; + shadowsInfo->hasRadiusValue_ = true; + ret = WM_JS_TO_ERROR_CODE_MAP.at(window->SetWindowShadowRadius(radiusValue)); + if (ret != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Set window shadow radius failed"); + AniWindowUtils::AniThrowError(env, ret); + return; + } + WmErrorCode syncShadowsRet = WM_JS_TO_ERROR_CODE_MAP.at(window->SyncShadowsToComponent(*shadowsInfo)); + if (syncShadowsRet != WmErrorCode::WM_OK) { + TLOGE(WmsLogTag::WMS_ANIMATION, "[ANI] Sync shadows to component fail! ret: %{public}u", + static_cast(syncShadowsRet)); + AniWindowUtils::AniThrowError(env, syncShadowsRet); + return; + } + TLOGNI(WmsLogTag::WMS_ANIMATION, "[ANI] Window [%{public}u, %{public}s] Set window shadow radius end, " + "radius=%{public}f", window->GetWindowId(), window->GetWindowName().c_str(), radiusValue); +} + void AniWindow::SetWindowPrivacyMode(ani_env* env, ani_object obj, ani_long nativeObj, ani_boolean isPrivacyMode) { TLOGI(WmsLogTag::WMS_ATTRIBUTE, "[ANI]"); @@ -2876,6 +3171,8 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(AniWindow::SetWindowColorSpace)}, ani_native_function {"setPreferredOrientationSync", "li:", reinterpret_cast(AniWindow::SetPreferredOrientation)}, + ani_native_function {"getPreferredOrientation", "l:i", + reinterpret_cast(AniWindow::GetPreferredOrientation)}, ani_native_function {"setWindowPrivacyModeSync", "lz:", reinterpret_cast(AniWindow::SetWindowPrivacyMode)}, ani_native_function {"recoverSync", "l:", @@ -2915,6 +3212,18 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(AniWindow::SetShadow)}, ani_native_function {"setCornerRadiusSync", "ld:", reinterpret_cast(AniWindow::SetCornerRadius)}, + ani_native_function {"setBlur", "ld:", + reinterpret_cast(AniWindow::SetBlur)}, + ani_native_function {"setBackdropBlurStyle", "li:", + reinterpret_cast(AniWindow::SetBackdropBlurStyle)}, + ani_native_function {"setBackdropBlur", "ld:", + reinterpret_cast(AniWindow::SetBackdropBlur)}, + ani_native_function {"getWindowCornerRadius", "l:d", + reinterpret_cast(AniWindow::GetWindowCornerRadius)}, + ani_native_function {"setWindowCornerRadiusSync", "ld:", + reinterpret_cast(AniWindow::SetWindowCornerRadius)}, + ani_native_function {"setWindowShadowRadius", "ld:", + reinterpret_cast(AniWindow::SetWindowShadowRadius)}, ani_native_function {"onSync", nullptr, reinterpret_cast(AniWindow::RegisterWindowCallback)}, ani_native_function {"offSync", nullptr, -- Gitee