[NUI] Add AddPrecompileShader() for adding precompile shader
authorsunghyun kim <scholb.kim@samsung.com>
Wed, 21 Aug 2024 09:50:57 +0000 (18:50 +0900)
committerbshsqa <32317749+bshsqa@users.noreply.github.com>
Wed, 25 Sep 2024 12:13:40 +0000 (21:13 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.VisualFactory.cs
src/Tizen.NUI/src/public/Visuals/VisualFactory.cs

index 988953bf5b7fdff62dd63c657600b0c5467f0bea..0be090072462b0c15ae12b224667369e71a50bc0 100755 (executable)
@@ -31,6 +31,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_CreateVisual__SWIG_0")]
             public static extern global::System.IntPtr CreateVisual(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_AddPrecompileShader")]
+            public static extern bool AddPrecompileShader(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_UsePreCompiledShader")]
             public static extern void UsePreCompiledShader(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
index 7fb9c8d043cd2c7c480c6c4226b1da8cd700a314..0ca06449da4deb2cd4b4fd6ad577f5bb341280e4 100755 (executable)
@@ -136,5 +136,45 @@ namespace Tizen.NUI
             Interop.VisualFactory.UsePreCompiledShader(SwigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
+
+        /// <summary>
+        /// Adds a list of pre-compiled shaders to the visual factory.
+        /// </summary>
+        ///
+        /// This API allows you to add the desired precompile shader to the list.
+        /// you can set it through PropertyMap.
+        /// you need to know the values for setting well to use them, so please refer to the explanation below.
+        ///
+        /// The property map consists of string keys.
+        ///
+        /// - shaderType: Set the desired shader type. we provides these type: "image","text","color","3d" and "custom"
+        /// - shaderOption(propertyMap): Set the desired shader option. we provides these flag: we provides a lot of shader options, so user need to check proper shader option.
+        /// - vertexShader: Set the vertext shader that user want. this is for custom shader.
+        /// - fragmentShader: Set the fragment shader that user want. this is for custom shader.
+        /// - shaderName: if user want to set shader name, use this. this is for custom shader.(optional)
+        ///
+        /// (example)
+        /// PropertyMap imageShader = new PropertyMap();
+        /// imageShader.Add("shaderType", new PropertyValue("image"));
+        /// imageShader.Add("shaderOption", new PropertyValue(new PropertyMap().Add("ROUNDED_CORNER", new PropertyValue(true))
+        ///                                                                     .Add("MASKING", new PropertyValue(true))));
+        ///
+        /// PropertyMap textShader = new PropertyMap();
+        /// textShader.Add("shaderType", new PropertyValue("text"));
+        ///
+        /// VisualFactory.Instance.AddPrecompileShader(imageShader);
+        /// VisualFactory.Instance.AddPrecompileShader(textShader);
+        /// VisualFactory.Instance.UsePreCompiledShader();
+        ///
+        /// <param name="option">The map contains the shader option for precompiling.</param>
+        /// <return>True if the pre-compiled shader is added, otherwise false.</return>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool AddPrecompileShader(PropertyMap option)
+        {
+            bool result = false;
+            result = Interop.VisualFactory.AddPrecompileShader(SwigCPtr, PropertyMap.getCPtr(option));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return result;
+        }
     }
 }