From 899d417779ac73b0916d4d13c12605015df4eb59 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 15 Jun 2017 18:48:04 +0100 Subject: [PATCH] Added support for animating the background color of a view. The View background is animated using a new API AnimateBackgroundColor via the CreateTransition method, which has been left protected for the moment (It's only supposed to be used by custom view implementations). Change-Id: I5853a9fecbac06f2aff3846f27769f944c7a9d77 Signed-off-by: David Steele --- .../visuals-using-custom-view/ContactData.cs | 24 +++++- .../visuals-using-custom-view/ContactView.cs | 70 ++++++++++-------- .../visuals-using-custom-view.cs | 9 ++- .../NUISamples.TizenTV/res/images/mask.png | Bin 0 -> 4454 bytes src/Tizen.NUI/src/internal/ManualPINVOKE.cs | 3 + src/Tizen.NUI/src/public/AlphaFunction.cs | 82 ++++++++++++++++++++- src/Tizen.NUI/src/public/BaseComponents/View.cs | 71 ++++++++++++++++-- 7 files changed, 215 insertions(+), 44 deletions(-) create mode 100644 NUISamples/NUISamples/NUISamples.TizenTV/res/images/mask.png diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactData.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactData.cs index 20b535b..9a3b9a8 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactData.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactData.cs @@ -24,23 +24,28 @@ namespace VisualsUsingCustomView // The collection of contacts static class ContactsList { - private const string resources = "/home/owner/apps_rw/NUISamples.TizenTV/res"; + private const string resources = "/home/SERILOCAL/david.steele/Git/Tizen/nui/NUISamples/NUISamples/NUISamples.TizenTV/res"; public static readonly ContactItem[] s_contactData = new ContactItem[] { new ContactItem ("Emmett Yates", resources + "/images/gallery-small-43.jpg", + resources + "/images/mask.png", new Color((73.0f/255.0f),(182.0f/255.0f), (245.0f/255.0f), 1.0f), (int)PrimitiveVisualShapeType.Cone), new ContactItem ("Leslie Wong", resources+ "/images/gallery-2.jpg", + resources + "/images/mask.png", new Color((51.0f/255.0f), (51.0f/255.0f), (102.0f/255.0f), 1.0f), (int)PrimitiveVisualShapeType.Sphere), new ContactItem ("Walter Jensen", resources+ "/images/gallery-0.jpg", + resources + "/images/mask.png", new Color((151.0f/255.0f), (214.0f/255.0f), (240.0f/255.0f), 1.0f), (int)PrimitiveVisualShapeType.Cylinder), new ContactItem ("Dan Haynes", resources+"/images/gallery-1.jpg", + resources + "/images/mask.png", new Color((102.0f/255.0f), (251.0f/255.0f), (102.0f/255.0f), 1.0f), (int)PrimitiveVisualShapeType.ConicalFrustrum), new ContactItem ("Mable Hodges", resources+"/images/gallery-3.jpg", + resources + "/images/mask.png", new Color((255.0f/255.0f), (102.0f/255.0f), (102.0f/255.0f), 1.0f), (int)PrimitiveVisualShapeType.Cube) }; @@ -53,11 +58,13 @@ namespace VisualsUsingCustomView private string _imageURL; private Color _color; private int _shape; + private string _maskURL; - public ContactItem(string name, string imageURL, Color color, int shape) + public ContactItem(string name, string imageURL, string maskURL, Color color, int shape) { _name = name; _imageURL = imageURL; + _maskURL = maskURL; _color = color; _shape = shape; } @@ -73,6 +80,17 @@ namespace VisualsUsingCustomView _imageURL = value; } } + public string MaskURL + { + get + { + return _maskURL; + } + set + { + _maskURL = value; + } + } public string Name { @@ -110,4 +128,4 @@ namespace VisualsUsingCustomView } } } -} \ No newline at end of file +} diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs index 6711b2a..d33faae 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs @@ -28,23 +28,42 @@ namespace VisualsUsingCustomView { public class ContactView : CustomView { - private const int ColorVisualPropertyIndex = 0; - private const int PrimitiveVisualPropertyIndex = 1; - private const int ImageVisualPropertyIndex = 2; - private const int TextVisualPropertyIndex = 3; + private const int PROPERTY_REGISTRATION_START_INDEX = 10001000; + private const int ColorVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+1 ; + private const int PrimitiveVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+2; + private const int ImageVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+3; + private const int TextVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+4; private VisualBase _imageVisual; private VisualBase _colorVisual; private VisualBase _primitiveVisual; private VisualBase _textVisual; private int _shape; private string _imageURL; + private string _maskURL; private string _name; private Color _color; + static CustomView CreateInstance() + { + return new ContactView(); + } + + static ContactView() + { + ViewRegistry.Instance.Register( CreateInstance, typeof(ContactView)); + } + public ContactView() : base(typeof(ContactView).Name, CustomViewBehaviour.RequiresKeyboardNavigationSupport) { } + public string MaskURL + { + get { return _maskURL; } + set { _maskURL=value; } + } + + [ScriptableProperty()] public string ImageURL { get @@ -58,15 +77,18 @@ namespace VisualsUsingCustomView // Create and Register Image Visual PropertyMap imageVisual = new PropertyMap(); imageVisual.Add( Visual.Property.Type, new PropertyValue( (int)Visual.Type.Image )) - .Add( ImageVisualProperty.URL, new PropertyValue( _imageURL )); + .Add( ImageVisualProperty.URL, new PropertyValue( _imageURL ) ) + .Add( ImageVisualProperty.AlphaMaskURL, new PropertyValue( _maskURL )); _imageVisual = VisualFactory.Get().CreateVisual( imageVisual ); - RegisterVisual( ImageVisualPropertyIndex, _imageVisual ); + + RegisterVisual( GetPropertyIndex("ImageURL"), _imageVisual ); // Set the depth index for Image visual _imageVisual.DepthIndex = ImageVisualPropertyIndex; } } + [ScriptableProperty()] public string Name { get @@ -86,13 +108,15 @@ namespace VisualsUsingCustomView .Add( TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER")) .Add( TextVisualProperty.VerticalAlignment, new PropertyValue("CENTER")); _textVisual = VisualFactory.Get().CreateVisual( textVisual ); - RegisterVisual( TextVisualPropertyIndex, _textVisual ); + + RegisterVisual( GetPropertyIndex("Name"), _textVisual ); // Set the depth index for Text visual _textVisual.DepthIndex = TextVisualPropertyIndex; } } + [ScriptableProperty()] public Color Color { get @@ -102,19 +126,11 @@ namespace VisualsUsingCustomView set { _color = value; - - // Create and Register Color Visual - PropertyMap colorVisual = new PropertyMap(); - colorVisual.Add( Visual.Property.Type, new PropertyValue( (int)Visual.Type.Color )) - .Add( ColorVisualProperty.MixColor, new PropertyValue( _color )); - _colorVisual = VisualFactory.Get().CreateVisual( colorVisual ); - RegisterVisual( ColorVisualPropertyIndex, _colorVisual ); - - // Set the depth index for Color visual - _colorVisual.DepthIndex = ColorVisualPropertyIndex; + BackgroundColor = value; } } + [ScriptableProperty()] public int Shape { get @@ -134,7 +150,7 @@ namespace VisualsUsingCustomView .Add( PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(new Vector3(1.0f,1.0f,0.3f))) .Add( PrimitiveVisualProperty.MixColor, new PropertyValue(new Vector4((245.0f/255.0f), (188.0f/255.0f), (73.0f/255.0f), 1.0f))); _primitiveVisual = VisualFactory.Get().CreateVisual( primitiveVisual ); - RegisterVisual( PrimitiveVisualPropertyIndex, _primitiveVisual ); + RegisterVisual( GetPropertyIndex("Shape"), _primitiveVisual ); // Set the depth index for Primitive visual _primitiveVisual.DepthIndex = PrimitiveVisualPropertyIndex; @@ -151,7 +167,11 @@ namespace VisualsUsingCustomView { // Change the Color visual of ContactView with some random color Random random = new Random(); - Color = new Color((random.Next(0, 256) / 255.0f), (random.Next(0, 256) / 255.0f), (random.Next(0, 256) / 255.0f), 1.0f); + float nextRed = (random.Next(0, 256) / 255.0f); + float nextGreen = (random.Next(0, 256) / 255.0f); + float nextBlue = (random.Next(0, 256) / 255.0f); + Animation anim = AnimateBackgroundColor( new Color( nextRed, nextGreen, nextBlue, 1.0f), 0, 2000 ); + anim.Play(); } public override void OnRelayout(Vector2 size, RelayoutContainer container) @@ -185,16 +205,6 @@ namespace VisualsUsingCustomView .Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.CenterBegin)) .Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.CenterBegin)); _primitiveVisual.SetTransformAndSize(primitiveVisualTransform, size); - - // Configure the transform and size of Color visual. This is also the default value. - PropertyMap colorVisualTransform = new PropertyMap(); - colorVisualTransform.Add( (int)VisualTransformPropertyType.Offset, new PropertyValue(new Vector2(0.0f,0.0f))) - .Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Relative, (int)VisualTransformPolicyType.Relative))) - .Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Relative, (int)VisualTransformPolicyType.Relative))) - .Add( (int)VisualTransformPropertyType.Size, new PropertyValue(new Vector2(1.0f, 1.0f)) ) - .Add( (int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.TopBegin) ) - .Add( (int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.TopBegin) ); - _colorVisual.SetTransformAndSize(colorVisualTransform, size); } } -} \ No newline at end of file +} diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs index 8998e58..2143e5c 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs @@ -52,9 +52,9 @@ namespace VisualsUsingCustomView contentLayout.Name = "ContentLayout"; //contentLayout.WidthResizePolicy = ResizePolicyType.FillToParent; //contentLayout.HeightResizePolicy = ResizePolicyType.FillToParent; - contentLayout.PivotPoint = PivotPoint.Center; - contentLayout.ParentOrigin = ParentOrigin.Center; - contentLayout.Size = new Vector3(window.Size.Width, window.Size.Height, 0.0f); + contentLayout.PivotPoint = PivotPoint.TopLeft; + contentLayout.ParentOrigin = ParentOrigin.TopLeft; + contentLayout.Size2D = new Vector2(window.Size.Width, window.Size.Height); contentLayout.SetCellPadding(new Size2D(5, 5)); contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f); @@ -79,6 +79,7 @@ namespace VisualsUsingCustomView // Configure visuals of ContactView via properties contactView.Name = contact.Name; + contactView.MaskURL = contact.MaskURL; contactView.ImageURL = contact.ImageURL; contactView.Color = contact.Color; contactView.Shape = contact.Shape; @@ -90,7 +91,7 @@ namespace VisualsUsingCustomView /// The main entry point for the application. /// [STAThread] - static void _Main(string[] args) + static void Main(string[] args) { VisualsExample visualsExample = new VisualsExample(); visualsExample.Run(args); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/res/images/mask.png b/NUISamples/NUISamples/NUISamples.TizenTV/res/images/mask.png new file mode 100644 index 0000000000000000000000000000000000000000..b3e423c96db683493963d56b209acc233a23d13f GIT binary patch literal 4454 zcmV-s5t;6ZP)kld*1&!XUdXDZ1)EeNkF1p zc5O3pqwOeLk|h!cnR#+WnZo~%FaJxgW?sBr{C5XcmY!YsemZu}Qv7+s>(SL))eylOCbEC#QiO=PnC3}hmPBEaf3%kNe#Gdwn8 z2X=q}4$F+i;ZNWT=@L1~W+7RMQbW5#3ffX9+M z1w<_+lgUI9fxt?VN9pJN&1)bdAN9LzFgPrZi5Xb%O!B+}^tgeaj3`s2P{>3Ik&TU& zK<57QV2*)|c438=Mi4VIhJ^*sjK>3${H?w_t4cLv&tfZ)OeB!VtlU{itPfzy&l~$_ z7jEDqhZ7K%6Eiat6INtm^&MtdP8PL_6oQz2Adp$H%-jh$qR3~os~?oeu`HS-9F~ch ziJ228COnRb3Bw}GZ_Kq{qfjtJ5)efuNz6U5iY)GIY~0yM3ZeX{M2-~_H0XW6(e3yeUaki;G$g$++2;+R>nT*bm18&M#9QpNlWvNg(9mI*5` z7Lmom8PAMklI72MRXx{v_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ZRwmCPhT9C0_aoVzw znRR!p=>Bt0H$Nl_bpE2#}u98uWb=Iz6)`n(7=qSb9p5@aI7!G5nQ;_6vv5}GhBA%Lqx6oj#&1CfnCs|l zAamm?ws7N{@YYIXQ-70R$zudkv{08ZY^qYNPHSTj?OvJ?Ny^-P7i5pS z8tG;s*$SmH)m>=!#=F?XT?jZlMb4j)NZUb2(2}a8 z>Ww0Oan#eEq!;dR1ReFCyT*gnDU&R;n^lfUoM9kwW8)?=xO3&sP1J8J(S6~x!d@n* zUVPOd{lCaul%4~gfR{52E#_+7rKzjX(0P$Q*W47!O5#6i-WyjoIiQh;D%cl~UF>0` zk(3iM7rqgJ1z0(e#2K#4GEy*UyBY4+Qfr{0_{ z1)0!#!^u431&5JgC@<~GeUi=(4ZPgB(0cTuMZ9n)6S<1jT)9g~5=0sE%hK#855nxK z)#9%r17n#eaqpRxO(v@xs|J_*;8W3XzMUM2B9WTPLf|IFj*S~p!uAUFsEYYRK=x=j zV@RMyfgq0TB)~S2Mr&faVZg?8Aq`?*Nxgbanr@x_sMpfl(_->f56p7mLD9?@9nIO#0B1e;r8Ql5Aa8FB3xx7a6yihH)7u z7RJylKn{V`d}NcrG?KVVxhZHJ^NTRPcAmYp>YWT+G%$C9jNv(kBV`XMv0ZO}5KB#=$@<<)SvfQa~6fclrC{{{Ik&9|!V0on<>%c4+7u@$6%+ z__{Usg9|c0`F|9crvVH*9J)B_VC64#=KmOw`~&14ARm4GA6_Y8Us$!t0ssI207*qoM6N<$f}ZGOh5!Hn literal 0 HcmV?d00001 diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index 5669090..fe3c65c 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -178,6 +178,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_CreateTransition")] public static extern global::System.IntPtr ViewWrapperImpl_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_CreateTransition")] + public static extern global::System.IntPtr View_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_EmitKeyInputFocusSignal")] public static extern void ViewWrapperImpl_EmitKeyInputFocusSignal(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); diff --git a/src/Tizen.NUI/src/public/AlphaFunction.cs b/src/Tizen.NUI/src/public/AlphaFunction.cs index dde903e..834d163 100755 --- a/src/Tizen.NUI/src/public/AlphaFunction.cs +++ b/src/Tizen.NUI/src/public/AlphaFunction.cs @@ -282,6 +282,86 @@ namespace Tizen.NUI Bezier } + internal static string BuiltinToPropertyKey(BuiltinFunctions? alphaFunction) + { + string propertyKey = null; + if (alphaFunction != null) + { + switch (alphaFunction) + { + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + propertyKey = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + propertyKey = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + propertyKey = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + propertyKey = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + propertyKey = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + propertyKey = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + propertyKey = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + propertyKey = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + propertyKey = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + propertyKey = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + propertyKey = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + propertyKey = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + propertyKey = "EASE_OUT_BACK"; + break; + } + default: + { + propertyKey = "DEFAULT"; + break; + } + } + } + return propertyKey; + } } - } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 3e85455..35e4a64 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -40,7 +40,7 @@ namespace Tizen.NUI.BaseComponents return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //you can override it to clean-up your own resources. + // you can override it to clean-up your own resources. protected override void Dispose(DisposeTypes type) { if(disposed) @@ -753,7 +753,6 @@ namespace Tizen.NUI.BaseComponents internal static readonly int CLIPPING_MODE = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get(); } - /// /// Describes the direction to move the focus towards. /// @@ -1004,6 +1003,68 @@ namespace Tizen.NUI.BaseComponents } /// + /// Create an Animation to animate the background color visual. If there is no + /// background visual, creates one with transparent black as it's mixColor. + /// + public Animation AnimateBackgroundColor( object destinationValue, + int startTime, + int endTime, + AlphaFunction.BuiltinFunctions? alphaFunction = null, + object initialValue = null) + { + Tizen.NUI.PropertyMap background = Background; + + if( background.Empty() ) + { + // If there is no background yet, ensure there is a transparent + // color visual + BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + background = Background; + } + return AnimateColor( "background", destinationValue, startTime, endTime, alphaFunction, initialValue ); + } + + /// + /// Create an Animation to animate the mixColor of the named visual. + /// + public Animation AnimateColor( string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null ) + { + Animation animation = null; + { + PropertyMap _animator = new PropertyMap(); + if( alphaFunction != null ) + { + _animator.Add("alphaFunction", new PropertyValue( AlphaFunction.BuiltinToPropertyKey(alphaFunction) ) ); + } + + PropertyMap _timePeriod = new PropertyMap(); + _timePeriod.Add( "duration", new PropertyValue((endTime-startTime)/1000.0f) ); + _timePeriod.Add( "delay", new PropertyValue( startTime/1000.0f ) ); + _animator.Add( "timePeriod", new PropertyValue( _timePeriod ) ); + + PropertyMap _transition = new PropertyMap(); + _transition.Add( "animator", new PropertyValue( _animator ) ); + _transition.Add( "target", new PropertyValue( targetVisual ) ); + _transition.Add( "property", new PropertyValue( "mixColor" ) ); + + if( initialColor != null ) + { + PropertyValue initValue = PropertyValue.CreateFromObject( initialColor ); + _transition.Add( "initialValue", initValue ); + } + + PropertyValue destValue = PropertyValue.CreateFromObject( destinationColor ); + _transition.Add( "targetValue", destValue ); + TransitionData _transitionData = new TransitionData( _transition ); + + animation = new Animation( NDalicManualPINVOKE.View_CreateTransition(swigCPtr, TransitionData.getCPtr(_transitionData)), true ); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return animation; + } + + /// /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map. /// public string BackgroundImage @@ -1028,15 +1089,12 @@ namespace Tizen.NUI.BaseComponents } } - /// - /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map or string for URL. - /// public Tizen.NUI.PropertyMap Background { get { Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); - GetProperty(View.Property.BACKGROUND).Get(temp); + GetProperty( View.Property.BACKGROUND ).Get(temp); return temp; } set @@ -1045,6 +1103,7 @@ namespace Tizen.NUI.BaseComponents } } + /// /// The current state of the view. /// -- 2.7.4