SceneHolder& SceneHolder::operator=(SceneHolder&& rhs) noexcept = default;
+SceneHolder SceneHolder::DownCast(BaseHandle handle)
+{
+ return SceneHolder(dynamic_cast<Dali::Internal::Adaptor::SceneHolder*>(handle.GetObjectPtr()));
+}
+
SceneHolder::SceneHolder(Internal::Adaptor::SceneHolder* internal)
: BaseHandle(internal)
{
SceneHolder& operator=(SceneHolder&& rhs) noexcept;
/**
+ * @brief Downcast BaseHandle to SceneHolder
+ *
+ * @SINCE_2_3.35
+ * @param[in] handle The handle need to downcast
+ * @return Whether it's a valid SceneHolder or not
+ */
+ static SceneHolder DownCast(BaseHandle handle);
+
+ /**
* @brief Adds a child Actor to the SceneHolder.
*
* The child will be referenced.
{
namespace
{
-constexpr int32_t SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 300;
-constexpr uint32_t TIME_OUT_DURATION = 1000;
+static constexpr uint32_t ORDER_INDEX_CAPTURE_RENDER_TASK = INT32_MAX;
+constexpr int32_t SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 300;
+constexpr uint32_t TIME_OUT_DURATION = 1000;
} // namespace
Capture::Capture()
mQuality = quality;
}
+void Capture::SetExclusive(bool exclusive)
+{
+ if(mIsExclusive != exclusive)
+ {
+ mIsExclusive = exclusive;
+ if(mRenderTask)
+ {
+ mRenderTask.SetExclusive(mIsExclusive);
+ }
+ }
+}
+
+bool Capture::IsExclusive() const
+{
+ return mIsExclusive;
+}
+
Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
{
return mNativeImageSourcePtr;
return;
}
- Dali::Window window = DevelWindow::Get(source);
- if(!window)
+ Dali::Integration::SceneHolder sceneHolder = Dali::Integration::SceneHolder::Get(source);
+ if(!sceneHolder)
{
DALI_LOG_ERROR("The source is not added on the scene\n");
return;
{
DALI_LOG_ERROR("Camera must be on scene. Camera is connected to window now.\n");
}
- window.Add(mCameraActor);
+ sceneHolder.Add(mCameraActor);
mSceneOffCameraAfterCaptureFinished = true;
}
return;
}
- Dali::RenderTaskList taskList = window.GetRenderTaskList();
+ mSceneHolderHandle = sceneHolder;
+ Dali::RenderTaskList taskList = sceneHolder.GetRenderTaskList();
mRenderTask = taskList.CreateTask();
+ mRenderTask.SetOrderIndex(ORDER_INDEX_CAPTURE_RENDER_TASK);
mRenderTask.SetRefreshRate(Dali::RenderTask::REFRESH_ONCE);
mRenderTask.SetSourceActor(source);
mRenderTask.SetCameraActor(mCameraActor);
mRenderTask.SetFrameBuffer(mFrameBuffer);
mRenderTask.SetClearColor(clearColor);
mRenderTask.SetClearEnabled(true);
+ mRenderTask.SetExclusive(mIsExclusive);
mRenderTask.SetProperty(Dali::RenderTask::Property::REQUIRES_SYNC, true);
mRenderTask.FinishedSignal().Connect(this, &Capture::OnRenderFinished);
mRenderTask.GetCameraActor().SetInvertYAxis(true);
mCameraActor.Reset();
}
- if(mRenderTask)
+ Dali::Integration::SceneHolder sceneHolder = mSceneHolderHandle.GetHandle();
+ if(mRenderTask && sceneHolder)
{
- Dali::Window window = DevelWindow::Get(mSource);
- Dali::RenderTaskList taskList = window.GetRenderTaskList();
+ Dali::RenderTaskList taskList = sceneHolder.GetRenderTaskList();
taskList.RemoveTask(mRenderTask);
- mRenderTask.Reset();
}
+ mRenderTask.Reset();
mSource.Reset();
+ mSceneHolderHandle.Reset();
}
bool Capture::IsRenderTaskSetup()
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/object/weak-handle.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/public-api/rendering/texture.h>
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/capture/capture.h>
void SetImageQuality(uint32_t quality);
/**
+ * @copydoc Dali::Capture::SetExclusive
+ */
+ void SetExclusive(bool exclusive);
+
+ /**
+ * @copydoc Dali::Capture::IsExclusive
+ */
+ bool IsExclusive() const;
+
+ /**
* @copydoc Dali::Capture::GetNativeImageSource
*/
Dali::NativeImageSourcePtr GetNativeImageSource() const;
Capture& operator=(const Capture& rhs);
private:
- uint32_t mQuality;
- Dali::Texture mTexture;
- Dali::FrameBuffer mFrameBuffer;
- Dali::RenderTask mRenderTask;
- Dali::Actor mSource;
- Dali::CameraActor mCameraActor;
- Dali::Timer mTimer; ///< For timeout.
- Dali::Capture::CaptureFinishedSignalType mFinishedSignal;
- std::string mPath;
- Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image
- Dali::Devel::PixelBuffer mPixelBuffer;
- bool mFileSave;
- bool mUseDefaultCamera; // Whether we use default generated camera, or use inputed camera.
- bool mSceneOffCameraAfterCaptureFinished; // Whether we need to scene-off after capture finished.
+ uint32_t mQuality;
+ Dali::Texture mTexture;
+ Dali::WeakHandle<Dali::Integration::SceneHolder> mSceneHolderHandle;
+ Dali::FrameBuffer mFrameBuffer;
+ Dali::RenderTask mRenderTask;
+ Dali::Actor mSource;
+ Dali::CameraActor mCameraActor;
+ Dali::Timer mTimer; ///< For timeout.
+ Dali::Capture::CaptureFinishedSignalType mFinishedSignal;
+ std::string mPath;
+ Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image
+ Dali::Devel::PixelBuffer mPixelBuffer;
+ bool mIsExclusive{false};
+ bool mFileSave;
+ bool mUseDefaultCamera; // Whether we use default generated camera, or use inputed camera.
+ bool mSceneOffCameraAfterCaptureFinished; // Whether we need to scene-off after capture finished.
};
} // End of namespace Adaptor
return GetImpl(*this).SetImageQuality(quality);
}
+void Capture::SetExclusive(bool exclusive)
+{
+ return GetImpl(*this).SetExclusive(exclusive);
+}
+
+bool Capture::IsExclusive() const
+{
+ return GetImpl(*this).IsExclusive();
+}
+
Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
{
return GetImpl(*this).GetNativeImageSource();
void SetImageQuality(uint32_t quality);
/**
+ * @brief Sets whether the capture source should not be render on Screen or not.
+ * @SINCE_2_3.35
+ * @param[in] exclusive True if the source actors will only be rendered by this capture result
+ */
+ void SetExclusive(bool exclusive);
+
+ /**
+ * @brief Queries whether the Capture is exclusive or not.
+ * @SINCE_2_3.35
+ * @return True if the source actors will only be rendered by this capture result
+ */
+ bool IsExclusive() const;
+
+ /**
* @brief Get NativeImageSourcePtr that is saved captured image.
*
* @SINCE_1_9.10