• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "modifier_ng/appearance/rs_blend_modifier.h"
17 
18 namespace OHOS::Rosen::ModifierNG {
SetColorBlendMode(RSColorBlendMode colorBlendMode)19 void RSBlendModifier::SetColorBlendMode(RSColorBlendMode colorBlendMode)
20 {
21     Setter<RSProperty>(RSPropertyType::COLOR_BLEND_MODE, static_cast<int>(colorBlendMode));
22 }
23 
GetColorBlendMode() const24 RSColorBlendMode RSBlendModifier::GetColorBlendMode() const
25 {
26     return static_cast<RSColorBlendMode>(Getter(RSPropertyType::COLOR_BLEND_MODE, 0));
27 }
28 
SetColorBlendApplyType(RSColorBlendApplyType colorBlendApplyType)29 void RSBlendModifier::SetColorBlendApplyType(RSColorBlendApplyType colorBlendApplyType)
30 {
31     Setter<RSProperty>(RSPropertyType::COLOR_BLEND_APPLY_TYPE, static_cast<int>(colorBlendApplyType));
32 }
33 
GetColorBlendApplyType() const34 RSColorBlendApplyType RSBlendModifier::GetColorBlendApplyType() const
35 {
36     return static_cast<RSColorBlendApplyType>(Getter(RSPropertyType::COLOR_BLEND_APPLY_TYPE, 0));
37 }
38 
SetFgBrightnessRates(const Vector4f & rates)39 void RSBlendModifier::SetFgBrightnessRates(const Vector4f& rates)
40 {
41     Setter(RSPropertyType::FG_BRIGHTNESS_RATES, rates);
42 }
43 
GetFgBrightnessRates() const44 Vector4f RSBlendModifier::GetFgBrightnessRates() const
45 {
46     return Getter(RSPropertyType::FG_BRIGHTNESS_RATES, Vector4f());
47 }
48 
SetFgBrightnessSaturation(float saturation)49 void RSBlendModifier::SetFgBrightnessSaturation(float saturation)
50 {
51     Setter(RSPropertyType::FG_BRIGHTNESS_SATURATION, saturation);
52 }
53 
GetFgBrightnessSaturation() const54 float RSBlendModifier::GetFgBrightnessSaturation() const
55 {
56     return Getter(RSPropertyType::FG_BRIGHTNESS_SATURATION, 0.f);
57 }
58 
SetFgBrightnessPosCoeff(const Vector4f & coeff)59 void RSBlendModifier::SetFgBrightnessPosCoeff(const Vector4f& coeff)
60 {
61     Setter(RSPropertyType::FG_BRIGHTNESS_POSCOEFF, coeff);
62 }
63 
GetFgBrightnessPosCoeff() const64 Vector4f RSBlendModifier::GetFgBrightnessPosCoeff() const
65 {
66     return Getter(RSPropertyType::FG_BRIGHTNESS_POSCOEFF, Vector4f());
67 }
68 
SetFgBrightnessNegCoeff(const Vector4f & coeff)69 void RSBlendModifier::SetFgBrightnessNegCoeff(const Vector4f& coeff)
70 {
71     Setter(RSPropertyType::FG_BRIGHTNESS_NEGCOEFF, coeff);
72 }
73 
GetFgBrightnessNegCoeff() const74 Vector4f RSBlendModifier::GetFgBrightnessNegCoeff() const
75 {
76     return Getter(RSPropertyType::FG_BRIGHTNESS_NEGCOEFF, Vector4f());
77 }
78 
SetFgBrightnessFract(float fract)79 void RSBlendModifier::SetFgBrightnessFract(float fract)
80 {
81     Setter(RSPropertyType::FG_BRIGHTNESS_FRACTION, fract);
82 }
83 
GetFgBrightnessFract() const84 float RSBlendModifier::GetFgBrightnessFract() const
85 {
86     return Getter(RSPropertyType::FG_BRIGHTNESS_FRACTION, 1.f);
87 }
88 
SetFgBrightnessHdr(bool hdr)89 void RSBlendModifier::SetFgBrightnessHdr(bool hdr)
90 {
91     Setter<RSProperty>(RSPropertyType::FG_BRIGHTNESS_HDR, hdr);
92 }
93 
GetFgBrightnessHdr() const94 bool RSBlendModifier::GetFgBrightnessHdr() const
95 {
96     return Getter(RSPropertyType::FG_BRIGHTNESS_HDR, false);
97 }
98 
SetShadowBlenderParams(const std::optional<RSShadowBlenderPara> & params)99 void RSBlendModifier::SetShadowBlenderParams(const std::optional<RSShadowBlenderPara>& params)
100 {
101     SetterOptional(RSPropertyType::SHADOW_BLENDER_PARAMS, params);
102 }
103 
GetShadowBlenderParams() const104 std::optional<RSShadowBlenderPara> RSBlendModifier::GetShadowBlenderParams() const
105 {
106     return GetterOptional<RSShadowBlenderPara>(RSPropertyType::SHADOW_BLENDER_PARAMS);
107 }
108 } // namespace OHOS::Rosen::ModifierNG
109