1 #ifndef DALI_OFFSCREEN_WINDOW_H
2 #define DALI_OFFSCREEN_WINDOW_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 * @addtogroup dali_adaptor_framework
27 #include <dali/public-api/actors/actor.h>
28 #include <dali/public-api/math/uint-16-pair.h>
29 #include <dali/public-api/signals/dali-signal.h>
30 #include <dali/public-api/object/any.h>
33 #include <dali/devel-api/adaptor-framework/offscreen-application.h>
42 class OffscreenWindow;
45 class DALI_IMPORT_API OffscreenWindow : public Dali::BaseHandle
49 typedef Uint16Pair WindowSize;
50 typedef Signal<void (OffscreenWindow, Dali::Any)> PostRenderSignalType;
55 * @brief Creates an initialized handle to a new OffscreenWindow
56 * @note You should hold the returned handle. If you missed the handle, the OffscreenWindow will be released
58 * @param[in] offscreenApplication The OffscreenApplication handle
59 * @param[in] width The initial width of the OffscreenWindow
60 * @param[in] height The initial height of the OffscreenWindow
61 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
63 static OffscreenWindow New( OffscreenApplication offscreenApplication, uint16_t width, uint16_t height, bool isTranslucent );
66 * @brief Creates an initialized handle to a new OffscreenWindow
67 * @note You should hold the returned handle. If you missed the handle, the OffscreenWindow will be released
69 * @param[in] offscreenApplication The OffscreenApplication handle
70 * @param[in] surface The native surface handle of your platform
71 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
73 static OffscreenWindow New( OffscreenApplication offscreenApplication, Dali::Any surface, bool isTranslucent );
76 * @brief Constructs an empty handle
81 * @brief Copy constructor
83 OffscreenWindow( const OffscreenWindow& window );
86 * @brief Assignment operator
88 OffscreenWindow& operator=( const OffscreenWindow& window );
97 * @brief Adds a child Actor to the OffscreenWindow.
99 * The child will be referenced.
101 * @param[in] actor The child
102 * @pre The actor has been initialized.
103 * @pre The actor does not have a parent.
105 void Add( Actor actor );
108 * @brief Removes a child Actor from the OffscreenWindow.
110 * The child will be unreferenced.
112 * @param[in] actor The child
113 * @pre The actor has been added to the OffscreenWindow.
115 void Remove( Actor actor );
118 * @brief Sets the background color of the OffscreenWindow.
120 * @param[in] color The new background color
122 void SetBackgroundColor( const Vector4& color );
125 * @brief Gets the background color of the OffscreenWindow.
127 * @return The background color
129 Vector4 GetBackgroundColor() const;
132 * @brief Returns the root Layer of the OffscreenWindow.
134 * @return The root layer
136 Layer GetRootLayer() const;
139 * @brief Queries the number of on-scene layers.
141 * Note that a default layer is always provided (count >= 1).
143 * @return The number of layers
145 uint32_t GetLayerCount() const;
148 * @brief Retrieves the layer at a specified depth in the OffscreenWindow.
150 * @param[in] depth The depth
151 * @return The layer found at the given depth
152 * @pre Depth is less than layer count; see GetLayerCount().
154 Layer GetLayer( uint32_t depth ) const;
157 * @brief Returns the size of the OffscreenWindow in pixels as a Vector.
159 * The x component will be the width of the OffscreenWindow in pixels.
160 * The y component will be the height of the OffscreenWindow in pixels.
162 * @return The size of the OffscreenWindow as a Vector
164 WindowSize GetSize() const;
167 PostRenderSignalType& PostRenderSignal();
169 public: // Not intended for application developers
172 * @brief Internal constructor
174 explicit DALI_INTERNAL OffscreenWindow( Internal::OffscreenWindow* window );
184 #endif // DALI_OFFSCREEN_WINDOW_H