Binding to create Texture using TbmSurface 54/239854/10
authorhuiyu.eun <huiyu.eun@samsung.com>
Mon, 13 Jul 2020 09:35:48 +0000 (18:35 +0900)
committerhuiyu eun <huiyu.eun@samsung.com>
Tue, 25 Aug 2020 04:06:41 +0000 (04:06 +0000)
Change-Id: I95e221be68d49eaedbb83d80a01c0e87bfd97707
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
dali-csharp-binder/src/dali_wrap.cpp

index 5e88da6ab14a59833f5d6264de720aa716e38c54..848b3495946b1d5d711af31b03feeb4094311693 100644 (file)
@@ -485,6 +485,8 @@ void SWIG_CSharpException(int code, const char *msg) {
 #include <dali-toolkit/devel-api/controls/video-view/video-view-devel.h>
 
 #include <dali/devel-api/adaptor-framework/native-image-source-devel.h>
+#include <tbm_surface.h>
+
 
 #include <dali-toolkit/devel-api/text/rendering-backend.h>
 
@@ -24122,6 +24124,38 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_Texture_New__SWIG_1(void * jarg1) {
 }
 
 
+SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_Texture_TbmSurface(tbm_surface_h tbm_surface) {
+  Dali::NativeImageSourcePtr mNativeImageSrc;
+  Dali::Texture mNativeTexture;
+  void * jresult ;
+
+  if (!tbm_surface) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "tbm surface is null", 0);
+    return 0;
+  }
+
+  try {
+    Dali::Any source(tbm_surface);
+    mNativeImageSrc = Dali::NativeImageSource::New(source);
+    mNativeTexture = Dali::Texture::New( *mNativeImageSrc );
+    } catch (std::out_of_range& e) {
+      SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what()));
+      return 0;
+    } catch (std::exception& e) {
+      SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what()));
+      return 0;
+    } catch (Dali::DaliException e) {
+      SWIG_CSharpException(SWIG_UnknownError, e.condition);
+      return 0;
+    } catch (...) {
+      SWIG_CSharpException(SWIG_UnknownError, "unknown error");
+      return 0;
+  }
+
+  jresult = new Dali::Texture((const Dali::Texture &)mNativeTexture);
+  return (void*)jresult;
+}
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_Texture__SWIG_0() {
   void * jresult ;
   Dali::Texture *result = 0 ;