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.
23 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
24 #include <dali/public-api/common/intrusive-ptr.h>
25 #include <dali/public-api/signals/connection-tracker.h>
28 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
34 class NativeRenderSurface;
40 * Implementation of the OffscreenWindow class.
42 class OffscreenWindow : public Dali::Internal::Adaptor::SceneHolder,
43 public ConnectionTracker
46 using WindowSize = Dali::OffscreenWindow::WindowSize;
47 using PostRenderSignalType = Dali::OffscreenWindow::PostRenderSignalType;
50 * @brief Create a new OffscreenWindow
52 * @param[in] width The initial width of the OffscreenWindow
53 * @param[in] height The initial height of the OffscreenWindow
54 * @param[in] surface The native surface handle of your platform
55 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
57 static OffscreenWindow* New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
59 OffscreenWindow() = default;
66 ~OffscreenWindow() = default;
69 * @copydoc Dali::OffscreenWindow::GetLayerCount
71 virtual uint32_t GetLayerCount() const = 0;
74 * @copydoc Dali::OffscreenWindow::GetLayer
76 virtual Dali::Layer GetLayer( uint32_t depth ) const= 0;
79 * @copydoc Dali::OffscreenWindow::GetSize
81 virtual WindowSize GetSize() const= 0;
84 * @copydoc Dali::OffscreenWindow::GetNativeHandle
86 virtual Any GetNativeHandle() const override = 0;
89 * @brief Initialize the OffscreenWindow
90 * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
92 virtual void Initialize( bool isDefaultWindow ) = 0;
97 * @copydoc Dali::OffscreenWindow::PostRenderSignal
99 virtual PostRenderSignalType& PostRenderSignal() = 0;
103 * This function is called after drawing by dali.
105 virtual void OnPostRender() = 0;
108 * @brief Get the native render surface
109 * @return The render surface
111 virtual NativeRenderSurface* GetNativeRenderSurface() const = 0;
116 OffscreenWindow( const OffscreenWindow& );
117 OffscreenWindow& operator=( OffscreenWindow& );
120 * This is for initialization of this OffscreenWindow in case it is created before adaptor is running.
122 void OnPreInitOffscreenApplication();
125 * @brief Initialize the OffscreenWindow (for internal use)
130 inline OffscreenWindow& GetImplementation( Dali::OffscreenWindow& offscreenWindow )
132 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
134 BaseObject& handle = offscreenWindow.GetBaseObject();
136 return static_cast<OffscreenWindow&>( handle );
139 inline const OffscreenWindow& GetImplementation( const Dali::OffscreenWindow& offscreenWindow )
141 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
143 const BaseObject& handle = offscreenWindow.GetBaseObject();
145 return static_cast<const OffscreenWindow&>( handle );
148 } // namespace Internal
152 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H