• 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 RENDER_SERVICE_BASE_CORE_RENDER_RS_DOT_MATRIX_SHADER_H
16 #define RENDER_SERVICE_BASE_CORE_RENDER_RS_DOT_MATRIX_SHADER_H
17 
18 #include "render/rs_shader.h"
19 #include "ext/gex_dot_matrix_shader.h"
20 #include "ext/gex_dot_matrix_shader_params.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 
25 class RSB_EXPORT RSDotMatrixShader : public RSShader {
26 public:
27     RSDotMatrixShader();
28     RSDotMatrixShader(Drawing::Color dotColor, float dotSpacing, float dotRadius,
29         Drawing::Color bgColor = Drawing::Color::COLOR_TRANSPARENT);
30     RSDotMatrixShader(const RSDotMatrixShader&) = delete;
31     RSDotMatrixShader operator=(const RSDotMatrixShader&) = delete;
32     ~RSDotMatrixShader() override = default;
33 
34     void SetNormalParams(Drawing::Color dotColor, float dotSpacing, float dotRadius,
35         Drawing::Color bgColor = Drawing::Color::COLOR_TRANSPARENT);
36     void SetNoneEffect();
37     void SetRotateEffect(const RotateEffectParams& rotateParams);
38     void SetRippleEffect(const RippleEffectParams& rippleParams);
39 
40     void MakeDrawingShader(const RectF& rect, float progress) override;
41     const std::shared_ptr<Drawing::ShaderEffect>& GetDrawingShader() const override;
42 
43     bool Marshalling(Parcel& parcel) override;
44     bool Unmarshalling(Parcel& parcel, bool& needReset) override;
45 
46 private:
47     std::shared_ptr<DotMatrixShaderParams> params_ = std::make_shared<DotMatrixShaderParams>();
48     std::shared_ptr<GEXDotMatrixShader> geShader_ = nullptr;
49 };
50 } // namespace Rosen
51 } // namespace OHOS
52 
53 #endif