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 
16 #ifndef RENDER_SURFACE_H
17 #define RENDER_SURFACE_H
18 
19 #include "render_attribute.h"
20 #include "render_lib_header.h"
21 #include "render_object.h"
22 #include "base/render_base.h"
23 #include "image_effect_marco_define.h"
24 
25 namespace OHOS {
26 namespace Media {
27 namespace Effect {
28 class RenderSurface : public RenderObject {
29 public:
30     enum class SurfaceType {
31         SURFACE_TYPE_NULL,
32         SURFACE_TYPE_ON_SCREEN,
33         SURFACE_TYPE_OFF_SCREEN
34     };
35     IMAGE_EFFECT_EXPORT explicit RenderSurface(const std::string &tag);
36     IMAGE_EFFECT_EXPORT ~RenderSurface() override;
37 
38     virtual void SetAttrib(const RenderAttribute& attrib);
39     virtual RenderAttribute GetAttrib();
40     virtual bool Create(void *window);
41     IMAGE_EFFECT_EXPORT bool Init() override;
42     IMAGE_EFFECT_EXPORT bool Release() override;
43 
44     IMAGE_EFFECT_EXPORT void *GetRawSurface() const;
45     IMAGE_EFFECT_EXPORT SurfaceType GetSurfaceType() const;
46 
47 private:
48     EGLDisplay display_;
49     EGLConfig config_;
50     EGLSurface surface_;
51     RenderAttribute attribute_;
52     SurfaceType surfaceType_;
53 };
54 } // namespace Effect
55 } // namespace Media
56 } // namespace OHOS
57 #endif