Render to Frame Buffer Object.
[platform/core/uifw/dali-adaptor.git] / adaptors / base / display-connection.h
1 #ifndef __DALI_DISPLAY_CONNECTION_H__
2 #define __DALI_DISPLAY_CONNECTION_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 // INTERNAL INCLUDES
25 #include <render-surface.h>
26
27
28 namespace Dali
29 {
30
31 class EglInterface;
32
33 namespace Internal
34 {
35   namespace Adaptor
36   {
37     class DisplayConnection;
38   }
39 }
40
41 class DisplayConnection
42 {
43 public:
44
45   /**
46    * @brief Create an initialized DisplayConnection.
47    *
48    * @return A handle to a newly allocated DisplayConnection resource.
49    */
50   static DisplayConnection* New();
51
52   /**
53    * @brief Create an initialized DisplayConnection.
54    * Native surface will need this instead of DisplayConnection::New()
55    *
56    * @param[in] type Render surface type
57    * @return A handle to a newly allocated DisplayConnection resource.
58    */
59   static DisplayConnection* New( RenderSurface::Type type );
60
61   /**
62    * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New().
63    *
64    * Calling member functions with an uninitialised handle is not allowed.
65    */
66   DisplayConnection();
67
68   /**
69    * @brief Destructor
70    *
71    * This is non-virtual since derived Handle types must not contain data or virtual methods.
72    */
73   ~DisplayConnection();
74
75   /**
76    * @brief Get display
77    *
78    * @return display
79    */
80   Any GetDisplay();
81
82   /**
83    * @brief Get DPI
84    * @param[out] dpiHorizontal set to the horizontal dpi
85    * @param[out] dpiVertical set to the vertical dpi
86    */
87   static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical);
88
89   /**
90    * @brief Consumes any possible events on the queue so that there is no leaking between frames
91    */
92   void ConsumeEvents();
93
94   /**
95    * @brief Initialize EGL display
96    *
97    * @param egl implementation to use for the creation
98    */
99   bool InitializeEgl(EglInterface& egl);
100
101 public:
102
103   /**
104    * @brief This constructor is used by DisplayConnection New() methods.
105    *
106    * @param [in] handle A pointer to a newly allocated DisplayConnection resource
107    */
108   explicit DALI_INTERNAL DisplayConnection(Internal::Adaptor::DisplayConnection* impl);
109
110 private:
111
112   Internal::Adaptor::DisplayConnection* mImpl;
113 };
114
115 }
116
117 #endif // __DALI_DISPLAY_CONNECTION_H__