2 * Copyright (c) 2022 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 windowOrientation, int32_t screenOrientation)
35 Internal::ScenePtr internal = Internal::Scene::New(size, windowOrientation, screenOrientation);
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::operator=(const Scene& rhs) = default;
52 Scene::Scene(Scene&& handle) = default;
54 Scene& Scene::operator=(Scene&& rhs) = default;
56 Scene::Scene(Internal::Scene* internal)
57 : BaseHandle(internal)
61 void Scene::Add(Actor actor)
63 GetImplementation(*this).Add(GetImplementation(actor));
66 void Scene::Remove(Actor actor)
68 GetImplementation(*this).Remove(GetImplementation(actor));
71 Size Scene::GetSize() const
73 return GetImplementation(*this).GetSize();
76 void Scene::SetDpi(Vector2 dpi)
78 GetImplementation(*this).SetDpi(dpi);
81 Vector2 Scene::GetDpi() const
83 return GetImplementation(*this).GetDpi();
86 void Scene::SetBackgroundColor(const Vector4& color)
88 GetImplementation(*this).SetBackgroundColor(color);
91 Vector4 Scene::GetBackgroundColor() const
93 return GetImplementation(*this).GetBackgroundColor();
96 RenderTaskList Scene::GetRenderTaskList() const
98 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
101 Layer Scene::GetRootLayer() const
103 return GetImplementation(*this).GetRootLayer();
106 Layer Scene::GetOverlayLayer()
108 return GetImplementation(*this).GetOverlayLayer();
111 uint32_t Scene::GetLayerCount() const
113 return GetImplementation(*this).GetLayerCount();
116 Layer Scene::GetLayer(uint32_t depth) const
118 return GetImplementation(*this).GetLayer(depth);
121 void Scene::SurfaceResized(float width, float height)
123 GetImplementation(*this).SurfaceResized(width, height);
126 void Scene::SurfaceReplaced()
128 GetImplementation(*this).SurfaceReplaced();
131 void Scene::Discard()
133 GetImplementation(*this).Discard();
136 void Scene::SetSurfaceRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo)
138 GetImplementation(*this).SetSurfaceRenderTarget(renderTargetCreateInfo);
141 Integration::Scene Scene::Get(Actor actor)
143 return Dali::Integration::Scene(&GetImplementation(actor).GetScene());
146 void Scene::QueueEvent(const Integration::Event& event)
148 GetImplementation(*this).QueueEvent(event);
151 void Scene::ProcessEvents()
153 GetImplementation(*this).ProcessEvents();
156 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
158 GetImplementation(*this).AddFrameRenderedCallback(std::move(callback), frameId);
161 void Scene::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
163 GetImplementation(*this).AddFramePresentedCallback(std::move(callback), frameId);
166 void Scene::GetFrameRenderedCallback(FrameCallbackContainer& callbacks)
168 GetImplementation(*this).GetFrameRenderedCallback(callbacks);
171 void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
173 GetImplementation(*this).GetFramePresentedCallback(callbacks);
176 void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
178 GetImplementation(*this).SurfaceRotated(width, height, windowOrientation, screenOrientation);
181 int32_t Scene::GetCurrentSurfaceOrientation() const
183 return GetImplementation(*this).GetCurrentSurfaceOrientation();
186 int32_t Scene::GetCurrentScreenOrientation() const
188 return GetImplementation(*this).GetCurrentScreenOrientation();
191 const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
193 return GetImplementation(*this).GetCurrentSurfaceRect();
196 bool Scene::IsSurfaceRectChanged() const
198 return GetImplementation(*this).IsSurfaceRectChanged();
201 void Scene::SetRotationCompletedAcknowledgement()
203 GetImplementation(*this).SetRotationCompletedAcknowledgement();
206 bool Scene::IsRotationCompletedAcknowledgementSet() const
208 return GetImplementation(*this).IsRotationCompletedAcknowledgementSet();
211 Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
213 return GetImplementation(*this).EventProcessingFinishedSignal();
216 Scene::KeyEventSignalType& Scene::KeyEventSignal()
218 return GetImplementation(*this).KeyEventSignal();
221 Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
223 return GetImplementation(*this).KeyEventGeneratedSignal();
226 Scene::KeyEventGeneratedSignalType& Scene::InterceptKeyEventSignal()
228 return GetImplementation(*this).InterceptKeyEventSignal();
231 Scene::TouchEventSignalType& Scene::TouchedSignal()
233 return GetImplementation(*this).TouchedSignal();
236 Scene::WheelEventSignalType& Scene::WheelEventSignal()
238 return GetImplementation(*this).WheelEventSignal();
241 Scene::WheelEventGeneratedSignalType& Scene::WheelEventGeneratedSignal()
243 return GetImplementation(*this).WheelEventGeneratedSignal();
246 } // namespace Integration