• 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 #ifndef UIEFFECT_EFFECT_COLOR_GRADIENT_EFFECT_PARA_H
16 #define UIEFFECT_EFFECT_COLOR_GRADIENT_EFFECT_PARA_H
17 
18 #include "visual_effect_para.h"
19 #include "common/rs_vector2.h"
20 #include "common/rs_vector4.h"
21 #include "ui_effect/mask/include/mask_para.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class ColorGradientEffectPara : public VisualEffectPara {
26 public:
ColorGradientEffectPara()27     ColorGradientEffectPara()
28     {
29         this->type_ = VisualEffectPara::ParaType::COLOR_GRADIENT_EFFECT;
30     }
31     ~ColorGradientEffectPara() override = default;
32 
SetColors(const std::vector<Vector4f> & colors)33     void SetColors(const std::vector<Vector4f>& colors)
34     {
35         colors_ = colors;
36     }
37 
GetColors()38     const std::vector<Vector4f>& GetColors() const
39     {
40         return colors_;
41     }
42 
SetPositions(const std::vector<Vector2f> & positions)43     void SetPositions(const std::vector<Vector2f>& positions)
44     {
45         positions_ = positions;
46     }
47 
GetPositions()48     const std::vector<Vector2f>& GetPositions() const
49     {
50         return positions_;
51     }
52 
SetStrengths(const std::vector<float> & strengths)53     void SetStrengths(const std::vector<float>& strengths)
54     {
55         strengths_ = strengths;
56     }
57 
GetStrengths()58     const std::vector<float>& GetStrengths() const
59     {
60         return strengths_;
61     }
62 
SetMask(std::shared_ptr<MaskPara> maskPara)63     void SetMask(std::shared_ptr<MaskPara> maskPara)
64     {
65         maskPara_ = maskPara;
66     }
67 
GetMask()68     const std::shared_ptr<MaskPara>& GetMask() const
69     {
70         return maskPara_;
71     }
72 private:
73     std::vector<Vector4f> colors_;
74     std::vector<Vector2f> positions_;
75     std::vector<float> strengths_;
76     std::shared_ptr<MaskPara> maskPara_;
77 };
78 } // namespace Rosen
79 } // namespace OHOS
80 #endif // UIEFFECT_EFFECT_COLOR_GRADIENT_EFFECT_PARA_H