From cf9d92125cd2a41d1244f0f637df1e777bbc5ebe Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Wed, 12 Apr 2017 20:11:19 +0900 Subject: [PATCH] add property types include Opacity & CreateFromObject() types added Change-Id: I49aef6969515c8cd80ee538de1ac8eb179a617ac Signed-off-by: dongsug.song --- .../NUISamples.TizenTV/NUISamples.TizenTV.csproj | 1 + .../NUISamples/NUISamples.TizenTV/examples/Main.cs | 1 + .../examples/visual-animation-test.cs | 25 +- .../examples/visual-view-test2.cs | 257 +++++++++++++++++++++ src/Tizen.NUI/src/public/Animation.cs | 20 +- src/Tizen.NUI/src/public/KeyFrames.cs | 8 +- src/Tizen.NUI/src/public/Property.cs | 32 ++- src/Tizen.NUI/src/public/VisualMaps.cs | 135 +++++++++-- 8 files changed, 446 insertions(+), 33 deletions(-) create mode 100755 NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test2.cs diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj index 27e5fc4..113f1ab 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj +++ b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj @@ -71,6 +71,7 @@ + diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs index 242afde..91c14e1 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs @@ -34,6 +34,7 @@ namespace NUISamples.TizenTV.examples //new VisaulAnimationExample.Example().Run(args); //new VisualViewTest.Example().Run(args); //o //new RelativeVectorTest.Example().Run(args); + //new VisualViewTest2.VisualSample().Run(args); } } } diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs index f3e9115..4129e20 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs @@ -89,9 +89,9 @@ namespace VisaulAnimationExample ////////////////////////////////////////////////////////////////////// // Create a conttent view _contentView = new VisualView(); - _contentView.WidthResizePolicy = ResizePolicyType.Fixed; - _contentView.HeightResizePolicy = ResizePolicyType.Fixed; - _contentView.Size2D = new Size2D(250, 250); + _contentView.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent; + _contentView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent; + //_contentView.Size2D = new Size2D(250, 250); _contentView.BackgroundImage = _resPath + "/images/background-blocks.jpg"; ImageVisual _icon = new ImageVisual(); @@ -103,6 +103,8 @@ namespace VisaulAnimationExample _icon.PositionPolicy = new Vector2(1, 1); _icon.Origin = Visual.AlignType.TopBegin; _icon.AnchorPoint = Visual.AlignType.TopBegin; + _icon.MixColor = new Color(0, 1, 0, 0.5f); + _icon.Opacity = 0.5f; _contentView.AddVisual("icon_visual1", _icon); contentLayout.AddChild(_contentView, new TableView.CellPosition(0, 0)); @@ -123,6 +125,23 @@ namespace VisaulAnimationExample contentLayout.AddChild(_shadowButton, new TableView.CellPosition(0, 1)); ////////////////////////////////////////////////////////////////////// + // make NPatch visual test + NPatchVisual npatch1 = new NPatchVisual(); + npatch1.URL = _resPath + "/images/gallery-2.jpg"; + npatch1.Size = new Size2D(400, 400); + npatch1.SizePolicy = new Vector2(1, 1); + npatch1.Position = new Position2D(400, 0); + npatch1.PositionPolicy = new Vector2(1, 1); + npatch1.Origin = Visual.AlignType.TopBegin; + npatch1.AnchorPoint = Visual.AlignType.TopBegin; + npatch1.Border = new Rectangle(100, 100, 100, 100); + npatch1.DepthIndex = 2; + npatch1.MixColor = new Color(1, 0, 0, 1); + npatch1.Opacity = 0.5f; + _contentView.AddVisual("npatchImageVisual1", npatch1); + + + ////////////////////////////////////////////////////////////////////// // make SVG visual test VisualView VisualView1 = new VisualView(); VisualView1.WidthResizePolicy = ResizePolicyType.FillToParent; diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test2.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test2.cs new file mode 100755 index 0000000..04984ba --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test2.cs @@ -0,0 +1,257 @@ +using System; +using Tizen.NUI; + +namespace VisualViewTest2 +{ + public class VisualSample : NUIApplication + { + const int num = 2; + VisualView[] view; + + TextLabel guide; + ImageVisual imageMap; + ImageVisual imageMap2; + + ImageVisual highlightImageMap; + ImageVisual dimImageMap; + + TextVisual textMap1; + TextVisual textMap2; + + int imgIndex; + + readonly string resourcePath = "/home/owner/apps_rw/NUISamples.TizenTV/res/images/"; + + protected override void OnCreate() + { + base.OnCreate(); + + view = new VisualView[2]; + + for (int i = 0; i < num; i++) + { + view[i] = new VisualView(); + view[i].Size = new Size(600, 600, 0); + view[i].BackgroundColor = Color.Blue; + view[i].Position = new Position(400 + i * 800, 600, 0); + view[i].Focusable = true; + view[i].Name = "MyView" + i; + Stage.Instance.GetDefaultLayer().Add(view[i]); + view[i].FocusGained += VisualSample_FocusGained; + view[i].FocusLost += VisualSample_FocusLost; + view[i].KeyEvent += VisualSample_KeyEvent; + } + + view[0].RightFocusableView = view[1]; + view[1].LeftFocusableView = view[0]; + + imageMap = new ImageVisual(); + imageMap.URL = resourcePath + "gallery-" + imgIndex++ + ".jpg"; + imageMap.AnchorPoint = Visual.AlignType.TopBegin; + imageMap.Origin = Visual.AlignType.TopBegin; + imageMap.Position = new Vector2(0, 0); + imageMap.PositionPolicy = new Vector2(1, 1); + imageMap.Size = new Vector2(500, 500); + imageMap.SizePolicy = new Vector2(1, 1); + imageMap.DepthIndex = 0; + view[0].AddVisual("bgVisual", imageMap); + + + highlightImageMap = new ImageVisual(); + highlightImageMap.URL = resourcePath + "star-highlight.png"; + highlightImageMap.AnchorPoint = Visual.AlignType.TopBegin; + highlightImageMap.Origin = Visual.AlignType.TopBegin; + highlightImageMap.Size = new Vector2(40, 40); + highlightImageMap.SizePolicy = new Vector2(1, 1); + highlightImageMap.Position = new Vector2(10, 10); + highlightImageMap.PositionPolicy = new Vector2(1, 1); + highlightImageMap.DepthIndex = 1; + view[0].AddVisual("iconVisual", highlightImageMap); + + + textMap1 = new TextVisual(); + textMap1.Text = "Hello"; + textMap1.AnchorPoint = Visual.AlignType.TopBegin; + textMap1.Origin = Visual.AlignType.TopBegin; + textMap1.PointSize = 20; + textMap1.Position = new Vector2(60, 210); + textMap1.PositionPolicy = new Vector2(1, 1); + textMap1.Size = new Vector2(600, 200); + textMap1.SizePolicy = new Vector2(1, 1); + textMap1.TextColor = Color.Red; + textMap1.DepthIndex = 5; + view[0].AddVisual("textVisual", textMap1); + + + + imageMap2 = new ImageVisual(); + imageMap2.URL = resourcePath + "gallery-" + imgIndex + ".jpg"; + imageMap2.AnchorPoint = Visual.AlignType.TopBegin; + imageMap2.Origin = Visual.AlignType.TopBegin; + imageMap2.Position = new Vector2(0, 0); + imageMap2.PositionPolicy = new Vector2(1, 1); + imageMap2.Size = new Vector2(500, 500); + imageMap2.SizePolicy = new Vector2(1, 1); + imageMap2.DepthIndex = 0; + view[1].AddVisual("bgVisual", imageMap2); + + dimImageMap = new ImageVisual(); + dimImageMap.URL = resourcePath + "star-dim.png"; + dimImageMap.Size = new Vector2(40, 40); + dimImageMap.SizePolicy = new Vector2(1, 1); + dimImageMap.AnchorPoint = Visual.AlignType.TopBegin; + dimImageMap.Origin = Visual.AlignType.TopBegin; + dimImageMap.Position = new Vector2(10, 10); + dimImageMap.PositionPolicy = new Vector2(1, 1); + dimImageMap.DepthIndex = 1; + view[1].AddVisual("iconVisual", dimImageMap); + + textMap2 = new TextVisual(); + textMap2.Text = "I'm"; + textMap2.PointSize = 20; + textMap2.AnchorPoint = Visual.AlignType.TopBegin; + textMap2.Origin = Visual.AlignType.TopBegin; + textMap2.Position = new Vector2(60, 210); + textMap2.PositionPolicy = new Vector2(1, 1); + textMap2.Size = new Vector2(600, 200); + textMap2.SizePolicy = new Vector2(1, 1); + textMap2.TextColor = Color.Black; + textMap2.DepthIndex = 5; + view[1].AddVisual("textVisual", textMap2); + + + guide = new TextLabel(); + guide.AnchorPoint = AnchorPoint.TopLeft; + guide.Size2D = new Size2D(800, 200); + guide.Padding = new Vector4(50, 50, 50, 50); + guide.MultiLine = true; + guide.BackgroundColor = Color.Magenta; + guide.PointSize = 10; + guide.TextColor = Color.Black; + guide.Text = "Left/Right - Move focus\n" + + "Up/Down - Change Text\n" + + "Enter - Change BG image\n"; + Stage.Instance.GetDefaultLayer().Add(guide); + + Stage.Instance.Key += Instance_Key; + FocusManager.Instance.SetCurrentFocusView(view[0]); + Stage.Instance.Touch += Instance_Touch; + } + + + private void Instance_Touch(object sender, Stage.TouchEventArgs e) + { + FocusManager.Instance.SetCurrentFocusView(view[0]); + } + + private bool VisualSample_KeyEvent(object source, View.KeyEventArgs e) + { + Tizen.Log.Debug("NUI", "View_KeyEvent" + e.Key.State.ToString() + ", Pressed-" + e.Key.KeyPressedName); + + if (e.Key.State == Key.StateType.Down) + { + if (source.Equals(view[0])) + { + if (e.Key.KeyPressedName == "Up") + { + textMap1.PointSize = 14; + textMap1.TextColor = Color.Red; + textMap1.Text = "Hello NY!"; + } + else if (e.Key.KeyPressedName == "Down") + { + textMap1.PointSize = 17; + textMap1.TextColor = Color.Blue; + textMap1.Text = "Goodbye NY."; + } + else if (e.Key.KeyPressedName == "Return") + { + imgIndex = (imgIndex + 1) % 6; + imageMap.URL = resourcePath + "gallery-" + imgIndex + ".jpg"; + } + + } + else + { + if (e.Key.KeyPressedName == "Up") + { + textMap2.PointSize = 14; + textMap2.TextColor = Color.Red; + textMap2.Text = "I'm happy!"; + } + + if (e.Key.KeyPressedName == "Down") + { + textMap2.PointSize = 17; + textMap2.TextColor = Color.Blue; + textMap2.Text = "I'm unhappy"; + } + else if (e.Key.KeyPressedName == "Return") + { + imgIndex = (imgIndex + 1) % 6; + imageMap2.URL = resourcePath + "gallery-" + imgIndex + ".jpg"; + } + } + } + return false; + } + + private void Instance_Key(object sender, Stage.KeyEventArgs e) + { + View currentFocusView = FocusManager.Instance.GetCurrentFocusView(); + + Tizen.Log.Debug("NUI", "Stage_KeyEvent" + e.Key.State.ToString() + ", Pressed-" + e.Key.KeyPressedName); + //Tizen.Log.Debug("NUI", " CurrentFocusView : " + currentFocusView.HasBody() + currentFocusView?.Name); + } + + private void VisualSample_FocusLost(object sender, EventArgs e) + { + VisualView view = sender as VisualView; + view.BackgroundColor = Color.Green; + view.Scale = new Vector3(1.0f, 1.0f, 1.0f); + + view.AddVisual("iconVisual", dimImageMap); + + if (view.Name == "MyView1") + { + imageMap2.MixColor = new Color(1, 0, 0, 0.5f); + imageMap2.Opacity = 0.5f; + } + else if (view.Name == "MyView0") + { + imageMap.MixColor = new Color(1, 0, 0, 0.5f); + imageMap.Opacity = 0.5f; + } + + Tizen.Log.Debug("NUI", "FocusLost-" + view.Name); + } + + private void VisualSample_FocusGained(object sender, EventArgs e) + { + VisualView view = sender as VisualView; + view.BackgroundColor = Color.Yellow; + view.Scale = new Vector3(1.2f, 1.2f, 1.0f); + + view.AddVisual("iconVisual", highlightImageMap); + + if (view.Name == "MyView1") + { + imageMap2.MixColor = new Color(1, 1, 1, 1); + imageMap2.Opacity = 1.0f; + } + else if (view.Name == "MyView0") + { + imageMap.MixColor = new Color(1, 1, 1, 1); + imageMap.Opacity = 1.0f; + } + + Tizen.Log.Debug("NUI", "FocusGained-" + view.Name); + } + + static void _Main(string[] args) + { + VisualSample sample = new VisualSample(); + sample.Run(args); + } + } +} \ No newline at end of file diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index 9405668..26e7e5d 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -386,16 +386,15 @@ namespace Tizen.NUI throw new System.Exception("second argument string property is invalid parameter!"); } - //dynamic obj = (object)relativeValue; PropertyValue val = PropertyValue.CreateFromObject(relativeValue); if (alphaFunction != null) { - AnimateBy(_prop, new PropertyValue(val), alphaFunction); + AnimateBy(_prop, val, alphaFunction); } else { - AnimateBy(_prop, new PropertyValue(val)); + AnimateBy(_prop, val); } } @@ -420,18 +419,17 @@ namespace Tizen.NUI throw new System.Exception("second argument string property is invalid parameter!"); } - //dynamic obj = (object)relativeValue; PropertyValue val = PropertyValue.CreateFromObject(relativeValue); if (alphaFunction != null) { Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); - AnimateBy(_prop, new PropertyValue(val), alphaFunction, time); + AnimateBy(_prop, val, alphaFunction, time); } else { Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); - AnimateBy(_prop, new PropertyValue(val), time); + AnimateBy(_prop, val, time); } } @@ -454,16 +452,15 @@ namespace Tizen.NUI throw new System.Exception("second argument string property is invalid parameter!"); } - //dynamic obj = (object)destinationValue; PropertyValue val = PropertyValue.CreateFromObject(destinationValue); if (alphaFunction != null) { - AnimateTo(_prop, new PropertyValue(val), alphaFunction); + AnimateTo(_prop, val, alphaFunction); } else { - AnimateTo(_prop, new PropertyValue(val)); + AnimateTo(_prop, val); } } @@ -489,18 +486,17 @@ namespace Tizen.NUI throw new System.Exception("second argument string property is invalid parameter!"); } - //dynamic obj = (object)destinationValue; PropertyValue val = PropertyValue.CreateFromObject(destinationValue); if (alphaFunction != null) { Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); - AnimateTo(_prop, new PropertyValue(val), alphaFunction, time); + AnimateTo(_prop, val, alphaFunction, time); } else { Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); - AnimateTo(_prop, new PropertyValue(val), time); + AnimateTo(_prop, val, time); } } diff --git a/src/Tizen.NUI/src/public/KeyFrames.cs b/src/Tizen.NUI/src/public/KeyFrames.cs index 7fd8194..f233153 100755 --- a/src/Tizen.NUI/src/public/KeyFrames.cs +++ b/src/Tizen.NUI/src/public/KeyFrames.cs @@ -83,8 +83,8 @@ namespace Tizen.NUI /// A value public void Add(float progress, object value) { - dynamic obj = value; - Add(progress, new PropertyValue(obj)); + PropertyValue val = PropertyValue.CreateFromObject(value); + Add(progress, val); } /// @@ -95,8 +95,8 @@ namespace Tizen.NUI /// The alpha function used to blend to the next keyframe public void Add(float progress, object value, AlphaFunction alpha) { - dynamic obj = value; - Add(progress, new PropertyValue(obj), alpha); + PropertyValue val = PropertyValue.CreateFromObject(value); + Add(progress, val, alpha); } /// diff --git a/src/Tizen.NUI/src/public/Property.cs b/src/Tizen.NUI/src/public/Property.cs index edbc8b1..55b0689 100755 --- a/src/Tizen.NUI/src/public/Property.cs +++ b/src/Tizen.NUI/src/public/Property.cs @@ -1007,19 +1007,49 @@ namespace Tizen.NUI System.Console.WriteLine(" got an Position property value "); value = new PropertyValue((Position)obj); } + else if (type.Equals(typeof(Position2D))) + { + System.Console.WriteLine(" got an Position2D property value "); + value = new PropertyValue((Position2D)obj); + } else if (type.Equals(typeof(Size))) { System.Console.WriteLine(" got an Size property value "); value = new PropertyValue((Size)obj); } + else if (type.Equals(typeof(Size2D))) + { + System.Console.WriteLine(" got an Size2D property value "); + value = new PropertyValue((Size2D)obj); + } else if (type.Equals(typeof(Color))) { System.Console.WriteLine(" got an Color property value "); value = new PropertyValue((Color)obj); } + else if (type.Equals(typeof(Rotation))) + { + System.Console.WriteLine(" got an Rotation property value "); + value = new PropertyValue((Rotation)obj); + } + else if (type.Equals(typeof(RelativeVector2))) + { + System.Console.WriteLine(" got an RelativeVector2 property value "); + value = new PropertyValue((RelativeVector2)obj); + } + else if (type.Equals(typeof(RelativeVector3))) + { + System.Console.WriteLine(" got an RelativeVector3 property value "); + value = new PropertyValue((RelativeVector3)obj); + } + else if (type.Equals(typeof(RelativeVector4))) + { + System.Console.WriteLine(" got an RelativeVector4 property value "); + value = new PropertyValue((RelativeVector4)obj); + } else { - throw new global::System.InvalidOperationException("Unimplemented type for Property Value"); + throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name); } return value; } diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 038ea23..fee1677 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -35,6 +35,7 @@ namespace Tizen.NUI private float _depthIndex = 0.0f; protected PropertyMap _outputVisualMap = null; + internal string Name { set; @@ -229,6 +230,75 @@ namespace Tizen.NUI } } + protected PropertyMap _shader = null; + //private PropertyMap _transform = null; + protected bool? _premultipliedAlpha = null; + protected Color _mixColor = null; + protected float? _opacity = null; + protected PropertyMap _commonlyUsedMap = null; + + /// + /// The shader to use in the visual. + /// + public PropertyMap Shader + { + get + { + return _shader; + } + set + { + _shader = value; + UpdateVisual(); + } + } + /// + /// Enables/disables premultiplied alpha.
+ /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type. + ///
+ public bool PremultipliedAlpha + { + get + { + return _premultipliedAlpha??false; + } + set + { + _premultipliedAlpha = value; + UpdateVisual(); + } + } + /// + /// Mix color is a blend color for any visual. + /// + public Color MixColor + { + get + { + return _mixColor; + } + set + { + _mixColor = value; + UpdateVisual(); + } + } + /// + /// Opacity is the alpha component of the mixColor, above. + /// + public float Opacity + { + get + { + return _opacity??(-1.0f); + } + set + { + _opacity = value; + UpdateVisual(); + } + } + } /// @@ -448,8 +518,11 @@ namespace Tizen.NUI if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); } if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); } if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } - } /// @@ -630,6 +703,10 @@ namespace Tizen.NUI if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); } if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); } if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -702,6 +779,10 @@ namespace Tizen.NUI if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); } if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); } if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -714,20 +795,20 @@ namespace Tizen.NUI { } - private Color _mixColor = null; + private Color _mixColorForColorVisual = null; /// /// Get or set the solid color required. /// - public Color MixColor + public Color Color { get { - return _mixColor; + return _mixColorForColorVisual; } set { - _mixColor = value; + _mixColorForColorVisual = value; UpdateVisual(); } } @@ -736,7 +817,10 @@ namespace Tizen.NUI { _outputVisualMap = new PropertyMap(); _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color)); - if (_mixColor != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColor)); } + if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); } + 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 (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -908,6 +992,10 @@ namespace Tizen.NUI if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); } if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); } if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -1059,6 +1147,11 @@ namespace Tizen.NUI if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); } if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); } if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } } @@ -1072,7 +1165,7 @@ namespace Tizen.NUI } private PrimitiveVisualShapeType? _shape = null; - private Color _mixColor = null; + private Color _mixColorForPrimitiveVisual = null; private int? _slices = null; private int? _stacks = null; private float? _scaleTopRadius = null; @@ -1110,11 +1203,11 @@ namespace Tizen.NUI { get { - return _mixColor; + return _mixColorForPrimitiveVisual; } set { - _mixColor = value; + _mixColorForPrimitiveVisual = value; UpdateVisual(); } } @@ -1326,7 +1419,7 @@ namespace Tizen.NUI _outputVisualMap = new PropertyMap(); ; _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive)); if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); } - if (_mixColor != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColor)); } + if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); } if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); } if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); } if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); } @@ -1337,6 +1430,9 @@ namespace Tizen.NUI if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); } if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); } if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); } + 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 (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -1410,6 +1506,11 @@ namespace Tizen.NUI if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); } if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } } @@ -1704,6 +1805,7 @@ namespace Tizen.NUI public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM; public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA; public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR; + public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1; } /// @@ -1882,6 +1984,10 @@ namespace Tizen.NUI _outputVisualMap = new PropertyMap(); _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG)); if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -1914,6 +2020,10 @@ namespace Tizen.NUI _outputVisualMap = new PropertyMap(); _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage)); if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); } + 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)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } } } @@ -2018,14 +2128,13 @@ namespace Tizen.NUI string _str1 = _propertyIndex.Substring(0, 1); string _str2 = _propertyIndex.Substring(1); string _str = _str1.ToLower() + _str2; - - //dynamic _obj = (object)_destinationValue; + PropertyValue val = PropertyValue.CreateFromObject(_destinationValue); PropertyMap _transition = new PropertyMap(); _transition.Add("target", new PropertyValue(_target)); _transition.Add("property", new PropertyValue(_str)); - _transition.Add("targetValue", new PropertyValue(val)); + _transition.Add("targetValue", val); _transition.Add("animator", new PropertyValue(_animator)); _outputVisualMap = _transition; -- 2.7.4