LoopCountProperty = BindableProperty.Create(nameof(LoopCount), typeof(int), typeof(Tizen.NUI.BaseComponents.LottieAnimationView), 0, propertyChanged: SetInternalLoopCountProperty, defaultValueCreator: GetInternalLoopCountProperty);
StopBehaviorProperty = BindableProperty.Create(nameof(StopBehavior), typeof(StopBehaviorType), typeof(LottieAnimationView), default(StopBehaviorType), propertyChanged: SetInternalStopBehaviorProperty, defaultValueCreator: GetInternalStopBehaviorProperty);
-
+
RedrawInScalingDownProperty = BindableProperty.Create(nameof(RedrawInScalingDown), typeof(bool), typeof(Tizen.NUI.BaseComponents.LottieAnimationView), false, propertyChanged: SetInternalRedrawInScalingDownProperty, defaultValueCreator: GetInternalRedrawInScalingDownProperty);
EnableFrameCacheProperty = BindableProperty.Create(nameof(EnableFrameCache), typeof(bool), typeof(Tizen.NUI.BaseComponents.LottieAnimationView), false, propertyChanged: SetInternalEnableFrameCacheProperty, defaultValueCreator: GetInternalEnableFrameCacheProperty);
+
+ NotifyAfterRasterizationProperty = BindableProperty.Create(nameof(NotifyAfterRasterization), typeof(bool), typeof(Tizen.NUI.BaseComponents.LottieAnimationView), false, propertyChanged: SetInternalNotifyAfterRasterizationProperty, defaultValueCreator: GetInternalNotifyAfterRasterizationProperty);
}
}
currentStates.desiredWidth = 0;
currentStates.desiredHeight = 0;
currentStates.synchronousLoading = true;
+ currentStates.enableFrameCache = false;
+ currentStates.notifyAfterRasterization = false;
// Notify to base ImageView cache that default synchronousLoading for lottie file is true.
base.SynchronousLoading = currentStates.synchronousLoading;
currentStates.framePlayRangeMin = -1;
currentStates.framePlayRangeMax = -1;
currentStates.totalFrame = -1;
- currentStates.enableFrameCache = false;
string ret = (value == null ? "" : value);
currentStates.url = ret;
using PropertyValue loopMode = new PropertyValue((int)currentStates.loopMode);
using PropertyValue redrawInScalingDown = new PropertyValue(currentStates.redrawInScalingDown);
using PropertyValue synchronousLoading = new PropertyValue(currentStates.synchronousLoading);
+ using PropertyValue enableFrameCache = new PropertyValue(currentStates.enableFrameCache);
+ using PropertyValue notifyAfterRasterization = new PropertyValue(currentStates.notifyAfterRasterization);
map.Add(Visual.Property.Type, type)
.Add(ImageVisualProperty.URL, url)
.Add(ImageVisualProperty.StopBehavior, stopAction)
.Add(ImageVisualProperty.LoopingMode, loopMode)
.Add(ImageVisualProperty.RedrawInScalingDown, redrawInScalingDown)
- .Add(ImageVisualProperty.SynchronousLoading, synchronousLoading);
+ .Add(ImageVisualProperty.SynchronousLoading, synchronousLoading)
+ .Add(ImageVisualProperty.EnableFrameCache, enableFrameCache)
+ .Add(ImageVisualProperty.NotifyAfterRasterization, notifyAfterRasterization);
if (currentStates.desiredWidth > 0)
{
}
else
{
- return (int) GetInternalCurrentFrameProperty(this);
+ return (int)GetInternalCurrentFrameProperty(this);
}
}
set
}
}
-
+ /// <summary>
+ /// Whether to AnimatedVectorImageVisual fixed cache or not.
+ /// </summary>
+ /// <remarks>
+ /// If this property is true, AnimatedVectorImageVisual enable frame cache for loading and keeps loaded frame
+ /// until the visual is removed. It reduces CPU cost when the animated image will be looping.
+ /// But it can spend a lot of memory if the resource has high resolution image or many frame count.
+ ///
+ /// Inhouse API.
+ /// It is used in the AnimatedVectorImageVisual.The default is false.
+ /// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableFrameCache
{
return currentStates.enableFrameCache;
}
}
+
+ /// <summary>
+ /// Whether notify AnimatedVectorImageVisual to render thread after every rasterization or not.
+ /// </summary>
+ /// <remarks>
+ /// If this property is true, AnimatedVectorImageVisual send notify to render thread after every rasterization.
+ /// If false, AnimatedVectorImageVisual set Renderer's Behaviour as Continouly (mean, always update the render thread.)
+ /// This flag is useful if given resource has low fps, so we don't need to render every frame.
+ ///
+ /// Inhouse API.
+ /// It is used in the AnimatedVectorImageVisual.The default is false.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool NotifyAfterRasterization
+ {
+ get
+ {
+ if (NUIApplication.IsUsingXaml)
+ {
+ return (bool)GetValue(NotifyAfterRasterizationProperty);
+ }
+ else
+ {
+ return (bool)GetInternalNotifyAfterRasterizationProperty(this);
+ }
+ }
+ set
+ {
+ if (NUIApplication.IsUsingXaml)
+ {
+ SetValue(NotifyAfterRasterizationProperty, value);
+ }
+ else
+ {
+ SetInternalNotifyAfterRasterizationProperty(this, null, value);
+ }
+ NotifyPropertyChanged();
+ }
+ }
+
+ private bool InternalNotifyAfterRasterization
+ {
+ set
+ {
+ if (currentStates.notifyAfterRasterization != value)
+ {
+ currentStates.changed = true;
+ currentStates.notifyAfterRasterization = value;
+
+ NUILog.Debug($"<[{GetId()}]SET currentStates.NotifyAfterRasterization={currentStates.notifyAfterRasterization}>");
+
+ Interop.View.InternalUpdateVisualPropertyBool(this.SwigCPtr, ImageView.Property.IMAGE, ImageVisualProperty.NotifyAfterRasterization, currentStates.notifyAfterRasterization);
+ }
+ }
+ get
+ {
+ NUILog.Debug($"NotifyAfterRasterization get! {currentStates.notifyAfterRasterization}");
+ return currentStates.notifyAfterRasterization;
+ }
+ }
#endregion Property
if (!imagePropertyUpdatedFlag) return;
// Update currentStates properties to cachedImagePropertyMap
- if(currentStates.changed)
+ if (currentStates.changed)
{
UpdateImage(ImageVisualProperty.LoopCount, new PropertyValue(currentStates.loopCount), false);
UpdateImage(ImageVisualProperty.StopBehavior, new PropertyValue((int)currentStates.stopEndAction), false);
UpdateImage(ImageVisualProperty.LoopingMode, new PropertyValue((int)currentStates.loopMode), false);
UpdateImage(ImageVisualProperty.RedrawInScalingDown, new PropertyValue(currentStates.redrawInScalingDown), false);
UpdateImage(ImageVisualProperty.SynchronousLoading, new PropertyValue(currentStates.synchronousLoading), false);
+ UpdateImage(ImageVisualProperty.EnableFrameCache, new PropertyValue(currentStates.enableFrameCache), false);
+ UpdateImage(ImageVisualProperty.NotifyAfterRasterization, new PropertyValue(currentStates.notifyAfterRasterization), false);
// Do not cache PlayRange and TotalFrameNumber into cachedImagePropertyMap.
// (To keep legacy implements behaviour)
ImageVisualProperty.StopBehavior,
ImageVisualProperty.LoopingMode,
ImageVisualProperty.RedrawInScalingDown,
+ ImageVisualProperty.EnableFrameCache,
+ ImageVisualProperty.NotifyAfterRasterization,
};
private struct states
internal int desiredWidth, desiredHeight;
internal bool synchronousLoading;
internal bool enableFrameCache;
+ internal bool notifyAfterRasterization;
internal bool changed;
};
private states currentStates;
instance.InternalURL = (string)newValue;
}
}
-
+
internal static object GetInternalURLProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
instance.InternalCurrentFrame = (int)newValue;
}
}
-
-
+
internal static object GetInternalCurrentFrameProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
instance.InternalLoopCount = (int)newValue;
}
}
- internal static object GetInternalLoopCountProperty(BindableObject bindable)
+ internal static object GetInternalLoopCountProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
return instance.InternalLoopCount;
instance.InternalStopBehavior = (Tizen.NUI.BaseComponents.LottieAnimationView.StopBehaviorType)newValue;
}
}
-
+
internal static object GetInternalStopBehaviorProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
instance.InternalRedrawInScalingDown = (bool)newValue;
}
}
-
+
internal static object GetInternalRedrawInScalingDownProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
instance.InternalEnableFrameCache = (bool)newValue;
}
}
-
+
internal static object GetInternalEnableFrameCacheProperty(BindableObject bindable)
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
return instance.InternalEnableFrameCache;
}
+
+ /// <summary>
+ /// NotifyAfterRasterizationProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty NotifyAfterRasterizationProperty = null;
+
+ internal static void SetInternalNotifyAfterRasterizationProperty(BindableObject bindable, object oldValue, object newValue)
+ {
+ var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
+ if (newValue != null)
+ {
+ instance.InternalNotifyAfterRasterization = (bool)newValue;
+ }
+ }
+
+ internal static object GetInternalNotifyAfterRasterizationProperty(BindableObject bindable)
+ {
+ var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
+ return instance.InternalNotifyAfterRasterization;
+ }
}
}