[Tizen] Add OffscreenApplication
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / offscreen-window.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
20
21 // EXTENRAL INCLUDES
22 #include <dali/public-api/actors/layer.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/offscreen/common/offscreen-application-impl.h>
26 #include <dali/internal/offscreen/common/offscreen-window-impl.h>
27
28 namespace Dali
29 {
30 OffscreenWindow OffscreenWindow::New( uint16_t width, uint16_t height, bool isTranslucent )
31 {
32   Any surface;
33   IntrusivePtr< Internal::OffscreenWindow > impl = Internal::OffscreenWindow::New( width, height, surface, isTranslucent );
34   OffscreenWindow window = OffscreenWindow( impl.Get() );
35   impl->Initialize( false );
36
37   return window;
38 }
39
40 OffscreenWindow OffscreenWindow::New( Any surface )
41 {
42   IntrusivePtr< Internal::OffscreenWindow > impl = Internal::OffscreenWindow::New( 0, 0, surface, false );
43   OffscreenWindow window = OffscreenWindow( impl.Get() );
44   impl->Initialize( false );
45
46   return window;
47 }
48
49 OffscreenWindow::OffscreenWindow()
50 {
51 }
52
53 OffscreenWindow::OffscreenWindow( const OffscreenWindow& window )
54 : BaseHandle( window )
55 {
56 }
57
58 OffscreenWindow& OffscreenWindow::operator=( const OffscreenWindow& window )
59 {
60   if( *this != window )
61   {
62     BaseHandle::operator=( window );
63   }
64   return *this;
65 }
66
67 OffscreenWindow::~OffscreenWindow()
68 {
69 }
70
71 void OffscreenWindow::Add( Actor actor )
72 {
73   Internal::GetImplementation( *this ).Add( actor );
74 }
75
76 void OffscreenWindow::Remove( Actor actor )
77 {
78   Internal::GetImplementation( *this ).Remove( actor );
79 }
80
81 void OffscreenWindow::SetBackgroundColor( const Vector4& color )
82 {
83   Internal::GetImplementation( *this ).SetBackgroundColor( color );
84 }
85
86 Vector4 OffscreenWindow::GetBackgroundColor() const
87 {
88   return Internal::GetImplementation( *this ).GetBackgroundColor();
89 }
90
91 Layer OffscreenWindow::GetRootLayer() const
92 {
93   return Internal::GetImplementation( *this ).GetRootLayer();
94 }
95
96 uint32_t OffscreenWindow::GetLayerCount() const
97 {
98   return Internal::GetImplementation( *this ).GetLayerCount();
99 }
100
101 Layer OffscreenWindow::GetLayer( uint32_t depth ) const
102 {
103   return Internal::GetImplementation( *this ).GetLayer( depth );
104 }
105
106 OffscreenWindow::WindowSize OffscreenWindow::GetSize() const
107 {
108   return Internal::GetImplementation( *this ).GetSize();
109 }
110
111 Any OffscreenWindow::GetNativeHandle() const
112 {
113   return Internal::GetImplementation( *this ).GetNativeHandle();
114 }
115
116 Uint16Pair OffscreenWindow::GetDpi() const
117 {
118   return Internal::GetImplementation(*this).GetDpi();
119 }
120
121 OffscreenWindow::PostRenderSignalType& OffscreenWindow::PostRenderSignal()
122 {
123   return Internal::GetImplementation( *this ).PostRenderSignal();
124 }
125
126
127 OffscreenWindow::OffscreenWindow( Internal::OffscreenWindow* window )
128 : BaseHandle( window )
129 {
130 }
131
132 }  // namespace Dali