• 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 #ifndef GRAPHICS_EFFECT_PRTICLE_CIRCULAR_HALO_SHADER_H
16 #define GRAPHICS_EFFECT_PRTICLE_CIRCULAR_HALO_SHADER_H
17 
18 #include "common/rs_vector2.h"
19 #include "effect/runtime_shader_builder.h"
20 #include "utils/matrix.h"
21 
22 #include "ge_shader.h"
23 #include "ge_shader_filter_params.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 
28 class GE_EXPORT GEParticleCircularHaloShader : public GEShader {
29 public:
30     GEParticleCircularHaloShader();
31 
32     GEParticleCircularHaloShader(Drawing::GEParticleCircularHaloShaderParams& params);
33 
34     ~GEParticleCircularHaloShader() override = default;
35 
36     void MakeDrawingShader(const Drawing::Rect& rect, float progress) override;
37 
GetDescription()38     const std::string GetDescription() const
39     {
40         return "GEParticleCircularHaloShader";
41     }
42 
43 private:
44     static std::shared_ptr<GEParticleCircularHaloShader> CreateParticleCircularHaloShader(
45         Drawing::GEParticleCircularHaloShaderParams& params);
46 
47     std::shared_ptr<Drawing::RuntimeShaderBuilder> GetGlowHaloBuilder();
48     std::shared_ptr<Drawing::RuntimeShaderBuilder> GetParticleHaloBuilder();
49     std::shared_ptr<Drawing::RuntimeShaderBuilder> GetParticleCircularHaloBuilder();
50 
51     void Preprocess(Drawing::Canvas& canvas, const Drawing::Rect& rect) override;
52 
53     std::shared_ptr<Drawing::Image> MakeGlowHaloShader(Drawing::Canvas& canvas,
54         const Drawing::ImageInfo& imageInfo);
55     std::shared_ptr<Drawing::Image> MakeParticleHaloShader(Drawing::Canvas& canvas,
56         const Drawing::ImageInfo& imageInfo);
57     std::shared_ptr<Drawing::ShaderEffect> MakeParticleCircularHaloShader(const Drawing::Rect& rect);
58 
59     GEParticleCircularHaloShader(const GEParticleCircularHaloShader&) = delete;
60     GEParticleCircularHaloShader(const GEParticleCircularHaloShader&&) = delete;
61     GEParticleCircularHaloShader& operator=(const GEParticleCircularHaloShader&) = delete;
62     GEParticleCircularHaloShader& operator=(const GEParticleCircularHaloShader&&) = delete;
63 
64     Drawing::GEParticleCircularHaloShaderParams particleCircularHaloParams_;
65     std::shared_ptr<Drawing::RuntimeShaderBuilder> glowHaloBuilder_ = nullptr;
66     std::shared_ptr<Drawing::RuntimeShaderBuilder> particleHaloBuilder_ = nullptr;
67     std::shared_ptr<Drawing::RuntimeShaderBuilder> builder_ = nullptr;
68     std::shared_ptr<Drawing::Image> particleHaloImg_ = nullptr;
69 
70     float lastCenterX_ = 0.0f;
71     float lastCenterY_ = 0.0f;
72 };
73 
74 }  // namespace Rosen
75 }  // namespace OHOS
76 #endif  // GRAPHICS_EFFECT_PRTICLE_CIRCULAR_HALO_SHADER_H