[NUI] Add NativeImageSource (#1532)
authorJoogabYun <40262755+JoogabYun@users.noreply.github.com>
Fri, 10 Apr 2020 05:03:44 +0000 (14:03 +0900)
committerGitHub <noreply@github.com>
Fri, 10 Apr 2020 05:03:44 +0000 (14:03 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.NativeImageSource.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/NativeImageInterface.cs
src/Tizen.NUI/src/public/NativeImageSource.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Texture.cs

diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageSource.cs b/src/Tizen.NUI/src/internal/Interop/Interop.NativeImageSource.cs
new file mode 100755 (executable)
index 0000000..d74c248
--- /dev/null
@@ -0,0 +1,32 @@
+using System.Runtime.InteropServices;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI
+{
+    using global::System;
+    internal static partial class Interop
+    {
+        internal static partial class NativeImageSource
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_Upcast")]
+            public static extern IntPtr Upcast(IntPtr jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_New")]
+            public static extern IntPtr New(IntPtr handle);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_Delete")]
+            public static extern void Delete(IntPtr jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_New_Handle")]
+            public static extern IntPtr NewHandle(uint jarg1, uint jarg2, int jarg3);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_AcquireBuffer")]
+            public static extern IntPtr AcquireBuffer(IntPtr jarg1, ref int jarg2, ref int jarg3, ref int jarg4);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageSource_ReleaseBuffer")]
+            public static extern bool ReleaseBuffer(IntPtr jarg1);
+        }
+    }
+}
\ No newline at end of file
index abb4837..3c94095 100755 (executable)
  *
  */
 
+using System.ComponentModel;
+
 namespace Tizen.NUI
 {
-    internal class NativeImageInterface : RefObject
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class NativeImageInterface : RefObject
     {
 
         internal NativeImageInterface(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageInterface.NativeImageInterface_SWIGUpcast(cPtr), cMemoryOwn)
diff --git a/src/Tizen.NUI/src/public/NativeImageSource.cs b/src/Tizen.NUI/src/public/NativeImageSource.cs
new file mode 100755 (executable)
index 0000000..13dfe7b
--- /dev/null
@@ -0,0 +1,61 @@
+
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace Tizen.NUI
+{
+    using global::System;
+
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class NativeImageSource : NativeImageInterface
+    {
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NativeImageSource(uint width, uint height, ColorDepth depth) : this(Interop.NativeImageSource.NewHandle(width, height, (int)depth), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        private IntPtr Handle;
+        internal NativeImageSource(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeImageSource.Upcast(Interop.NativeImageSource.New(cPtr)), cMemoryOwn)
+        {
+            Handle = cPtr;
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.NativeImageSource.Delete(Handle);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum ColorDepth
+        {
+            Default,
+            Bits8,
+            Bits16,
+            Bits24,
+            Bits32,
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageSource obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public IntPtr AcquireBuffer(ref int width, ref int height, ref int stride) {
+            IntPtr ret = Interop.NativeImageSource.AcquireBuffer(this.swigCPtr.Handle, ref width, ref height, ref stride);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool ReleaseBuffer() {
+            bool ret = Interop.NativeImageSource.ReleaseBuffer(this.swigCPtr.Handle);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+    }
+}
\ No newline at end of file
index c681f1c..c35a1f3 100755 (executable)
@@ -38,7 +38,9 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
         }
-        internal Texture(NativeImageInterface nativeImageInterface) : this(Interop.Texture.Texture_New__SWIG_1(NativeImageInterface.getCPtr(nativeImageInterface)), true)
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Texture(NativeImageInterface nativeImageInterface) : this(Interop.Texture.Texture_New__SWIG_1(NativeImageInterface.getCPtr(nativeImageInterface)), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();