{
namespace
{
-constexpr int32_t GL_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 30;
-constexpr uint32_t TIME_OUT_DURATION = 1000;
+constexpr int32_t SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 300;
+constexpr uint32_t TIME_OUT_DURATION = 1000;
} // namespace
Capture::Capture()
return mNativeImageSourcePtr;
}
+Dali::Texture Capture::GetTexture() const
+{
+ return mTexture;
+}
+
Dali::Devel::PixelBuffer Capture::GetCapturedBuffer()
{
if(!mPixelBuffer || (mPixelBuffer && !mPixelBuffer.GetBuffer()))
void Capture::CreateTexture(const Vector2& size)
{
- if(!mNativeImageSourcePtr)
+ if(mFileSave)
{
- 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::RGBA8888, 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(mFileSave && Dali::Shader::GetShaderLanguageVersion() < SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE)
+ {
+ DALI_LOG_ERROR("GLES is 2.0, we can't use native image source \n");
+ mFileSave = false;
+ }
+
CreateTexture(size);
CreateFrameBuffer();
{
return Dali::DevelNativeImageSource::EncodeToFile(*mNativeImageSourcePtr, mPath, mQuality);
}
+
return false;
}
// 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() const;
+
+ /**
* @brief Get finished signal.
*
* @SINCE_1_3_4