• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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_VISUAL_EFFECT_PARA_H
16 #define UIEFFECT_EFFECT_VISUAL_EFFECT_PARA_H
17 
18 #include <memory>
19 #include <functional>
20 
21 #include <parcel.h>
22 
23 #include "common/rs_macros.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 class RSC_EXPORT VisualEffectPara {
28 public:
29     enum ParaType {
30         NONE,
31         BACKGROUND_COLOR_EFFECT,
32         BORDER_LIGHT_EFFECT,
33         AIBAR_GLOW_EFFECT,
34         COLOR_GRADIENT_EFFECT,
35         ROUNDED_RECT_FLOWLIGHT_EFFECT,
36         // The value in the OpenHarmony project should be less than this value.
37         HDS_EFFECT_BEGIN = 2048,
38     };
39 
40     static constexpr size_t UNMARSHALLING_MAX_VECTOR_SIZE = 65535;
41     using UnmarshallingFunc = std::function<bool (Parcel&, std::shared_ptr<VisualEffectPara>&)>;
42 
43     VisualEffectPara() = default;
44     virtual ~VisualEffectPara() = default;
45 
46     virtual bool Marshalling(Parcel& parcel) const;
47 
48     static bool RegisterUnmarshallingCallback(uint16_t type, UnmarshallingFunc func);
49 
50     [[nodiscard]] static bool Unmarshalling(Parcel& parcel, std::shared_ptr<VisualEffectPara>& val);
51 
52     virtual std::shared_ptr<VisualEffectPara> Clone() const;
53 
54     static bool IsWhitelistPara(uint16_t type);
55 
GetParaType()56     ParaType GetParaType()
57     {
58         return type_;
59     }
60 protected:
61     ParaType type_;
62 };
63 } // namespace Rosen
64 } // namespace OHOS
65 #endif // UIEFFECT_EFFECT_VISUAL_EFFECT_PARA_H
66