1 /* 2 * Copyright (c) 2021-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 FOUNDATION_DM_DISPLAY_H 17 #define FOUNDATION_DM_DISPLAY_H 18 19 #include <string> 20 #include "dm_common.h" 21 #include "noncopyable.h" 22 23 namespace OHOS::Rosen { 24 class DisplayInfo; 25 class CutoutInfo; 26 27 enum class DisplayType : uint32_t { 28 DEFAULT = 0, 29 }; 30 31 class Display : public RefBase { 32 friend class DisplayManager; 33 public: 34 ~Display(); 35 Display(const Display&) = delete; 36 Display(Display&&) = delete; 37 Display& operator=(const Display&) = delete; 38 Display& operator=(Display&&) = delete; 39 40 /** 41 * @brief Get id of the display. 42 * 43 * @return Display id. 44 */ 45 DisplayId GetId() const; 46 47 /** 48 * @brief Get name of the display. 49 * 50 * @return Display name. 51 */ 52 std::string GetName() const; 53 54 /** 55 * @brief Get width of the display. 56 * 57 * @return Width of the display. 58 */ 59 int32_t GetWidth() const; 60 61 /** 62 * @brief Get height of the display. 63 * 64 * @return Height of the display. 65 */ 66 int32_t GetHeight() const; 67 68 /** 69 * @brief Get the refresh rate of the display. 70 * 71 * @return Refresh rate of the display. 72 */ 73 uint32_t GetRefreshRate() const; 74 75 /** 76 * @brief Get screen id. 77 * 78 * @return The screen id. 79 */ 80 ScreenId GetScreenId() const; 81 82 /** 83 * @brief Get the virtual pixel ratio of the display. 84 * 85 * @return Virtual pixel ratio of the display. 86 */ 87 float GetVirtualPixelRatio() const; 88 89 /** 90 * @brief Get the Dpi of the display. 91 * 92 * @return Dpi of the display. 93 */ 94 int GetDpi() const; 95 96 /** 97 * @brief Get the rotation of the display. 98 * 99 * @return Rotation of the display.. 100 */ 101 Rotation GetRotation() const; 102 103 /** 104 * @brief Get the Orientation of the display. 105 * 106 * @return Orientation indicates the direction of the display content. 107 */ 108 Orientation GetOrientation() const; 109 110 /** 111 * @brief Get info of the display. 112 * 113 * @return Info of the display. 114 */ 115 sptr<DisplayInfo> GetDisplayInfo() const; 116 117 /** 118 * @brief Get cutout info of the display. 119 * 120 * @return Cutout info of the display. 121 */ 122 sptr<CutoutInfo> GetCutoutInfo() const; 123 protected: 124 // No more methods or variables can be defined here. 125 Display(const std::string& name, sptr<DisplayInfo> info); 126 private: 127 // No more methods or variables can be defined here. 128 void UpdateDisplayInfo(sptr<DisplayInfo>) const; 129 void UpdateDisplayInfo() const; 130 class Impl; 131 sptr<Impl> pImpl_; 132 }; 133 } // namespace OHOS::Rosen 134 135 #endif // FOUNDATION_DM_DISPLAY_H