1 /*
2  * Copyright (c) 2022 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 ALGO_FILTER_H
17 #define ALGO_FILTER_H
18 
19 #include "filter.h"
20 #include "mesh.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class AlgoFilter : public Filter {
25 public:
26     static constexpr int DRAW_ELEMENTS_NUMBER = 6;
27     AlgoFilter();
~AlgoFilter()28     virtual ~AlgoFilter() {};
29     virtual FILTER_TYPE GetFilterType() override;
SetValue(const std::string & key,std::shared_ptr<void> value,int size)30     virtual void SetValue(const std::string& key, std::shared_ptr<void> value, int size) override {};
31 
32 protected:
33     void Use();
34     virtual std::string GetVertexShader() = 0;
35     virtual std::string GetFragmentShader() = 0;
36     virtual void LoadFilterParams() = 0;
37     virtual void DoProcess(ProcessData& data) override;
38     virtual void Prepare(ProcessData& data);
39     virtual void Draw(ProcessData& data);
40     virtual void CreateProgram(const std::string& vertexString, const std::string& fragmentString);
41     std::shared_ptr<Program> program_ = nullptr;
42     std::shared_ptr<Mesh> mesh_ = nullptr;
43 };
44 } // namespace Rosen
45 } // namespace OHOS
46 #endif // ALGO_FILTER_H