• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 DRAWING_SURFACE_IMPL_H
17 #define DRAWING_SURFACE_IMPL_H
18 
19 #include "base_impl.h"
20 #include "utils/rect.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 namespace Drawing {
25 class Bitmap;
26 class Canvas;
27 class Image;
28 #ifdef ACE_ENABLE_GPU
29 struct FrameBuffer;
30 #endif
31 
32 class SurfaceImpl : public BaseImpl {
33 public:
34     static inline constexpr AdapterType TYPE = AdapterType::BASE_INTERFACE;
SurfaceImpl()35     SurfaceImpl() {};
~SurfaceImpl()36     ~SurfaceImpl() override {};
37 
GetType()38     AdapterType GetType() const override
39     {
40         return AdapterType::BASE_INTERFACE;
41     }
42 
43     virtual bool Bind(const Bitmap& bitmap) = 0;
44 #ifdef ACE_ENABLE_GPU
45     virtual bool Bind(const Image& image) = 0;
46     virtual bool Bind(const FrameBuffer& frameBuffer) = 0;
47 #endif
48 
49     virtual std::shared_ptr<Canvas> GetCanvas() const = 0;
50     virtual std::shared_ptr<Image> GetImageSnapshot() const = 0;
51     virtual std::shared_ptr<Image> GetImageSnapshot(const RectI& bounds) const = 0;
52 };
53 } // namespace Drawing
54 } // namespace Rosen
55 } // namespace OHOS
56 #endif // DRAWING_SURFACE_IMPL_H
57