Ocean
apple/macos/Screen.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_APPLE_MACOS_SCREEN_H
9 #define META_OCEAN_PLATFORM_APPLE_MACOS_SCREEN_H
10 
12 
13 #ifndef __OBJC__
14  #error Platform::Apple::MacOS::Screen.h needs to be included from an ObjectiveC++ file
15 #endif
16 
17 #include <AppKit/AppKit.h>
18 
19 namespace Ocean
20 {
21 
22 namespace Platform
23 {
24 
25 namespace Apple
26 {
27 
28 namespace MacOS
29 {
30 
31 /**
32  * This class implements system functions on MacOS platforms.
33  * @ingroup platformapplemacos
34  */
35 class Screen
36 {
37  public:
38 
39  /**
40  * Returns the scaling factor transforming the number of (backing) pixels defined in the (virtual) display coordinate system to the number of pixels defined in the (native/physical) screen coordinate system for a specified screen.
41  * @param screen The screen for which the scaling factor is determined, nullptr to determine the scale factor of the default screen
42  * @return The resulting scale factor with range (0, infinity)
43  */
44  static double scaleFactor(NSScreen* screen);
45 
46  /**
47  * Returns the scaling factor transforming the number of (backing) pixels defined in the (virtual) display coordinate system to the number of pixels defined in the native/physical screen coordinate system for a specified window.
48  * @param window The window for which the scaling factor is determined, nullptr to determine the scale factor of the default screen
49  * @return The resulting scale factor with range (0, infinity)
50  */
51  static double scaleFactor(NSWindow* window);
52 };
53 
54 }
55 
56 }
57 
58 }
59 
60 }
61 
62 #endif // META_OCEAN_PLATFORM_APPLE_MACOS_SCREEN_H
This class implements system functions on MacOS platforms.
Definition: apple/macos/Screen.h:36
static double scaleFactor(NSScreen *screen)
Returns the scaling factor transforming the number of (backing) pixels defined in the (virtual) displ...
static double scaleFactor(NSWindow *window)
Returns the scaling factor transforming the number of (backing) pixels defined in the (virtual) displ...
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15