From deec08bd67d3d8f25fca8e482cb8141f0aa96c65 Mon Sep 17 00:00:00 2001 From: Agnelo Vaz Date: Wed, 27 Sep 2017 15:28:14 +0100 Subject: [PATCH] Adding ImageVisual ReleasePolicy & LoadPolicy Change-Id: I9c434fb9336426556142c1a3fad8d73797d22f24 --- Tizen.NUI/src/internal/NDalic.cs | 2 ++ Tizen.NUI/src/internal/NDalicPINVOKE.cs | 6 +++++ Tizen.NUI/src/public/NUIConstants.cs | 39 ++++++++++++++++++++++++++++++++- Tizen.NUI/src/public/VisualMaps.cs | 39 +++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) diff --git a/Tizen.NUI/src/internal/NDalic.cs b/Tizen.NUI/src/internal/NDalic.cs index 13697ac..62c3f1c 100755 --- a/Tizen.NUI/src/internal/NDalic.cs +++ b/Tizen.NUI/src/internal/NDalic.cs @@ -885,6 +885,8 @@ namespace Tizen.NUI 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 IMAGE_VISUAL_RELEASE_POLICY = NDalicPINVOKE.IMAGE_VISUAL_RELEASE_POLICY_get(); + internal static readonly int IMAGE_VISUAL_LOAD_POLICY = NDalicPINVOKE.IMAGE_VISUAL_LOAD_POLICY_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/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 728cea5..73ce6d8 100755 --- a/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -6564,6 +6564,12 @@ class NDalicPINVOKE { [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_IMAGE_VISUAL_RELEASE_POLICY_get")] + public static extern int IMAGE_VISUAL_RELEASE_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_LOAD_POLICY_get")] + public static extern int IMAGE_VISUAL_LOAD_POLICY_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/Tizen.NUI/src/public/NUIConstants.cs b/Tizen.NUI/src/public/NUIConstants.cs index b89e0cd..6b8e184 100755 --- a/Tizen.NUI/src/public/NUIConstants.cs +++ b/Tizen.NUI/src/public/NUIConstants.cs @@ -481,6 +481,42 @@ namespace Tizen.NUI } /// + /// Specifies the Release Policy types
+ /// Decides if the image should be cached in different conditions + ///
+ public enum ReleasePolicyType + { + /// + /// Image is released when visual detached from scene + /// + Detached = 0, + /// + /// Image is only released when visual is destroyed + /// + Destroyed, + /// + /// Image is not released. + /// + Never + } + + /// + /// Specifies the Load Policy types
+ /// Decides when the image texture should be loaded + ///
+ public enum LoadPolicyType + { + /// + /// Load texture once the image source has been provided. Even if not being used yet. + /// + Immediate = 0, + /// + /// Only load texture once the visual is attached, when the image needs to be shown. + /// + Attached + } + + /// /// The type of coordinate system for certain attributes of the points in a gradient. /// public enum GradientVisualUnitsType @@ -833,7 +869,8 @@ namespace Tizen.NUI 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; - + public static readonly int ReleasePolicy = NDalic.IMAGE_VISUAL_RELEASE_POLICY; + public static readonly int LoadPolicy = NDalic.IMAGE_VISUAL_LOAD_POLICY; } /// diff --git a/Tizen.NUI/src/public/VisualMaps.cs b/Tizen.NUI/src/public/VisualMaps.cs index 6dc815d..da6550e 100755 --- a/Tizen.NUI/src/public/VisualMaps.cs +++ b/Tizen.NUI/src/public/VisualMaps.cs @@ -570,6 +570,8 @@ namespace Tizen.NUI private WrapModeType? _wrapModeV = null; private float? _maskContentScale = null; private bool? _cropToMask = null; + private ReleasePolicyType? _releasePolicy = null; + private LoadPolicyType? _loadPolicy = null; /// /// Get or set the URL of the image.
@@ -809,6 +811,41 @@ namespace Tizen.NUI } } + /// + /// Get or set the Image Visual release policy
+ /// It decides if a texture should be released from the cache or kept to reduce loading time
+ ///
+ public ReleasePolicyType ReleasePolicy + { + get + { + return _releasePolicy ?? (ReleasePolicyType.Destroyed ); + } + set + { + _releasePolicy = value; + UpdateVisual(); + } + } + + + /// + /// Get or set the Image Visual image loading policy
+ /// It decides if a texture should be loaded immediately after source set or only after visual is added to window
+ ///
+ public LoadPolicyType LoadPolicy + { + get + { + return _loadPolicy ?? (LoadPolicyType.Attached); + } + set + { + _loadPolicy = value; + UpdateVisual(); + } + } + protected override void ComposingPropertyMap() { if (_url != null) @@ -832,6 +869,8 @@ namespace Tizen.NUI 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)); } + if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); } + if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); } } } } -- 2.7.4