• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SHADER_EFFECT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SHADER_EFFECT_H
18 
19 #include <memory>
20 
21 #include "testing_color.h"
22 #include "testing_color_space.h"
23 #include "testing_image.h"
24 #include "testing_matrix.h"
25 #include "testing_point.h"
26 #include "testing_sampling_options.h"
27 #include "testing_picture.h"
28 #include "testing_rect.h"
29 
30 namespace OHOS::Ace::Testing {
31 enum class TileMode {
32     CLAMP,
33     REPEAT,
34     MIRROR,
35     DECAL,
36 };
37 class TestingShaderEffect {
38 public:
39     typedef uint32_t ColorQuad;
40     typedef float scalar;
41     TestingShaderEffect() = default;
42     ~TestingShaderEffect() = default;
43 
CreateSweepGradient(const TestingPoint &,const std::vector<uint32_t> &,const std::vector<float> &,TileMode,float,float,const TestingMatrix *)44     static std::shared_ptr<TestingShaderEffect> CreateSweepGradient(const TestingPoint& /* centerPt */,
45         const std::vector<uint32_t>& /* colors */, const std::vector<float>& /* pos */, TileMode /* mode */,
46         float /* startAngle */, float /* endAngle */, const TestingMatrix* /* matrix */)
47     {
48         return std::make_shared<TestingShaderEffect>();
49     }
50 
51     static std::shared_ptr<TestingShaderEffect> CreateLinearGradient(const TestingPoint& /* startPt */,
52         const TestingPoint& /* endPt */, const std::vector<uint32_t>& /* colors */,
53         const std::vector<float>& /* pos */, TileMode /* mode */, const TestingMatrix* matrix = nullptr)
54     {
55         return std::make_shared<TestingShaderEffect>();
56     }
57 
58     static std::shared_ptr<TestingShaderEffect> CreateRadialGradient(const TestingPoint& centerPt, scalar radius,
59         const std::vector<ColorQuad>& colors, const std::vector<scalar>& pos, TileMode mode,
60         const TestingMatrix* matrix = nullptr)
61     {
62         return std::make_shared<TestingShaderEffect>();
63     }
64 
CreateTwoPointConical(const TestingPoint & startPt,scalar startRadius,const TestingPoint & endPt,scalar endRadius,const std::vector<ColorQuad> & colors,const std::vector<scalar> & pos,TileMode mode,const TestingMatrix * matrix)65     static std::shared_ptr<TestingShaderEffect> CreateTwoPointConical(const TestingPoint& startPt, scalar startRadius,
66         const TestingPoint& endPt, scalar endRadius, const std::vector<ColorQuad>& colors,
67         const std::vector<scalar>& pos, TileMode mode, const TestingMatrix* matrix)
68     {
69         return std::make_shared<TestingShaderEffect>();
70     }
71 
CreateColorShader(ColorQuad color)72     static std::shared_ptr<TestingShaderEffect> CreateColorShader(ColorQuad color)
73     {
74         return std::make_shared<TestingShaderEffect>();
75     }
76 
CreateImageShader(const TestingImage & image,TileMode tileX,TileMode tileY,const TestingSamplingOptions & sampling,const TestingMatrix & matrix)77     static std::shared_ptr<TestingShaderEffect> CreateImageShader(const TestingImage& image, TileMode tileX,
78         TileMode tileY, const TestingSamplingOptions& sampling, const TestingMatrix& matrix)
79     {
80         return std::make_shared<TestingShaderEffect>();
81     }
82 
CreatePictureShader(const TestingPicture & picture,TileMode tileX,TileMode tileY,const FilterMode & mode,const TestingMatrix & matrix,const TestingRect & rect)83     static std::shared_ptr<TestingShaderEffect> CreatePictureShader(const TestingPicture& picture, TileMode tileX,
84         TileMode tileY, const FilterMode& mode, const TestingMatrix& matrix, const TestingRect& rect)
85     {
86         return std::make_shared<TestingShaderEffect>();
87     }
88 
CreateSweepGradient(const TestingPoint &,const std::vector<TestingColor4f> &,std::shared_ptr<TestingColorSpace>,const std::vector<float> &,TileMode,float,float,const TestingMatrix *)89     static std::shared_ptr<TestingShaderEffect> CreateSweepGradient(const TestingPoint& /* centerPt */,
90         const std::vector<TestingColor4f>& /* colors */, std::shared_ptr<TestingColorSpace> /* colorSpace */,
91         const std::vector<float>& /* pos */, TileMode /* mode */, float /* startAngle */, float /* endAngle */,
92         const TestingMatrix* /* matrix */)
93     {
94         return std::make_shared<TestingShaderEffect>();
95     }
96 
97     static std::shared_ptr<TestingShaderEffect> CreateLinearGradient(const TestingPoint& /* startPt */,
98         const TestingPoint& /* endPt */, const std::vector<TestingColor4f>& /* colors */,
99         std::shared_ptr<TestingColorSpace> /* colorSpace */, const std::vector<float>& /* pos */, TileMode /* mode */,
100         const TestingMatrix* matrix = nullptr)
101     {
102         return std::make_shared<TestingShaderEffect>();
103     }
104 
105     static std::shared_ptr<TestingShaderEffect> CreateRadialGradient(const TestingPoint& centerPt, scalar radius,
106         const std::vector<TestingColor4f>& /* colors */, std::shared_ptr<TestingColorSpace> /* colorSpace */,
107         const std::vector<scalar>& pos, TileMode mode, const TestingMatrix* matrix = nullptr)
108     {
109         return std::make_shared<TestingShaderEffect>();
110     }
111 
CreateTwoPointConical(const TestingPoint & startPt,scalar startRadius,const TestingPoint & endPt,scalar endRadius,const std::vector<TestingColor4f> &,std::shared_ptr<TestingColorSpace>,const std::vector<scalar> & pos,TileMode mode,const TestingMatrix * matrix)112     static std::shared_ptr<TestingShaderEffect> CreateTwoPointConical(const TestingPoint& startPt, scalar startRadius,
113         const TestingPoint& endPt, scalar endRadius, const std::vector<TestingColor4f>& /* colors */,
114         std::shared_ptr<TestingColorSpace> /* colorSpace */, const std::vector<scalar>& pos, TileMode mode,
115         const TestingMatrix* matrix)
116     {
117         return std::make_shared<TestingShaderEffect>();
118     }
119 };
120 } // namespace OHOS::Ace::Testing
121 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SHADER_EFFECT_H
122