[NUI] Change RendererTexture(texture) into TextureResourceUrl(imageUrl)
authorjmm <j0064423.lee@samsung.com>
Thu, 14 Sep 2023 01:58:31 +0000 (10:58 +0900)
committerbshsqa <32317749+bshsqa@users.noreply.github.com>
Thu, 14 Sep 2023 10:40:33 +0000 (19:40 +0900)
src/Tizen.NUI/src/public/ParticleSystem/ParticleEmitter.cs
test/Tizen.NUI.ParticleSystem.Sample/ParticleSystemSample.cs

index 8871528..182bd5a 100644 (file)
@@ -232,11 +232,18 @@ namespace Tizen.NUI.ParticleSystem
         /// Sets texture to be used by the renderer
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public Texture RendererTexture
+        public string TextureResourceUrl
         {
             set
             {
-                Interop.ParticleEmitter.SetTexture(SwigCPtr, value.SwigCPtr);
+                var pixelBuffer = ImageLoader.LoadImageFromFile(value);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+                Texture tex = new Texture(TextureType.TEXTURE_2D, PixelFormat.RGBA8888, pixelBuffer.GetWidth(),
+                        pixelBuffer.GetHeight());
+                tex.Upload(pixelBuffer.CreatePixelData());
+
+                Interop.ParticleEmitter.SetTexture(SwigCPtr, tex.SwigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
         }
index ba30659..462ffe5 100644 (file)
@@ -172,12 +172,7 @@ namespace Tizen.NUI.ParticleSystem.Sample
             mEmitter.AddModifier(mModifier);
             
             // Load texture
-            var pixelBuffer = ImageLoader.LoadImageFromFile(IMAGE_DIR + "/blue-part2.png");
-            Texture tex = new Texture(TextureType.TEXTURE_2D, PixelFormat.RGBA8888, pixelBuffer.GetWidth(),
-                pixelBuffer.GetHeight());
-            tex.Upload(pixelBuffer.CreatePixelData());
-            
-            mEmitter.RendererTexture = tex;
+            mEmitter.TextureResourceUrl = IMAGE_DIR + "/blue-part2.png";
             mEmitter.Start();
         }