1 #ifndef DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_APPLICATION_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/public-api/common/intrusive-ptr.h>
24 #include <dali/public-api/object/base-object.h>
27 #include <dali/devel-api/adaptor-framework/offscreen-application.h>
28 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
29 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
39 * Implementation of the OffscreenApplication class.
41 class OffscreenApplication : public BaseObject
45 using OffscreenApplicationSignalType = Dali::OffscreenApplication::OffscreenApplicationSignalType;
48 * @brief Create a new OffscreenApplication
49 * @param[in] width The width of the default OffscreenWindow
50 * @param[in] height The height of the default OffscreenWindow
51 * @param[in] surface The native surface handle to create the default OffscreenWindow
52 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
53 * @param[in] renderMode The RenderMode of the OffscreenApplication
55 static IntrusivePtr<OffscreenApplication> New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, Dali::OffscreenApplication::RenderMode renderMode);
62 virtual ~OffscreenApplication() = default;
65 * @copydoc Dali::OffscreenApplication::Start()
70 * @copydoc Dali::OffscreenApplication::Stop()
75 * @copydoc Dali::OffscreenApplication::GetDefaultWindow()
77 Dali::OffscreenWindow GetWindow();
80 * @copydoc Dali::OffscreenApplication::RenderOnce()
87 * @copydoc Dali::OffscreenApplication::InitSignal()
89 OffscreenApplicationSignalType& InitSignal()
95 * @copydoc Dali::OffscreenApplication::TerminateSignal()
97 OffscreenApplicationSignalType& TerminateSignal()
99 return mTerminateSignal;
104 * Private constructor
105 * @param[in] width The width of the OffscreenWindow
106 * @param[in] height The height of the OffscreenApplication
107 * @param[in] surface The native surface handle to create the default OffscreenWindow
108 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
109 * @param[in] renderMode The RenderMode of the OffscreenApplication
111 OffscreenApplication( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, Dali::OffscreenApplication::RenderMode renderMode );
114 OffscreenApplication( const OffscreenApplication& ) = delete;
115 OffscreenApplication& operator=( OffscreenApplication& ) = delete;
116 OffscreenApplication& operator=( const OffscreenApplication& ) = delete;
117 OffscreenApplication& operator=( OffscreenApplication&& ) = delete;
120 std::unique_ptr< Dali::Adaptor > mAdaptor;
121 Dali::OffscreenWindow mDefaultWindow;
123 OffscreenApplicationSignalType mInitSignal;
124 OffscreenApplicationSignalType mTerminateSignal;
127 inline OffscreenApplication& GetImplementation( Dali::OffscreenApplication& offscreenApplication )
129 DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
131 BaseObject& handle = offscreenApplication.GetBaseObject();
133 return static_cast<OffscreenApplication&>( handle );
136 inline const OffscreenApplication& GetImplementation( const Dali::OffscreenApplication& offscreenApplication )
138 DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
140 const BaseObject& handle = offscreenApplication.GetBaseObject();
142 return static_cast<const OffscreenApplication&>( handle );
145 } // namespace Internal
149 #endif // DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H