diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.cpp b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.cpp index f3a13e199e33d6c1d68ff36ed79cff77c300a4cb..35e454df7ecf44480121b7663d417d8075383077 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.cpp +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.cpp @@ -2928,14 +2928,14 @@ ArkUINativeModuleValue CommonBridge::ResetLinearGradientBlur(ArkUIRuntimeCallInf return panda::JSValueRef::Undefined(vm); } -void SetBackgroundBlurStyleParam( - ArkUIRuntimeCallInfo* runtimeCallInfo, bool& isValidColor, Color& inactiveColor, int32_t& policy, int32_t& blurType) +void SetBackgroundBlurStyleParam(ArkUIRuntimeCallInfo* runtimeCallInfo, bool& isValidColor, Color& inactiveColor, + int32_t& policy, int32_t& blurType, RefPtr& resourceObject) { EcmaVM *vm = runtimeCallInfo->GetVM(); auto policyArg = runtimeCallInfo->GetCallArgRef(NUM_6); auto inactiveColorArg = runtimeCallInfo->GetCallArgRef(NUM_7); auto typeArg = runtimeCallInfo->GetCallArgRef(NUM_8); - if (ArkTSUtils::ParseJsColor(vm, inactiveColorArg, inactiveColor)) { + if (ArkTSUtils::ParseJsColor(vm, inactiveColorArg, inactiveColor, resourceObject)) { isValidColor = true; } ParseJsInt32(vm, policyArg, policy); @@ -2989,7 +2989,8 @@ ArkUINativeModuleValue CommonBridge::SetBackgroundBlurStyle(ArkUIRuntimeCallInfo Color inactiveColor = Color::TRANSPARENT; auto policy = static_cast(BlurStyleActivePolicy::ALWAYS_ACTIVE); auto blurType = static_cast(BlurType::WITHIN_WINDOW); - SetBackgroundBlurStyleParam(runtimeCallInfo, isValidColor, inactiveColor, policy, blurType); + RefPtr inactiveColorResObj; + SetBackgroundBlurStyleParam(runtimeCallInfo, isValidColor, inactiveColor, policy, blurType, inactiveColorResObj); int32_t intArray[NUM_5]; intArray[NUM_0] = blurStyle; intArray[NUM_1] = colorMode; @@ -3000,9 +3001,10 @@ ArkUINativeModuleValue CommonBridge::SetBackgroundBlurStyle(ArkUIRuntimeCallInfo if (disableSystemAdaptationArg->IsBoolean()) { disableSystemAdaptation = disableSystemAdaptationArg->ToBoolean(vm)->Value(); } + auto inactiveColorRawPtr = AceType::RawPtr(inactiveColorResObj); GetArkUINodeModifiers()->getCommonModifier()->setBackgroundBlurStyle( nativeNode, &intArray, scale, blurOption.grayscale.data(), blurOption.grayscale.size(), - isValidColor, inactiveColor.GetValue(), disableSystemAdaptation); + isValidColor, inactiveColor.GetValue(), disableSystemAdaptation, inactiveColorRawPtr); return panda::JSValueRef::Undefined(vm); } @@ -5534,7 +5536,7 @@ ArkUINativeModuleValue CommonBridge::ResetForegroundEffect(ArkUIRuntimeCallInfo* } void SetBackgroundEffectParam(ArkUIRuntimeCallInfo* runtimeCallInfo, int32_t& policy, int32_t& blurType, - Color& inactiveColor, bool& isValidColor) + Color& inactiveColor, bool& isValidColor, RefPtr& resourceObject) { EcmaVM* vm = runtimeCallInfo->GetVM(); Local policyArg = runtimeCallInfo->GetCallArgRef(7); // 7:index of parameter policy @@ -5551,7 +5553,7 @@ void SetBackgroundEffectParam(ArkUIRuntimeCallInfo* runtimeCallInfo, int32_t& po blurType > static_cast(BlurType::BEHIND_WINDOW)) { blurType = static_cast(BlurType::WITHIN_WINDOW); } - if (ArkTSUtils::ParseJsColor(vm, inactiveColorArg, inactiveColor)) { + if (ArkTSUtils::ParseJsColor(vm, inactiveColorArg, inactiveColor, resourceObject)) { isValidColor = true; } } @@ -5596,8 +5598,9 @@ ArkUINativeModuleValue CommonBridge::SetBackgroundEffect(ArkUIRuntimeCallInfo* r brightness = brightnessArg->ToNumber(vm)->Value(); brightness = (brightness > 0.0f || NearZero(brightness)) ? brightness : 1.0f; } + RefPtr colorResObj; Color color = Color::TRANSPARENT; - if (!ArkTSUtils::ParseJsColor(vm, colorArg, color)) { + if (!ArkTSUtils::ParseJsColor(vm, colorArg, color, colorResObj)) { color.SetValue(Color::TRANSPARENT.GetValue()); } auto adaptiveColor = AdaptiveColor::DEFAULT; @@ -5610,15 +5613,18 @@ ArkUINativeModuleValue CommonBridge::SetBackgroundEffect(ArkUIRuntimeCallInfo* r auto blurType = static_cast(BlurType::WITHIN_WINDOW); Color inactiveColor = Color::TRANSPARENT; bool isValidColor = false; - SetBackgroundEffectParam(runtimeCallInfo, policy, blurType, inactiveColor, isValidColor); + RefPtr inactiveColorResObj; + SetBackgroundEffectParam(runtimeCallInfo, policy, blurType, inactiveColor, isValidColor, inactiveColorResObj); bool disableSystemAdaptation = false; if (disableSystemAdaptationArg->IsBoolean()) { disableSystemAdaptation = disableSystemAdaptationArg->ToBoolean(vm)->Value(); } + auto colorRawPtr = AceType::RawPtr(colorResObj); + auto inactiveColorRawPtr = AceType::RawPtr(inactiveColorResObj); GetArkUINodeModifiers()->getCommonModifier()->setBackgroundEffect(nativeNode, static_cast(radius.Value()), saturation, brightness, color.GetValue(), static_cast(adaptiveColor), blurOption.grayscale.data(), blurOption.grayscale.size(), policy, - blurType, isValidColor, inactiveColor.GetValue(), disableSystemAdaptation); + blurType, isValidColor, inactiveColor.GetValue(), disableSystemAdaptation, colorRawPtr, inactiveColorRawPtr); return panda::JSValueRef::Undefined(vm); } @@ -6040,6 +6046,53 @@ ArkUINativeModuleValue CommonBridge::SetSharedTransition(ArkUIRuntimeCallInfo* r ViewAbstract::SetSharedTransition(frameNode, id, sharedOption); return panda::JSValueRef::Undefined(vm); } + +void CommonBridge::ParseJsMaskProperty(FrameNode* frameNode, const Framework::JSRef& paramObject) +{ + auto progressMask = AceType::MakeRefPtr(); + Framework::JSRef jValue = paramObject->GetProperty("value"); + auto value = jValue->IsNumber() ? jValue->ToNumber() : 0.0f; + if (value < 0.0f) { + value = 0.0f; + } + progressMask->SetValue(value); + Framework::JSRef jTotal = paramObject->GetProperty("total"); + auto total = jTotal->IsNumber() ? jTotal->ToNumber() : DEFAULT_PROGRESS_TOTAL; + if (total < 0.0f) { + total = DEFAULT_PROGRESS_TOTAL; + } + progressMask->SetMaxValue(total); + Framework::JSRef jEnableBreathe = paramObject->GetProperty("breathe"); + if (jEnableBreathe->IsBoolean()) { + progressMask->SetEnableBreathe(jEnableBreathe->ToBoolean()); + } + Framework::JSRef jColor = paramObject->GetProperty("color"); + Color colorVal; + if (!SystemProperties::ConfigChangePerform()) { + if (Framework::JSViewAbstract::ParseJsColor(jColor, colorVal)) { + progressMask->SetColor(colorVal); + } else { + auto theme = Framework::JSShapeAbstract::GetTheme(); + progressMask->SetColor(theme->GetMaskColor()); + } + ViewAbstract::SetProgressMask(frameNode, progressMask); + } else { + RefPtr colorResObj; + auto parseJsColor = Framework::JSViewAbstract::ParseJsColor(jColor, colorVal, colorResObj); + if (colorResObj) { + progressMask->SetResObj(colorResObj); + ViewAbstract::CreateWithMaskResourceObj(frameNode, progressMask); + } else if (parseJsColor) { + progressMask->SetColor(colorVal); + ViewAbstract::SetProgressMask(frameNode, progressMask); + } else { + auto theme = Framework::JSShapeAbstract::GetTheme(); + progressMask->SetColor(theme->GetMaskColor()); + ViewAbstract::SetProgressMask(frameNode, progressMask); + } + } +} + ArkUINativeModuleValue CommonBridge::SetMask(ArkUIRuntimeCallInfo* runtimeCallInfo) { EcmaVM* vm = runtimeCallInfo->GetVM(); @@ -6057,28 +6110,7 @@ ArkUINativeModuleValue CommonBridge::SetMask(ArkUIRuntimeCallInfo* runtimeCallIn Framework::JSRef typeParam = paramObject->GetProperty("type"); if (!typeParam->IsNull() && !typeParam->IsUndefined() && typeParam->IsString() && typeParam->ToString() == "ProgressMask") { - auto progressMask = AceType::MakeRefPtr(); - Framework::JSRef jValue = paramObject->GetProperty("value"); - auto value = jValue->IsNumber() ? jValue->ToNumber() : 0.0f; - if (value < 0.0f) { - value = 0.0f; - } - progressMask->SetValue(value); - Framework::JSRef jTotal = paramObject->GetProperty("total"); - auto total = jTotal->IsNumber() ? jTotal->ToNumber() : DEFAULT_PROGRESS_TOTAL; - if (total < 0.0f) { - total = DEFAULT_PROGRESS_TOTAL; - } - progressMask->SetMaxValue(total); - Framework::JSRef jColor = paramObject->GetProperty("color"); - Color colorVal; - if (Framework::JSViewAbstract::ParseJsColor(jColor, colorVal)) { - progressMask->SetColor(colorVal); - } else { - auto theme = Framework::JSShapeAbstract::GetTheme(); - progressMask->SetColor(theme->GetMaskColor()); - } - ViewAbstract::SetProgressMask(frameNode, progressMask); + ParseJsMaskProperty(frameNode, paramObject); } else { Framework::JSShapeAbstract* maskShape = Framework::JSRef::Cast(info[NUM_1])->Unwrap(); diff --git a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.h b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.h index a9786aec54275bf84ec183a3def93838393269d9..ac1e99ab92d3348b3dafac2371d0765c0c432d69 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.h +++ b/frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_common_bridge.h @@ -468,6 +468,7 @@ public: static ArkUINativeModuleValue ResetOnTouchIntercept(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue SetOnChildTouchTest(ArkUIRuntimeCallInfo* runtimeCallInfo); static ArkUINativeModuleValue ResetOnChildTouchTest(ArkUIRuntimeCallInfo* runtimeCallInfo); + static void ParseJsMaskProperty(FrameNode* frameNode, const Framework::JSRef& paramObject); }; } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/base/view_abstract.cpp b/frameworks/core/components_ng/base/view_abstract.cpp index 6553610db204bc9974067cff378e943ddaccb6c3..a1e9350c0f321229ff4d5d078bb306f75ec0062e 100644 --- a/frameworks/core/components_ng/base/view_abstract.cpp +++ b/frameworks/core/components_ng/base/view_abstract.cpp @@ -3662,6 +3662,41 @@ void ViewAbstract::SetProgressMask(FrameNode* frameNode, const RefPtr& progress) +{ + CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + RefPtr resObj = AceType::MakeRefPtr("", "", -1); + auto&& updateFunc = [progress, weak = AceType::WeakClaim(frameNode)](const RefPtr& resObj) { + auto frameNode = weak.Upgrade(); + if (!frameNode) { + return; + } + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + std::string colorString = pattern->GetResCacheMapByKey("progressMask.color"); + Color maskColor; + if (colorString.empty()) { + ResourceParseUtils::ParseResColor(progress->GetResObj(), maskColor); + pattern->AddResCache("progressMask.color", maskColor.ColorToString()); + } else { + maskColor = Color::ColorFromString(colorString); + } + progress->SetColor(maskColor); + auto target = frameNode->GetRenderContext(); + if (target) { + if (target->HasClipMask()) { + target->ResetClipMask(); + target->OnClipMaskUpdate(nullptr); + } + target->UpdateProgressMask(progress); + } + }; + updateFunc(resObj); + pattern->AddResObj("progressMask.color", resObj, std::move(updateFunc)); +} + void ViewAbstract::SetUseEffect(bool useEffect, EffectType effectType) { if (!ViewStackProcessor::GetInstance()->IsCurrentVisualStateProcess()) { @@ -4077,9 +4112,10 @@ void ViewAbstract::ReSetMagnifier(FrameNode* frameNode) ACE_RESET_NODE_RENDER_CONTEXT(RenderContext, Magnifier, frameNode); } -void ViewAbstract::SetBackgroundBlurStyle( +void ViewAbstract::UpdateBackgroundBlurStyle( FrameNode* frameNode, const BlurStyleOption& bgBlurStyle, const SysOptions& sysOptions) { + CHECK_NULL_VOID(frameNode); auto pipeline = frameNode->GetContext(); CHECK_NULL_VOID(pipeline); if (bgBlurStyle.policy == BlurStyleActivePolicy::FOLLOWS_WINDOW_ACTIVE_STATE) { @@ -4099,6 +4135,42 @@ void ViewAbstract::SetBackgroundBlurStyle( } } +void ViewAbstract::SetBackgroundBlurStyle( + FrameNode* frameNode, const BlurStyleOption& bgBlurStyle, const SysOptions& sysOptions) +{ + CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + RefPtr resObj = AceType::MakeRefPtr("", "", -1); + auto&& updateFunc = [bgBlurStyle, sysOptions, weak = AceType::WeakClaim(frameNode)]( + const RefPtr& resObj) { + auto frameNode = weak.Upgrade(); + if (!frameNode) { + return; + } + BlurStyleOption& bgBlurStyleValue = const_cast(bgBlurStyle); + bgBlurStyleValue.ReloadResources(); + auto pipeline = frameNode->GetContext(); + CHECK_NULL_VOID(pipeline); + if (bgBlurStyle.policy == BlurStyleActivePolicy::FOLLOWS_WINDOW_ACTIVE_STATE) { + pipeline->AddWindowFocusChangedCallback(frameNode->GetId()); + } else { + pipeline->RemoveWindowFocusChangedCallback(frameNode->GetId()); + } + auto target = frameNode->GetRenderContext(); + if (target) { + if (target->GetBackgroundEffect().has_value()) { + target->UpdateBackgroundEffect(std::nullopt); + } + target->UpdateBackBlurStyle(bgBlurStyleValue, sysOptions); + if (target->GetBackBlurRadius().has_value()) { + target->UpdateBackBlurRadius(Dimension()); + } + } + }; + pattern->AddResObj("backgroundBlurStyle.backgroundBlurStyleOptions", resObj, std::move(updateFunc)); + UpdateBackgroundBlurStyle(frameNode, bgBlurStyle, sysOptions); +} + void ViewAbstract::SetPixelStretchEffect(FrameNode* frameNode, PixStretchEffectOption& option) { ACE_UPDATE_NODE_RENDER_CONTEXT(PixelStretchEffect, option, frameNode); @@ -4617,7 +4689,7 @@ void ViewAbstract::SetMotionBlur(FrameNode* frameNode, const MotionBlurOption &m ACE_UPDATE_NODE_RENDER_CONTEXT(MotionBlur, motionBlurOption, frameNode); } -void ViewAbstract::SetBackgroundEffect( +void ViewAbstract::UpdateBackgroundEffect( FrameNode* frameNode, const EffectOption& effectOption, const SysOptions& sysOptions) { CHECK_NULL_VOID(frameNode); @@ -4639,6 +4711,26 @@ void ViewAbstract::SetBackgroundEffect( target->UpdateBackgroundEffect(effectOption, sysOptions); } } +void ViewAbstract::SetBackgroundEffect( + FrameNode* frameNode, const EffectOption& effectOption, const SysOptions& sysOptions) +{ + CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + CHECK_NULL_VOID(pattern); + RefPtr resObj = AceType::MakeRefPtr("", "", -1); + auto&& updateFunc = [effectOption, sysOptions, weak = AceType::WeakClaim(frameNode)]( + const RefPtr& resObj) { + auto frameNode = weak.Upgrade(); + if (!frameNode) { + return; + } + EffectOption& effectOptionValue = const_cast(effectOption); + effectOptionValue.ReloadResources(); + UpdateBackgroundEffect(ViewStackProcessor::GetInstance()->GetMainFrameNode(), effectOptionValue, sysOptions); + }; + pattern->AddResObj("backgroundEffect", resObj, std::move(updateFunc)); + UpdateBackgroundEffect(frameNode, effectOption, sysOptions); +} void ViewAbstract::SetDynamicLightUp(FrameNode* frameNode, float rate, float lightUpDegree) { diff --git a/frameworks/core/components_ng/base/view_abstract.h b/frameworks/core/components_ng/base/view_abstract.h index 8cd8c56705f5d4f17ccc2e75ca7ad6b8b49ae86f..1d4f7f258b174579734fe0a85909276b2ad6f122 100644 --- a/frameworks/core/components_ng/base/view_abstract.h +++ b/frameworks/core/components_ng/base/view_abstract.h @@ -965,6 +965,11 @@ public: FrameNode* frameNode, const std::vector& properties); // Get property value from rsNode static std::vector GetRenderNodePropertyValue(FrameNode* frameNode, AnimationPropertyType property); + static void CreateWithMaskResourceObj(FrameNode* frameNode, const RefPtr& progress); + static void UpdateBackgroundBlurStyle( + FrameNode* frameNode, const BlurStyleOption& bgBlurStyle, const SysOptions& sysOptions); + static void UpdateBackgroundEffect( + FrameNode* frameNode, const EffectOption& effectOption, const SysOptions& sysOptions); private: static void AddDragFrameNodeToManager(); diff --git a/frameworks/core/interfaces/arkoala/arkoala_api.h b/frameworks/core/interfaces/arkoala/arkoala_api.h index 7878788e3bebdee21aacd920b574dde1de21ebd6..540f6d8c344310e858e55d301905dbde311cdfd1 100644 --- a/frameworks/core/interfaces/arkoala/arkoala_api.h +++ b/frameworks/core/interfaces/arkoala/arkoala_api.h @@ -2048,7 +2048,7 @@ struct ArkUICommonModifier { void (*resetLinearGradientBlur)(ArkUINodeHandle node); void (*setBackgroundBlurStyle)(ArkUINodeHandle node, ArkUI_Int32 (*intArray)[5], ArkUI_Float32 scale, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Bool isValidColor, - ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation); + ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation, void* inactiveColorRawPtr); void (*resetBackgroundBlurStyle)(ArkUINodeHandle node); void (*setBorder)(ArkUINodeHandle node, const ArkUI_Float32* values, ArkUI_Int32 valuesSize, const ArkUI_Uint32* colorAndStyle, ArkUI_Int32 colorAndStyleSize, ArkUI_Bool isLocalizedBorderWidth, @@ -2195,7 +2195,8 @@ struct ArkUICommonModifier { void (*setBackgroundEffect)(ArkUINodeHandle node, ArkUI_Float32 radius, ArkUI_Float32 saturation, ArkUI_Float32 brightness, ArkUI_Uint32 color, ArkUI_Int32 adaptiveColor, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Int32 policy, ArkUI_Int32 blurType, ArkUI_Bool isValidColor, - ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation); + ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation, void* colorRawPtr, + void* inactiveColorRawPtr); void (*resetBackgroundEffect)(ArkUINodeHandle node); void (*setBackgroundBrightness)(ArkUINodeHandle node, ArkUI_Float32 rate, ArkUI_Float32 lightUpDegree); void (*resetBackgroundBrightness)(ArkUINodeHandle node); diff --git a/frameworks/core/interfaces/cjui/cjui_api.h b/frameworks/core/interfaces/cjui/cjui_api.h index eee5c3ffafaf5c800321229106835418b718c266..a40acf1a94d74bdcca6493d7b097020dbdf500a7 100644 --- a/frameworks/core/interfaces/cjui/cjui_api.h +++ b/frameworks/core/interfaces/cjui/cjui_api.h @@ -106,7 +106,7 @@ struct CJUICommonModifier { void (*resetLinearGradientBlur)(ArkUINodeHandle node); void (*setBackgroundBlurStyle)(ArkUINodeHandle node, ArkUI_Int32 (*intArray)[5], ArkUI_Float32 scale, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Bool isValidColor, - ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation); + ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation, void* inactiveColorRawPtr); void (*resetBackgroundBlurStyle)(ArkUINodeHandle node); void (*setBorder)(ArkUINodeHandle node, const ArkUI_Float32* values, ArkUI_Int32 valuesSize, const ArkUI_Uint32* colorAndStyle, ArkUI_Int32 colorAndStyleSize, ArkUI_Bool isLocalizedBorderWidth, @@ -243,7 +243,8 @@ struct CJUICommonModifier { void (*setBackgroundEffect)(ArkUINodeHandle node, ArkUI_Float32 radius, ArkUI_Float32 saturation, ArkUI_Float32 brightness, ArkUI_Uint32 color, ArkUI_Int32 adaptiveColor, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Int32 policy, ArkUI_Int32 blurType, ArkUI_Bool isValidColor, - ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation); + ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation, void* colorRawPtr, + void* inactiveColorRawPtr); void (*resetBackgroundEffect)(ArkUINodeHandle node); void (*setBackgroundBrightness)(ArkUINodeHandle node, ArkUI_Float32 rate, ArkUI_Float32 lightUpDegree); void (*resetBackgroundBrightness)(ArkUINodeHandle node); diff --git a/frameworks/core/interfaces/native/node/node_common_modifier.cpp b/frameworks/core/interfaces/native/node/node_common_modifier.cpp index 7a012beda70e7a67d7cc6974b0ac604c74bc889c..2dc1017e2403c70fc89baad9204634c9ebf8d39c 100644 --- a/frameworks/core/interfaces/native/node/node_common_modifier.cpp +++ b/frameworks/core/interfaces/native/node/node_common_modifier.cpp @@ -1731,7 +1731,7 @@ void ResetLinearGradientBlur(ArkUINodeHandle node) void SetBackgroundBlurStyle(ArkUINodeHandle node, ArkUI_Int32 (*intArray)[5], ArkUI_Float32 scale, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Bool isValidColor, ArkUI_Uint32 inactiveColorArg, - ArkUI_Bool disableSystemAdaptation) + ArkUI_Bool disableSystemAdaptation, void* inactiveColorRawPtr) { auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); @@ -1769,6 +1769,20 @@ void SetBackgroundBlurStyle(ArkUINodeHandle node, ArkUI_Int32 (*intArray)[5], Ar bgBlurStyle.inactiveColor = inactiveColor; SysOptions sysOptions; sysOptions.disableSystemAdaptation = disableSystemAdaptation; + if (SystemProperties::ConfigChangePerform()) { + auto* inactiveColorPtr = reinterpret_cast(inactiveColorRawPtr); + auto inactiveColorResObj = AceType::Claim(inactiveColorPtr); + if (inactiveColorResObj) { + auto&& updateFunc = [](const RefPtr& resObj, BlurStyleOption& styleOption) { + Color inactiveColorValue; + ResourceParseUtils::ParseResColor(resObj, inactiveColorValue); + styleOption.inactiveColor = inactiveColorValue; + styleOption.isValidColor = true; + }; + bgBlurStyle.AddResource("backgroundBlurStyle.backgroundBlurStyleOptions.inactiveColor", inactiveColorResObj, + std::move(updateFunc)); + } + } ViewAbstract::SetBackgroundBlurStyle(frameNode, bgBlurStyle, sysOptions); } @@ -3810,7 +3824,7 @@ void ResetForegroundEffect(ArkUINodeHandle node) void SetBackgroundEffect(ArkUINodeHandle node, ArkUI_Float32 radiusArg, ArkUI_Float32 saturationArg, ArkUI_Float32 brightnessArg, ArkUI_Uint32 colorArg, ArkUI_Int32 adaptiveColorArg, const ArkUI_Float32* blurValues, ArkUI_Int32 blurValuesSize, ArkUI_Int32 policy, ArkUI_Int32 blurType, ArkUI_Bool isValidColor, - ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation) + ArkUI_Uint32 inactiveColorArg, ArkUI_Bool disableSystemAdaptation, void* colorRawPtr, void* inactiveColorRawPtr) { auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); @@ -3838,6 +3852,28 @@ void SetBackgroundEffect(ArkUINodeHandle node, ArkUI_Float32 radiusArg, ArkUI_Fl option.isValidColor = isValidColor; SysOptions sysOptions; sysOptions.disableSystemAdaptation = disableSystemAdaptation; + if (SystemProperties::ConfigChangePerform()) { + auto* colorPtr = reinterpret_cast(colorRawPtr); + auto colorResObj = AceType::Claim(colorPtr); + if (colorResObj) { + auto&& updateFunc = [](const RefPtr& colorResObj, EffectOption& effectOption) { + Color effectOptionColor; + ResourceParseUtils::ParseResColor(colorResObj, effectOptionColor); + effectOption.color = effectOptionColor; + }; + option.AddResource("backgroundEffect.color", colorResObj, std::move(updateFunc)); + } + auto* inactiveColorPtr = reinterpret_cast(inactiveColorRawPtr); + auto inactiveColorResObj = AceType::Claim(inactiveColorPtr); + if (inactiveColorResObj) { + auto&& updateFunc = [](const RefPtr& inactiveColorObj, EffectOption& effectOption) { + Color effectOptionInactiveColor; + ResourceParseUtils::ParseResColor(inactiveColorObj, effectOptionInactiveColor); + effectOption.inactiveColor = effectOptionInactiveColor; + }; + option.AddResource("backgroundEffect.inactiveColor", inactiveColorResObj, std::move(updateFunc)); + } + } ViewAbstract::SetBackgroundEffect(frameNode, option, sysOptions); } diff --git a/interfaces/native/node/style_modifier.cpp b/interfaces/native/node/style_modifier.cpp index 93d9b79be036e262e5b8c541d50a75b4859df608..98d100bcd67abb4fdaa9bf0e45cc076d334c2ec8 100644 --- a/interfaces/native/node/style_modifier.cpp +++ b/interfaces/native/node/style_modifier.cpp @@ -10433,7 +10433,7 @@ int32_t SetBackgroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* bool isValidColor = false; Color inactiveColor = Color::TRANSPARENT; fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundBlurStyle( - node->uiNodeHandle, &intArray, scale, &greyVector[0], NUM_2, isValidColor, inactiveColor.GetValue(), true); + node->uiNodeHandle, &intArray, scale, &greyVector[0], NUM_2, isValidColor, inactiveColor.GetValue(), true, nullptr); return ERROR_CODE_NO_ERROR; }