1 /*
2  * Copyright (c) 2020-2021 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 /**
17  * @addtogroup UI_Common
18  * @{
19  *
20  * @brief Defines common UI capabilities, such as image and text processing.
21  *
22  * @since 1.0
23  * @version 1.0
24  */
25 
26 /**
27  * @file screen.h
28  *
29  * @brief Declares the screen information.
30  *
31  * @since 1.0
32  * @version 1.0
33  */
34 
35 #ifndef GRAPHIC_LITE_SCREEN_H
36 #define GRAPHIC_LITE_SCREEN_H
37 
38 #include "gfx_utils/heap_base.h"
39 #include "gfx_utils/image_info.h"
40 
41 namespace OHOS {
42 /**
43  * @brief Represents the screen info of the device.
44  *
45  * @since 1.0
46  * @version 1.0
47  */
48 class Screen : HeapBase {
49 public:
50     /**
51      * @brief Obtains a singleton <b>Screen</b> instance.
52      * @return Returns the <b>Screen</b> instance.
53      */
54     static Screen& GetInstance();
55 
56     /**
57      * @brief Obtains the width of this screen.
58      *
59      * @return Returns the screen width.
60      * @since 1.0
61      * @version 1.0
62      */
63     uint16_t GetWidth();
64 
65     /**
66      * @brief Obtains the height of this screen.
67      *
68      * @return Returns the screen height.
69      * @since 1.0
70      * @version 1.0
71      */
72     uint16_t GetHeight();
73 
74     /**
75      * @brief 获取当前屏幕的bitmap截图.请注意该接口会申请内存,请在需要释放时使用{@link ImageCacheFree()}接口.
76      * @param info bitmap存储对象,获取的截图将被存到该引用中.
77      * @return bitmap是否获取成功.
78      * @since 5.0
79      * @version 3.0
80      */
81     bool GetCurrentScreenBitmap(ImageInfo& info);
82 
83     /**
84      * @brief 获取当前屏幕的形状.
85      * @return 当前屏幕形状.
86      * @since 6
87      */
88     ScreenShape GetScreenShape();
89 
90 private:
Screen()91     Screen() {}
~Screen()92     virtual ~Screen() {}
93 };
94 } // namespace OHOS
95 #endif // GRAPHIC_LITE_SCREEN_H
96