• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SDF_SHAPER_BASE_H
16 #define SDF_SHAPER_BASE_H
17 
18 #include "common/rs_macros.h"
19 #include "utils/drawing_macros.h"
20 #include "utils/rect.h"
21 #include <memory>
22 #include <vector>
23 
24 namespace OHOS {
25 namespace Rosen {
26 namespace Drawing {
27 
28 class DRAWING_API SDFShapeBase
29 {
30 public:
SDFShapeBase()31     SDFShapeBase() {};
~SDFShapeBase()32     virtual ~SDFShapeBase() {};
33 
34     virtual const std::string& Getshader() const = 0;
35     virtual float GetSize() const = 0;
36     virtual void SetSize(float size) = 0;
37     virtual void SetTranslate(float dx, float dy) = 0;
38     virtual float GetTranslateX() const = 0;
39     virtual float GetTranslateY() const = 0;
40     virtual void SetBoundsRect(const Rect& rect) = 0;
41     virtual Rect GetBoundsRect() const = 0;
42     virtual int GetShapeId() const = 0;
43     virtual void SetTransparent(int transparent) = 0;
44     virtual int GetTransparent() const = 0;
45     virtual std::vector<float> GetPaintPara() const = 0;
46     virtual std::vector<float> GetPointAndColorPara() const = 0;
47 
48     virtual int GetParaNum() const = 0;
49     virtual int GetFillType() const = 0;
50     virtual std::vector<float> GetPara() const = 0;
51     virtual std::vector<float> GetTransPara() const = 0;
52 
53     virtual std::vector<float> GetColorPara() const = 0;
54 
55     virtual void UpdateTime(float time) = 0;
56     virtual void BuildShader() = 0;
57 
58     template <typename T>
Build()59     T Build() const
60     {
61         T t;
62         return t;
63     }
64 
65 private:
66 
67 };
68 } // namespace Drawing
69 } // namespace Rosen
70 } // namespace OHOS
71 
72 #endif // RENDER_SERVICE_CLIENT_CORE_PROPERTY_RS_SDF_SHAPER_BASE_H