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 RENDER_SERVICE_CLIENT_CORE_RENDER_RS_SPHERIZE_EFFECT_FILTER_H 16 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_SPHERIZE_EFFECT_FILTER_H 17 18 #include <memory> 19 20 #include "effect/runtime_effect.h" 21 #include "effect/runtime_shader_builder.h" 22 #include "render/rs_skia_filter.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class RSB_EXPORT RSSpherizeEffectFilter : public RSDrawingFilterOriginal { 27 public: 28 RSSpherizeEffectFilter(float spherizeDegree); 29 RSSpherizeEffectFilter(const RSSpherizeEffectFilter&) = delete; 30 RSSpherizeEffectFilter operator=(const RSSpherizeEffectFilter&) = delete; 31 ~RSSpherizeEffectFilter() override; 32 33 bool IsValid() const override; 34 std::string GetDescription() override; 35 Drawing::Brush GetBrush(const std::shared_ptr<Drawing::Image>& image) const; 36 void DrawImageRect(Drawing::Canvas& canvas, const std::shared_ptr<Drawing::Image>& image, 37 const Drawing::Rect& src, const Drawing::Rect& dst) const override; PreProcess(std::shared_ptr<Drawing::Image> image)38 void PreProcess(std::shared_ptr<Drawing::Image> image) override {}; PostProcess(Drawing::Canvas & canvas)39 void PostProcess(Drawing::Canvas& canvas) override {}; 40 float GetSpherizeDegree() const; 41 Compose(const std::shared_ptr<RSDrawingFilterOriginal> & other)42 std::shared_ptr<RSDrawingFilterOriginal> Compose( 43 const std::shared_ptr<RSDrawingFilterOriginal>& other) const override 44 { 45 return nullptr; 46 } 47 48 private: 49 float spherizeDegree_; 50 51 friend class RSMarshallingHelper; 52 }; 53 } // namespace Rosen 54 } // namespace OHOS 55 56 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_SPHERIZE_EFFECT_FILTER_H