From 93b4319c826a42b27de079add63b681bdbff2a63 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 20 Jul 2017 20:08:06 +0100 Subject: [PATCH] Updated ImageVisual and AnimatedImageVisual maps to handle new properties Change-Id: Ibd8e22707ca5ece50a6416ec6ead8c679762a20d --- src/Tizen.NUI/src/internal/NDalic.cs | 5 ++ src/Tizen.NUI/src/internal/NDalicPINVOKE.cs | 15 ++++ src/Tizen.NUI/src/public/NUIConstants.cs | 6 ++ src/Tizen.NUI/src/public/VisualMaps.cs | 127 ++++++++++++++++++++++++++-- 4 files changed, 148 insertions(+), 5 deletions(-) diff --git a/src/Tizen.NUI/src/internal/NDalic.cs b/src/Tizen.NUI/src/internal/NDalic.cs index 576a9dd..b9b3ce3 100755 --- a/src/Tizen.NUI/src/internal/NDalic.cs +++ b/src/Tizen.NUI/src/internal/NDalic.cs @@ -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(); diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 5b57314..e02e7f2 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -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(); diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs index e978872..1a581d1 100755 --- a/src/Tizen.NUI/src/public/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -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; + } /// diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index eac2ecb..a26b8f4 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -15,6 +15,7 @@ namespace Tizen.NUI { + using System.Collections.Generic; using Tizen.NUI.BaseComponents; /// @@ -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; /// /// Get or set the URL of the image.
/// Mandatory. ///
+ public string URL { get @@ -585,6 +589,7 @@ namespace Tizen.NUI } } + /// /// Get or set the URL of the alpha mask.
/// 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 _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(); + _urls.Add(value); + } + else + { + _urls[0] = value; + } + UpdateVisual(); + } + } + + public List 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)); } -- 2.7.4