From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Wed, 17 Jan 2018 08:50:23 +0000 (+0900) Subject: [NUI] Support for animated GIF (#34) X-Git-Tag: 4.0.1-preview1-00067~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7dbc44e51f3d133b7d56e5b79c62a5e3c697cdbc;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Support for animated GIF (#34) * [NUI] Added playback (i.e. Play, Pause, Stop) support for the animated GIF Signed-off-by: huiyu,eun * [NUI] Loop count support for animated GIF Signed-off-by: huiyu,eun * [NUI] Modify property index Signed-off-by: huiyu,eun --- diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index 4d9d25f..6e87878 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -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(); } } diff --git a/src/Tizen.NUI/src/internal/NDalic.cs b/src/Tizen.NUI/src/internal/NDalic.cs index 25e5c57..40607d6 100755 --- a/src/Tizen.NUI/src/internal/NDalic.cs +++ b/src/Tizen.NUI/src/internal/NDalic.cs @@ -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(); diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 2dbb943..c80ae80 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -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(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 2add727..49958e7 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -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(); } /// @@ -232,8 +236,6 @@ namespace Tizen.NUI.BaseComponents return ret; } - - private static readonly int _actionReload = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get(); /// /// Force reloading of the image, all visuals using this image will get the latest one. /// @@ -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)); + } + + /// + /// Play the animated GIF. This is also Default playback mode. + /// + /// 5 + /// 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)); + } + + /// + /// Pause the animated GIF. + /// + /// 5 + /// 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)); + } + + /// + /// Stop the animated GIF. + /// + /// 5 + /// 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)); } /// diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs index b105d49..982861a 100755 --- a/src/Tizen.NUI/src/public/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -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 /// 4 public static readonly int FrameDelay = NDalic.IMAGE_VISUAL_FRAME_DELAY; /// + /// The number of times the AnimatedImageVisual will be looped + /// Default -1. if < 0, loop unlimited. else, loop loopCount times. + /// + /// 4 + public static readonly int LoopCount = NDalic.IMAGE_VISUAL_LOOP_COUNT; + /// /// The policy to determine when an image should no longer be cached /// /// 5 diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 59234b3..4c4191e 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -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; /// /// Gets and Sets the url in the AnimatedImageVisual. @@ -2423,6 +2424,24 @@ namespace Tizen.NUI } /// + /// Gets and Sets the number of times the AnimatedImageVisual will be looped. + /// Default -1. if < 0, loop unlimited. else, loop loopCount times. + /// + /// 4 + public float LoopCount + { + get + { + return _loopCount ?? -1; + } + set + { + _loopCount = value; + UpdateVisual(); + } + } + + /// /// Compose the out visual map. /// /// 3 @@ -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)); }