[NUI] Support for animated GIF (#34)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 17 Jan 2018 08:50:23 +0000 (17:50 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 17 Jan 2018 08:50:23 +0000 (17:50 +0900)
* [NUI] Added playback (i.e. Play, Pause, Stop) support for the animated GIF

Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
* [NUI] Loop count support for animated GIF

Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
* [NUI] Modify property index

Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/ManualPINVOKE.cs
src/Tizen.NUI/src/internal/NDalic.cs
src/Tizen.NUI/src/internal/NDalicPINVOKE.cs
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/NUIConstants.cs
src/Tizen.NUI/src/public/VisualMaps.cs

index 4d9d25f..6e87878 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1730,5 +1730,13 @@ namespace Tizen.NUI
         [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_RELOAD_get")]
         public static extern int ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
 
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_PLAY_get")]
+        public static extern int ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
+
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_PAUSE_get")]
+        public static extern int ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
+
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_ImageView_IMAGE_VISUAL_ACTION_STOP_get")]
+        public static extern int ImageView_IMAGE_VISUAL_ACTION_STOP_get();
     }
 }
index 25e5c57..40607d6 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -884,6 +884,7 @@ namespace Tizen.NUI
         internal static readonly int IMAGE_VISUAL_BATCH_SIZE = NDalicPINVOKE.IMAGE_VISUAL_BATCH_SIZE_get();
         internal static readonly int IMAGE_VISUAL_CACHE_SIZE = NDalicPINVOKE.IMAGE_VISUAL_CACHE_SIZE_get();
         internal static readonly int IMAGE_VISUAL_FRAME_DELAY = NDalicPINVOKE.IMAGE_VISUAL_FRAME_DELAY_get();
+        internal static readonly int IMAGE_VISUAL_LOOP_COUNT = NDalicPINVOKE.IMAGE_VISUAL_LOOP_COUNT_get();
         internal static readonly int IMAGE_VISUAL_MASK_CONTENT_SCALE = NDalicPINVOKE.IMAGE_VISUAL_MASK_CONTENT_SCALE_get();
         internal static readonly int IMAGE_VISUAL_CROP_TO_MASK = NDalicPINVOKE.IMAGE_VISUAL_CROP_TO_MASK_get();
         internal static readonly int IMAGE_VISUAL_RELEASE_POLICY = NDalicPINVOKE.IMAGE_VISUAL_RELEASE_POLICY_get();
index 2dbb943..c80ae80 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -6625,6 +6625,9 @@ class NDalicPINVOKE {
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_FRAME_DELAY_get")]
   public static extern int IMAGE_VISUAL_FRAME_DELAY_get();
 
+  [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_LOOP_COUNT_get")]
+  public static extern int IMAGE_VISUAL_LOOP_COUNT_get();
+
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_MASK_CONTENT_SCALE_get")]
   public static extern int IMAGE_VISUAL_MASK_CONTENT_SCALE_get();
 
index 2add727..49958e7 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -162,6 +162,10 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get();
             internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
             internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get();
+            internal static readonly int ACTION_RELOAD = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
+            internal static readonly int ACTION_PLAY = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
+            internal static readonly int ACTION_PAUSE = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
+            internal static readonly int ACTION_STOP = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_STOP_get();
         }
 
         /// <summary>
@@ -232,8 +236,6 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-
-        private static readonly int _actionReload = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
         /// <summary>
         /// Force reloading of the image, all visuals using this image will get the latest one.
         /// </summary>
@@ -242,7 +244,40 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public void Reload()
         {
-            this.DoAction(ImageView.Property.IMAGE, _actionReload, new PropertyValue(0));
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Play the animated GIF. This is also Default playback mode.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Play()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Pause the animated GIF.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Pause()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Stop the animated GIF.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Stop()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0));
         }
 
         /// <summary>
index b105d49..982861a 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 Samsung Electronics Co., Ltd.
+// Copyright (c) 2018 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -1260,6 +1260,12 @@ namespace Tizen.NUI
         /// <since_tizen> 4 </since_tizen>
         public static readonly int FrameDelay = NDalic.IMAGE_VISUAL_FRAME_DELAY;
         /// <summary>
+        /// The number of times the AnimatedImageVisual will be looped
+        /// Default -1. if < 0, loop unlimited. else, loop loopCount times.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public static readonly int LoopCount = NDalic.IMAGE_VISUAL_LOOP_COUNT;
+        /// <summary>
         /// The policy to determine when an image should no longer be cached
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
index 59234b3..4c4191e 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -2321,6 +2321,7 @@ namespace Tizen.NUI
         private int? _batchSize = null;
         private int? _cacheSize = null;
         private float? _frameDelay = null;
+        private float? _loopCount = null;
 
         /// <summary>
         /// Gets and Sets the url in the AnimatedImageVisual.
@@ -2423,6 +2424,24 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Gets and Sets the number of times the AnimatedImageVisual will be looped.
+        /// Default -1. if < 0, loop unlimited. else, loop loopCount times.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public float LoopCount
+        {
+            get
+            {
+                return _loopCount ?? -1;
+            }
+            set
+            {
+                _loopCount = value;
+                UpdateVisual();
+            }
+        }
+
+        /// <summary>
         /// Compose the out visual map.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -2448,6 +2467,7 @@ namespace Tizen.NUI
                 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
                 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
                 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
+                if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }