Updated ImageVisual and AnimatedImageVisual maps to handle new properties 69/140069/4
authorDavid Steele <david.steele@samsung.com>
Thu, 20 Jul 2017 19:08:06 +0000 (20:08 +0100)
committerDavid Steele <david.steele@samsung.com>
Fri, 28 Jul 2017 16:51:04 +0000 (17:51 +0100)
Change-Id: Ibd8e22707ca5ece50a6416ec6ead8c679762a20d

Tizen.NUI/src/internal/NDalic.cs
Tizen.NUI/src/internal/NDalicPINVOKE.cs
Tizen.NUI/src/public/NUIConstants.cs
Tizen.NUI/src/public/VisualMaps.cs

index 576a9dd..b9b3ce3 100755 (executable)
@@ -922,6 +922,11 @@ namespace Tizen.NUI
         internal static readonly int IMAGE_VISUAL_PIXEL_AREA = NDalicPINVOKE.IMAGE_VISUAL_PIXEL_AREA_get();
         internal static readonly int IMAGE_VISUAL_WRAP_MODE_U = NDalicPINVOKE.IMAGE_VISUAL_WRAP_MODE_U_get();
         internal static readonly int IMAGE_VISUAL_WRAP_MODE_V = NDalicPINVOKE.IMAGE_VISUAL_WRAP_MODE_V_get();
+        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_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 MESH_VISUAL_OBJECT_URL = NDalicPINVOKE.MESH_VISUAL_OBJECT_URL_get();
         internal static readonly int MESH_VISUAL_MATERIAL_URL = NDalicPINVOKE.MESH_VISUAL_MATERIAL_URL_get();
index 5b57314..e02e7f2 100755 (executable)
@@ -6557,6 +6557,21 @@ class NDalicPINVOKE {
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_WRAP_MODE_V_get")]
   public static extern int IMAGE_VISUAL_WRAP_MODE_V_get();
 
+  [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_BATCH_SIZE_get")]
+  public static extern int IMAGE_VISUAL_BATCH_SIZE_get();
+
+  [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_CACHE_SIZE_get")]
+  public static extern int IMAGE_VISUAL_CACHE_SIZE_get();
+
+  [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_MASK_CONTENT_SCALE_get")]
+  public static extern int IMAGE_VISUAL_MASK_CONTENT_SCALE_get();
+
+  [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_CROP_TO_MASK_get")]
+  public static extern int IMAGE_VISUAL_CROP_TO_MASK_get();
+
   [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_OBJECT_URL_get")]
   public static extern int MESH_VISUAL_OBJECT_URL_get();
 
index e978872..1a581d1 100755 (executable)
@@ -824,6 +824,12 @@ namespace Tizen.NUI
         public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
         public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
         public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
+        public static readonly int MaskContentScale = NDalic.IMAGE_VISUAL_MASK_CONTENT_SCALE;
+        public static readonly int CropToMask = NDalic.IMAGE_VISUAL_CROP_TO_MASK;
+        public static readonly int BatchSize = NDalic.IMAGE_VISUAL_BATCH_SIZE;
+        public static readonly int CacheSize = NDalic.IMAGE_VISUAL_CACHE_SIZE;
+        public static readonly int FrameDelay = NDalic.IMAGE_VISUAL_FRAME_DELAY;
+
     }
 
     /// <summary>
index eac2ecb..a26b8f4 100755 (executable)
@@ -15,6 +15,7 @@
 
 namespace Tizen.NUI
 {
+    using System.Collections.Generic;
     using Tizen.NUI.BaseComponents;
 
     /// <summary>
@@ -567,11 +568,14 @@ namespace Tizen.NUI
         private Vector4 _pixelArea = null;
         private WrapModeType? _wrapModeU = null;
         private WrapModeType? _wrapModeV = null;
+        private float? _maskContentScale = null;
+        private bool? _cropToMask = null;
 
         /// <summary>
         /// Get or set the URL of the image.<br>
         /// Mandatory.
         /// </summary>
+
         public string URL
         {
             get
@@ -585,6 +589,7 @@ namespace Tizen.NUI
             }
         }
 
+
         /// <summary>
         /// Get or set the URL of the alpha mask.<br>
         /// Optional.
@@ -778,6 +783,32 @@ namespace Tizen.NUI
             }
         }
 
+        public float MaskContentScale
+        {
+            get
+            {
+                return _maskContentScale ?? 1.0f;
+            }
+            set
+            {
+                _maskContentScale = value;
+                UpdateVisual();
+            }
+        }
+
+        public bool CropToMask
+        {
+            get
+            {
+                return _cropToMask ?? false;
+            }
+            set
+            {
+                _cropToMask = value;
+                UpdateVisual();
+            }
+        }
+
         protected override void ComposingPropertyMap()
         {
             if (_url != null)
@@ -799,6 +830,8 @@ namespace Tizen.NUI
                 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)); }
                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
+                if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
+                if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
             }
         }
     }
@@ -1960,28 +1993,112 @@ namespace Tizen.NUI
         {
         }
 
-        private string _url = null;
+        private List<string> _urls = null;
+        private int? _batchSize = null;
+        private int? _cacheSize = null;
+        private float? _frameDelay = null;
 
         public string URL
         {
             get
             {
-                return _url;
+                if( _urls == null )
+                {
+                    return _urls[0];
+                }
+                else
+                {
+                    return null;
+                }
             }
             set
             {
-                _url = value;
+                if( _urls == null )
+                {
+                    _urls = new List<string>();
+                    _urls.Add(value);
+                }
+                else
+                {
+                    _urls[0] = value;
+                }
+                UpdateVisual();
+            }
+        }
+
+        public List<string> URLS
+        {
+            get
+            {
+                return _urls;
+            }
+            set
+            {
+                _urls = value;
+                UpdateVisual();
+            }
+        }
+
+        public int BatchSize
+        {
+            get
+            {
+                return _batchSize ?? 1;
+            }
+            set
+            {
+                _batchSize = value;
+                UpdateVisual();
+            }
+        }
+
+        public int CacheSize
+        {
+            get
+            {
+                return _cacheSize ?? 1;
+            }
+            set
+            {
+                _cacheSize = value;
+                UpdateVisual();
+            }
+        }
+        public float FrameDelay
+        {
+            get
+            {
+                return _frameDelay ?? 0.1f;
+            }
+            set
+            {
+                _frameDelay = value;
                 UpdateVisual();
             }
         }
 
         protected override void ComposingPropertyMap()
         {
-            if (_url != null)
+            if (_urls != null)
             {
                 _outputVisualMap = new PropertyMap();
                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
-                _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
+                if( _urls.Count == 1 )
+                {
+                    _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
+                }
+                else
+                {
+                    var urlArray = new PropertyArray();
+                    foreach( var url in _urls)
+                    {
+                        urlArray.Add(new PropertyValue(url));
+                    }
+                    _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
+                }
+                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 (_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)); }