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_SCREEN_H 17 #define FOUNDATION_DM_SCREEN_H 18 19 #include <screen_manager/screen_types.h> 20 #include <string> 21 #include <surface.h> 22 #include <vector> 23 24 #include "dm_common.h" 25 #include "noncopyable.h" 26 27 namespace OHOS::Rosen { 28 class ScreenInfo; 29 30 struct Point { 31 int32_t posX_; 32 int32_t posY_; PointPoint33 Point() : posX_(0), posY_(0) {}; PointPoint34 Point(int32_t posX, int32_t posY) : posX_(posX), posY_(posY) {}; 35 }; 36 37 struct SupportedScreenModes : public RefBase { 38 uint32_t width_; 39 uint32_t height_; 40 uint32_t refreshRate_; 41 }; 42 43 struct VirtualScreenOption { 44 std::string name_; 45 uint32_t width_; 46 uint32_t height_; 47 float density_; 48 sptr<Surface> surface_; 49 int32_t flags_; 50 bool isForShot_ {true}; 51 }; 52 53 struct ExpandOption { 54 ScreenId screenId_; 55 uint32_t startX_; 56 uint32_t startY_; 57 }; 58 59 class Screen : public RefBase { 60 friend class ScreenManager; 61 public: 62 ~Screen(); 63 Screen(const Screen&) = delete; 64 Screen(Screen&&) = delete; 65 Screen& operator=(const Screen&) = delete; 66 Screen& operator=(Screen&&) = delete; 67 bool IsGroup() const; 68 std::string GetName() const; 69 ScreenId GetId() const; 70 uint32_t GetWidth() const; 71 uint32_t GetHeight() const; 72 uint32_t GetVirtualWidth() const; 73 uint32_t GetVirtualHeight() const; 74 float GetVirtualPixelRatio() const; 75 Rotation GetRotation() const; 76 Orientation GetOrientation() const; 77 bool IsReal() const; 78 ScreenId GetParentId() const; 79 uint32_t GetModeId() const; 80 std::vector<sptr<SupportedScreenModes>> GetSupportedModes() const; 81 bool SetScreenActiveMode(uint32_t modeId); 82 bool SetOrientation(Orientation orientation) const; 83 bool SetDensityDpi(uint32_t dpi) const; 84 sptr<ScreenInfo> GetScreenInfo() const; 85 86 // colorspace, gamut 87 DMError GetScreenSupportedColorGamuts(std::vector<ScreenColorGamut>& colorGamuts) const; 88 DMError GetScreenColorGamut(ScreenColorGamut& colorGamut) const; 89 DMError SetScreenColorGamut(int32_t colorGamutIdx); 90 DMError GetScreenGamutMap(ScreenGamutMap& gamutMap) const; 91 DMError SetScreenGamutMap(ScreenGamutMap gamutMap); 92 DMError SetScreenColorTransform(); 93 protected: 94 // No more methods or variables can be defined here. 95 Screen(sptr<ScreenInfo> info); 96 void UpdateScreenInfo() const; 97 void UpdateScreenInfo(sptr<ScreenInfo> info) const; 98 private: 99 // No more methods or variables can be defined here. 100 class Impl; 101 sptr<Impl> pImpl_; 102 }; 103 } // namespace OHOS::Rosen 104 105 #endif // FOUNDATION_DM_SCREEN_H