2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/integration-api/scene.h>
22 #include <dali/graphics-api/graphics-render-target.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
27 #include <dali/internal/event/common/scene-impl.h>
33 Scene Scene::New(Size size, int32_t orientation)
35 Internal::ScenePtr internal = Internal::Scene::New(size, orientation);
36 return Scene(internal.Get());
39 Scene Scene::DownCast(BaseHandle handle)
41 return Scene(dynamic_cast<Dali::Internal::Scene*>(handle.GetObjectPtr()));
44 Scene::Scene() = default;
46 Scene::~Scene() = default;
48 Scene::Scene(const Scene& handle) = default;
50 Scene::Scene(Internal::Scene* internal)
51 : BaseHandle(internal)
55 Scene& Scene::operator=(const Scene& rhs) = default;
57 void Scene::Add(Actor actor)
59 GetImplementation(*this).Add(GetImplementation(actor));
62 void Scene::Remove(Actor actor)
64 GetImplementation(*this).Remove(GetImplementation(actor));
67 Size Scene::GetSize() const
69 return GetImplementation(*this).GetSize();
72 void Scene::SetDpi(Vector2 dpi)
74 GetImplementation(*this).SetDpi(dpi);
77 Vector2 Scene::GetDpi() const
79 return GetImplementation(*this).GetDpi();
82 void Scene::SetBackgroundColor(const Vector4& color)
84 GetImplementation(*this).SetBackgroundColor(color);
87 Vector4 Scene::GetBackgroundColor() const
89 return GetImplementation(*this).GetBackgroundColor();
92 RenderTaskList Scene::GetRenderTaskList() const
94 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
97 Layer Scene::GetRootLayer() const
99 return GetImplementation(*this).GetRootLayer();
102 uint32_t Scene::GetLayerCount() const
104 return GetImplementation(*this).GetLayerCount();
107 Layer Scene::GetLayer(uint32_t depth) const
109 return GetImplementation(*this).GetLayer(depth);
112 void Scene::SurfaceResized(float width, float height)
114 GetImplementation(*this).SurfaceResized(width, height);
117 void Scene::SurfaceReplaced()
119 GetImplementation(*this).SurfaceReplaced();
122 void Scene::Discard()
124 GetImplementation(*this).Discard();
127 void Scene::SetSurfaceRenderTarget(Graphics::RenderTarget* renderTarget)
129 GetImplementation(*this).SetSurfaceRenderTarget(renderTarget);
132 Integration::Scene Scene::Get(Actor actor)
134 return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
137 void Scene::QueueEvent(const Integration::Event& event)
139 GetImplementation(*this).QueueEvent(event);
142 void Scene::ProcessEvents()
144 GetImplementation(*this).ProcessEvents();
147 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
149 GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
152 void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
154 GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
157 void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
159 GetImplementation(*this).GetFrameRenderedCallback(callbacks);
162 void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
164 GetImplementation(*this).GetFramePresentedCallback(callbacks);
167 void Scene::SurfaceRotated(float width, float height, int32_t orientation)
169 GetImplementation(*this).SurfaceRotated(width, height, orientation);
172 int32_t Scene::GetCurrentSurfaceOrientation() const
174 return GetImplementation(*this).GetCurrentSurfaceOrientation();
177 const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
179 return GetImplementation(*this).GetCurrentSurfaceRect();
182 bool Scene::IsSurfaceRectChanged() const
184 return GetImplementation(*this).IsSurfaceRectChanged();
187 void Scene::SetRotationCompletedAcknowledgement()
189 GetImplementation(*this).SetRotationCompletedAcknowledgement();
192 bool Scene::IsRotationCompletedAcknowledgementSet() const
194 return GetImplementation(*this).IsRotationCompletedAcknowledgementSet();
197 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
199 return GetImplementation(*this).EventProcessingFinishedSignal();
202 Scene::KeyEventSignalType& Scene::KeyEventSignal()
204 return GetImplementation(*this).KeyEventSignal();
207 Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
209 return GetImplementation(*this).KeyEventGeneratedSignal();
212 Scene::TouchEventSignalType& Scene::TouchedSignal()
214 return GetImplementation(*this).TouchedSignal();
217 Scene::WheelEventSignalType& Scene::WheelEventSignal()
219 return GetImplementation(*this).WheelEventSignal();
222 } // namespace Integration