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