1 #ifndef DALI_OFFSCREEN_APPLICATION_H
2 #define DALI_OFFSCREEN_APPLICATION_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/any.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/signals/dali-signal.h>
27 #include <dali/public-api/dali-adaptor-common.h>
32 * @addtogroup dali_adaptor_framework
36 class OffscreenWindow;
40 class OffscreenApplication;
44 * @brief Appliations can draw UI on offscreen surface with the OffscreenApplication.
45 * When you use a OffscreenApplication, you don't have to create a Window.
47 class DALI_ADAPTOR_API OffscreenApplication : public Dali::BaseHandle
50 using OffscreenApplicationSignalType = Signal<void(void)>;
53 * @brief Enumeration for the render mode
57 AUTO, // Scene is rendered automatically
58 MANUAL // Scene is rendered by RenderOnce()
63 * @brief This is the constructor of OffscreenApplication
65 * @param[in] width The initial width of the default OffscreenWindow
66 * @param[in] height The initial height of the default OffscreenWindow
67 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
68 * @param[in] renderMode The RenderMode of the OffscreenApplication
70 static OffscreenApplication New(uint16_t width, uint16_t height, bool isTranslucent, RenderMode renderMode = RenderMode::AUTO);
73 * @brief This is the constructor of OffscreenApplication
75 * @param[in] surface The native surface handle to create the OffscreenWindow
76 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
77 * @param[in] renderMode The RenderMode of the OffscreenApplication
79 static OffscreenApplication New(Dali::Any surface, bool isTranslucent, RenderMode renderMode = RenderMode::AUTO);
82 * @brief Constructs an empty handle
84 OffscreenApplication();
87 * @brief Copy constructor
89 * @param [in] offscreenApplication A reference to the copied handle
91 OffscreenApplication(const OffscreenApplication& offscreenApplication);
94 * @brief Assignment operator
96 * @param [in] offscreenApplication A reference to the copied handle
97 * @return A reference to this
99 OffscreenApplication& operator=(const OffscreenApplication& offscreenApplication);
104 ~OffscreenApplication();
108 * @brief Starts the OffscreenApplication (rendering, event handling, etc)
113 * @brief Stops the OffscreenApplication
118 * @brief Get the default OffscreenWindow handle
119 * @return The default OffscreenWindow
121 OffscreenWindow GetWindow();
124 * @brief Renders once more even if we're paused
130 * @brief Signal to notify the client when the application is ready to be initialized
132 * @note OffscreenApplication::Start() should be called to be initialized
136 OffscreenApplicationSignalType& InitSignal();
139 * @brief Signal to notify the user when the application is about to be terminated
143 OffscreenApplicationSignalType& TerminateSignal();
145 public: // Not intended for application developers
147 * @brief Internal constructor
149 explicit DALI_INTERNAL OffscreenApplication(Internal::OffscreenApplication* offscreenApplication);
158 #endif // DALI_OFFSCREEN_APPLICATION_H