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