1 #ifndef DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_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.
24 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
25 #include <dali/public-api/common/intrusive-ptr.h>
26 #include <dali/public-api/signals/connection-tracker.h>
27 #include <dali/integration-api/adaptor-framework/trigger-event-interface.h>
30 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
36 class NativeRenderSurface;
37 class TriggerEventInterface;
43 * Implementation of the OffscreenWindow class.
45 class OffscreenWindow : public Dali::Internal::Adaptor::SceneHolder,
46 public ConnectionTracker
49 typedef Dali::OffscreenWindow::WindowSize WindowSize;
51 typedef Dali::OffscreenWindow::PostRenderSignalType PostRenderSignalType;
55 * @brief Create a new OffscreenWindow
57 * @param[in] width The initial width of the OffscreenWindow
58 * @param[in] height The initial height of the OffscreenWindow
59 * @param[in] surface The native surface handle of your platform
60 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
62 static OffscreenWindow* New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
64 OffscreenWindow() = default;
71 ~OffscreenWindow() = default;
74 * @copydoc Dali::OffscreenWindow::GetLayerCount
76 virtual uint32_t GetLayerCount() const = 0;
79 * @copydoc Dali::OffscreenWindow::GetLayer
81 virtual Dali::Layer GetLayer( uint32_t depth ) const= 0;
84 * @copydoc Dali::OffscreenWindow::GetSize
86 virtual WindowSize GetSize() const= 0;
89 * @brief Gets the native handle.
90 * @note When users call this function, it wraps the actual type used by the underlying system.
91 * @return The native handle or an empty handle
93 virtual Dali::Any GetNativeHandle() const override = 0;
95 virtual PostRenderSignalType& PostRenderSignal() = 0;
98 * @brief Initialize the OffscreenWindow
99 * @param[in] offscreenApplication The OffscreenApplication instance to be used to intialize the new OffscreenWindow
100 * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
102 virtual void Initialize( OffscreenApplication* offscreenApplication, bool isDefaultWindow ) = 0;
106 * This function is called after drawing by dali.
108 virtual void OnPostRender() = 0;
111 * @brief Get the native render surface
112 * @return The render surface
114 virtual NativeRenderSurface* GetNativeRenderSurface() const = 0;
119 OffscreenWindow( const OffscreenWindow& );
120 OffscreenWindow& operator=( OffscreenWindow& );
123 * This is for initialization of this OffscreenWindow in case it is created before adaptor is running.
125 void OnPreInitOffscreenApplication();
128 * @brief Initialize the OffscreenWindow (for internal use)
133 inline OffscreenWindow& GetImplementation( Dali::OffscreenWindow& offscreenWindow )
135 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
137 BaseObject& handle = offscreenWindow.GetBaseObject();
139 return static_cast<OffscreenWindow&>( handle );
142 inline const OffscreenWindow& GetImplementation( const Dali::OffscreenWindow& offscreenWindow )
144 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
146 const BaseObject& handle = offscreenWindow.GetBaseObject();
148 return static_cast<const OffscreenWindow&>( handle );
151 } // namespace Internal
155 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H