mNativeImageSourcePtr(NULL),
mFileSave(false),
mUseDefaultCamera(true),
- mSceneOffCameraAfterCaptureFinished(false)
+ mSceneOffCameraAfterCaptureFinished(false),
+ mIsNativeImageSourcePossible(true)
{
}
mNativeImageSourcePtr(NULL),
mFileSave(false),
mUseDefaultCamera(!cameraActor),
- mSceneOffCameraAfterCaptureFinished(false)
+ mSceneOffCameraAfterCaptureFinished(false),
+ mIsNativeImageSourcePossible(true)
{
}
return mNativeImageSourcePtr;
}
+Dali::Texture Capture::GetTexture()
+{
+ return mTexture;
+}
+
Dali::Devel::PixelBuffer Capture::GetCapturedBuffer()
{
if(!mPixelBuffer || (mPixelBuffer && !mPixelBuffer.GetBuffer()))
void Capture::CreateTexture(const Vector2& size)
{
- if(!mNativeImageSourcePtr)
+ if(mIsNativeImageSourcePossible)
{
- mNativeImageSourcePtr = Dali::NativeImageSource::New(size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT);
- mTexture = Dali::Texture::New(*mNativeImageSourcePtr);
+ if(!mNativeImageSourcePtr)
+ {
+ mNativeImageSourcePtr = Dali::NativeImageSource::New(size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT);
+ mTexture = Dali::Texture::New(*mNativeImageSourcePtr);
+ }
+ }
+ else
+ {
+ mTexture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, unsigned(size.width), unsigned(size.height));
}
}
void Capture::SetupResources(const Dali::Vector2& position, const Dali::Vector2& size, const Dali::Vector4& clearColor, Dali::Actor source)
{
+ Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation(Internal::Adaptor::Adaptor::Get());
+ GraphicsInterface* graphics = &adaptor.GetGraphicsInterface();
+ auto eglGraphics = static_cast<EglGraphics*>(graphics);
+
+ if(eglGraphics->GetEglImplementation().GetGlesVersion() < GL_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE)
+ {
+ DALI_LOG_ERROR("GLES is 2.0, we can't use native image source \n");
+ mIsNativeImageSourcePossible = false;
+ }
+
CreateTexture(size);
CreateFrameBuffer();
bool Capture::SaveFile()
{
- if(mNativeImageSourcePtr)
+ if(mIsNativeImageSourcePossible)
+ {
+ if(mNativeImageSourcePtr)
+ {
+ return Dali::DevelNativeImageSource::EncodeToFile(*mNativeImageSourcePtr, mPath, mQuality);
+ }
+ }
+ else
{
- return Dali::DevelNativeImageSource::EncodeToFile(*mNativeImageSourcePtr, mPath, mQuality);
+ DALI_LOG_ERROR("can't use Capture::SavceFile(). we don't support this function in gles 2.0 \n");
}
+
return false;
}
Dali::Devel::PixelBuffer GetCapturedBuffer();
/**
+ * @copydoc Dali::Capture::GetTexture
+ */
+ Dali::Texture GetTexture();
+
+ /**
* @copydoc Dali::Capture::FinishedSignal
*/
Dali::Capture::CaptureFinishedSignalType& FinishedSignal();
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.
+ bool mIsNativeImageSourcePossible;
};
} // End of namespace Adaptor
// EXTERNAL HEADERS
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/signals/dali-signal.h>
// INTERNAL INCLUDES
Dali::NativeImageSourcePtr GetNativeImageSource() const;
/**
+ * @brief Get Texture of captured image.
+ *
+ * @return Texture Captured result
+ */
+ Dali::Texture GetTexture();
+
+ /**
* @brief Get finished signal.
*
* @SINCE_1_3_4