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_AIBAR_SHADER_FILTER_H 16 #define GRAPHICS_EFFECT_GE_AIBAR_SHADER_FILTER_H 17 18 #include "ge_shader_filter.h" 19 #include "ge_visual_effect.h" 20 21 #include "effect/runtime_effect.h" 22 #include "effect/runtime_shader_builder.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 27 class GEAIBarShaderFilter : public GEShaderFilter { 28 public: 29 GEAIBarShaderFilter(const Drawing::GEAIBarShaderFilterParams& params); 30 GEAIBarShaderFilter(const GEAIBarShaderFilter&) = delete; 31 GEAIBarShaderFilter operator=(const GEAIBarShaderFilter&) = delete; 32 ~GEAIBarShaderFilter() override = default; 33 34 std::shared_ptr<Drawing::Image> ProcessImage(Drawing::Canvas& canvas, const std::shared_ptr<Drawing::Image> image, 35 const Drawing::Rect& src, const Drawing::Rect& dst) override; 36 37 const std::string GetDescription() const; 38 39 private: 40 float aiBarLow_; 41 float aiBarHigh_; 42 float aiBarThreshold_; 43 float aiBarOpacity_; 44 float aiBarSaturation_; 45 std::shared_ptr<Drawing::RuntimeShaderBuilder> MakeBinarizationShader( 46 float imageWidth, float imageHeight, std::shared_ptr<Drawing::ShaderEffect> imageShader); 47 }; 48 49 } // namespace Rosen 50 } // namespace OHOS 51 52 #endif // GRAPHICS_EFFECT_GE_AIBAR_SHADER_FILTER_H 53