• 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 #ifndef RENDER_SERVICE_BASE_RENDER_PROPERTY_TAG_H
17 #define RENDER_SERVICE_BASE_RENDER_PROPERTY_TAG_H
18 
19 #include "modifier/rs_render_property.h"
20 #include "pixel_map.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 
25 template<const char* Name, class PropertyType>
26 struct RenderPropertyTagBase {
27     using ValueType = typename PropertyType::ValueType;
28     static constexpr const char* NAME = Name;
29     std::shared_ptr<PropertyType> value_ = std::make_shared<PropertyType>();
30 };
31 
32 template<typename T, const char* Name>
33 using RSRenderPropertyTag = RenderPropertyTagBase<Name, RSRenderProperty<T>>;
34 template<typename T, const char* Name>
35 using RSRenderAnimatablePropertyTag  = RenderPropertyTagBase<Name, RSRenderAnimatableProperty<T>>;
36 
37 #define DECLARE_ANIMATABLE_PROPERTY_TAG(EffectName, PropName, Type) \
38     inline static constexpr char EffectName##PropName##Name[] = #EffectName "_" #PropName; \
39     using EffectName##PropName##RenderTag = RSRenderAnimatablePropertyTag<Type, EffectName##PropName##Name>
40 
41 #define DECLARE_NONANIMATABLE_PROPERTY_TAG(EffectName, PropName, Type) \
42     inline static constexpr char EffectName##PropName##Name[] = #EffectName "_" #PropName; \
43     using EffectName##PropName##RenderTag = RSRenderPropertyTag<Type, EffectName##PropName##Name>
44 
45 class RSNGRenderMaskBase; // forward declaration, impl in rs_render_mask_base.h
46 #define MASK_PTR std::shared_ptr<RSNGRenderMaskBase>
47 using VectorVector2F = std::vector<Vector2f>;
48 #include "effect/rs_render_property_tag_def.in"
49 
50 #undef MASK_PTR
51 #undef DECLARE_ANIMATABLE_PROPERTY_TAG
52 #undef DECLARE_NONANIMATABLE_PROPERTY_TAG
53 
54 enum class RSNGEffectType : int16_t {
55     INVALID = -1,
56     NONE = 0,
57     // filter type
58     BLUR,
59     PIXEL_STRETCH,
60     WATER_RIPPLE,
61     FLY_OUT,
62     DISTORT,
63     RADIUS_GRADIENT_BLUR,
64     COLOR_GRADIENT,
65     DISPLACEMENT_DISTORT,
66     SOUND_WAVE,
67     EDGE_LIGHT,
68     BEZIER_WARP,
69     DISPERSION,
70     DIRECTION_LIGHT,
71 
72     AIBAR,
73     GREY,
74     MATERIAL,
75     MAGNIFIER,
76     MESA,
77     MASK_COLOR,
78     KAWASE,
79     LIGHT_BLUR,
80     LINEAR_GRADIENT_BLUR,
81     ALWAYS_SNAPSHOT,
82     MASK_TRANSITION,
83     VARIABLE_RADIUS_BLUR,
84     CONTENT_LIGHT,
85     // mask type
86     RIPPLE_MASK,
87     DOUBLE_RIPPLE_MASK,
88     RADIAL_GRADIENT_MASK,
89     PIXEL_MAP_MASK,
90     WAVE_GRADIENT_MASK,
91     // shader type
92     CONTOUR_DIAGONAL_FLOW_LIGHT,
93     WAVY_RIPPLE_LIGHT,
94     AURORA_NOISE,
95     PARTICLE_CIRCULAR_HALO,
96     COLOR_GRADIENT_EFFECT,
97     LIGHT_CAVE,
98     BORDER_LIGHT,
99 };
100 
101 using RSNGEffectTypeUnderlying = std::underlying_type<RSNGEffectType>::type;
102 constexpr auto END_OF_CHAIN = static_cast<RSNGEffectTypeUnderlying>(RSNGEffectType::INVALID); // -1
103 
104 } // namespace Rosen
105 } // namespace OHOS
106 
107 
108 #endif // RENDER_SERVICE_BASE_RENDER_PROPERTY_TAG_H
109