/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mTimer(),
mPath(),
mNativeImageSourcePtr(NULL),
- mFileSave(false)
+ mFileSave(false),
+ mUseDefaultCamera(true),
+ mSceneOffCameraAfterCaptureFinished(false)
{
}
mTimer(),
mPath(),
mNativeImageSourcePtr(NULL),
- mFileSave(false)
+ mFileSave(false),
+ mUseDefaultCamera(!cameraActor),
+ mSceneOffCameraAfterCaptureFinished(false)
{
}
if(!mCameraActor)
{
- mCameraActor = Dali::CameraActor::New(size);
+ mUseDefaultCamera = true;
+ mCameraActor = Dali::CameraActor::New(size);
// Because input position and size are for 2 dimentional area,
// default z-directional position of the camera is required to be used for the new camera position.
float cameraDefaultZPosition = mCameraActor.GetProperty<float>(Dali::Actor::Property::POSITION_Z);
mCameraActor.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
}
- window.Add(mCameraActor);
+ // Camera must be scene on. Add camera to window.
+ if(!mCameraActor.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE))
+ {
+ if(!mUseDefaultCamera)
+ {
+ DALI_LOG_ERROR("Camera must be on scene. Camera is connected to window now.\n");
+ }
+ window.Add(mCameraActor);
+ mSceneOffCameraAfterCaptureFinished = true;
+ }
if(!mFrameBuffer)
{
{
mTimer.Reset();
- if(mCameraActor)
+ if(mSceneOffCameraAfterCaptureFinished && mCameraActor)
{
+ if(!mUseDefaultCamera)
+ {
+ DALI_LOG_ERROR("Camera is disconnected from window now.\n");
+ }
+ mSceneOffCameraAfterCaptureFinished = false;
mCameraActor.Unparent();
mCameraActor.Reset();
}
#define DALI_INTERNAL_CAPTURE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <string>
// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/pixel-buffer.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>
#include <dali/public-api/dali-adaptor-common.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
namespace Dali
{
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.
};
} // End of namespace Adaptor