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 GRAPHICS_EFFECT_GE_VISUAL_EFFECT_H
16 #define GRAPHICS_EFFECT_GE_VISUAL_EFFECT_H
17 
18 #include <memory>
19 
20 #include "effect/color_filter.h"
21 #include "effect/runtime_effect.h"
22 #include "effect/runtime_shader_builder.h"
23 
24 #include "ge_shader_filter_params.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 namespace Drawing {
29 
30 enum class DrawingPaintType { NONE, BRUSH, PEN, PAINT, BRUSH_PEN };
31 
32 class GEVisualEffectImpl;
33 
34 class GEVisualEffect {
35 public:
36     GEVisualEffect(const std::string& name, DrawingPaintType type = DrawingPaintType::BRUSH);
37     ~GEVisualEffect();
38 
39     void SetParam(const std::string& tag, int32_t param);
40     void SetParam(const std::string& tag, int64_t param);
41     void SetParam(const std::string& tag, float param);
42     void SetParam(const std::string& tag, double param);
43     void SetParam(const std::string& tag, const char* const param);
44 
SetParam(const std::string & tag,const std::shared_ptr<Drawing::Image> param)45     void SetParam(const std::string& tag, const std::shared_ptr<Drawing::Image> param) {}
SetParam(const std::string & tag,const std::shared_ptr<Drawing::ColorFilter> param)46     void SetParam(const std::string& tag, const std::shared_ptr<Drawing::ColorFilter> param) {}
47     void SetParam(const std::string& tag, const Drawing::Matrix param);
48     void SetParam(const std::string& tag, const std::vector<std::pair<float, float>>);
49     void SetParam(const std::string& tag, bool param);
50     void SetParam(const std::string& tag, uint32_t param);
51 
GetName()52     const std::string& GetName() const
53     {
54         return visualEffectName_;
55     }
56 
GetImpl()57     const std::shared_ptr<GEVisualEffectImpl> GetImpl() const
58     {
59         return visualEffectImpl_;
60     }
61 
62 private:
63     std::string visualEffectName_;
64     DrawingPaintType type_;
65     std::shared_ptr<GEVisualEffectImpl> visualEffectImpl_;
66 };
67 
68 } // namespace Drawing
69 } // namespace Rosen
70 } // namespace OHOS
71 
72 #endif // GRAPHICS_EFFECT_GE_VISUAL_EFFECT_H
73