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 INPUT_H
17 #define INPUT_H
18 
19 #include <vector>
20 #include <string>
21 #include <algorithm>
22 #include <memory>
23 #include "filter.h"
24 #include "mesh.h"
25 #include "image_source.h"
26 
27 namespace OHOS {
28 namespace Rosen {
29 class Input : public Filter {
30 public:
Input()31     Input() {};
~Input()32     virtual ~Input() {};
33     void SetValue(const std::string& key, std::shared_ptr<void> value, int size) override;
34     virtual FILTER_TYPE GetFilterType() override;
35 
36 protected:
37     void DoProcess(ProcessData& data) override;
38     void DecodeFromFile(ProcessData& data);
39     void DecodeFromPixelMap(ProcessData& data);
40     void DecodeFromBuffer(ProcessData& data);
41     std::string format_;
42     std::string srcImagePath_;
43     std::shared_ptr<OHOS::Media::PixelMap> pixelMap_ = nullptr;
44     std::shared_ptr<uint8_t> buffer_ = nullptr;
45     int bufferWidth_ = 0;
46     int bufferHeight_ = 0;
47 };
48 } // namespace Rosen
49 } // namespace OHOS
50 #endif // INPUT_H
51