1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
19 using System.Collections.Generic;
20 using Tizen.NUI.BaseComponents;
23 /// A class encapsulating the transform map of the visual.
25 public class VisualMap
27 private Vector2 _visualSize = null;
28 private Vector2 _visualOffset = null;
29 private Vector2 _visualOffsetPolicy = null;
30 private Vector2 _visualSizePolicy = null;
31 private Visual.AlignType? _visualOrigin = null;
32 private Visual.AlignType? _visualAnchorPoint = null;
34 private PropertyMap _visualTransformMap = null;
36 private int? _depthIndex = null;
37 protected PropertyMap _outputVisualMap = null;
45 internal int VisualIndex
51 internal VisualView Parent
62 /// Gets or sets the size of the visual.<br>
63 /// It can be either relative (percentage of the parent)
64 /// or absolute (in world units).<br>
67 /// <since_tizen> 3 </since_tizen>
72 return _visualSize ?? (new Size2D(1, 1));
77 if (_visualSizePolicy == null)
79 _visualSizePolicy = new Vector2(1.0f, 1.0f);
86 /// Gets or sets the offset of the visual.<br>
87 /// It can be either relative (percentage of the parent)
88 /// or absolute (in world units).<br>
91 /// <since_tizen> 3 </since_tizen>
92 public Vector2 Position
96 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
100 _visualOffset = value;
101 if (_visualOffsetPolicy == null)
103 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
110 /// Gets or sets the relative size of the visual<br>
111 /// (percentage [0.0f to 1.0f] of the control).<br>
114 /// <since_tizen> 3 </since_tizen>
115 public RelativeVector2 RelativeSize
119 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
124 _visualSizePolicy = new Vector2(0.0f, 0.0f);
130 /// Gets or sets the relative offset of the visual<br>
131 /// (percentage [0.0f to 1.0f] of the control).<br>
134 /// <since_tizen> 3 </since_tizen>
135 public RelativeVector2 RelativePosition
139 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
143 _visualOffset = value;
144 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
150 /// Gets or sets whether the x and y offset values are relative<br>
151 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
152 /// By default, both the x and the y offset are relative.<br>
155 /// <since_tizen> 3 </since_tizen>
156 public VisualTransformPolicyType PositionPolicy
160 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
161 && _visualOffsetPolicy.Y == 1.0f)
163 return VisualTransformPolicyType.Absolute;
165 return VisualTransformPolicyType.Relative;
171 case VisualTransformPolicyType.Relative:
172 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
174 case VisualTransformPolicyType.Absolute:
175 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
178 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
186 /// Gets or sets whether the x offset values are relative<br>
187 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
188 /// By default, the x offset is relative.<br>
191 /// <since_tizen> 3 </since_tizen>
192 public VisualTransformPolicyType PositionPolicyX
196 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
198 return VisualTransformPolicyType.Absolute;
200 return VisualTransformPolicyType.Relative;
204 if (_visualOffsetPolicy == null)
206 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
211 case VisualTransformPolicyType.Relative:
212 _visualOffsetPolicy.X = 0.0f;
214 case VisualTransformPolicyType.Absolute:
215 _visualOffsetPolicy.X = 1.0f;
218 _visualOffsetPolicy.X = 0.0f;
227 /// Gets or sets whether the y offset values are relative<br>
228 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
229 /// By default, the y offset is relative.<br>
232 /// <since_tizen> 3 </since_tizen>
233 public VisualTransformPolicyType PositionPolicyY
237 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
239 return VisualTransformPolicyType.Absolute;
241 return VisualTransformPolicyType.Relative;
245 if (_visualOffsetPolicy == null)
247 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
252 case VisualTransformPolicyType.Relative:
253 _visualOffsetPolicy.Y = 0.0f;
255 case VisualTransformPolicyType.Absolute:
256 _visualOffsetPolicy.Y = 1.0f;
259 _visualOffsetPolicy.Y = 0.0f;
267 /// Gets or sets whether the size values of the width or the height are relative<br>
268 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
269 /// By default, offsets of both the width and the height are relative to the control's size.<br>
272 /// <since_tizen> 3 </since_tizen>
273 public VisualTransformPolicyType SizePolicy
277 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
278 && _visualSizePolicy.Y == 1.0f)
280 return VisualTransformPolicyType.Absolute;
282 return VisualTransformPolicyType.Relative;
288 case VisualTransformPolicyType.Relative:
289 _visualSizePolicy = new Vector2(0.0f, 0.0f);
291 case VisualTransformPolicyType.Absolute:
292 _visualSizePolicy = new Vector2(1.0f, 1.0f);
295 _visualSizePolicy = new Vector2(0.0f, 0.0f);
303 /// Gets or sets whether size values of the width are relative.<br>
304 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
305 /// By default, the value of the width is relative to the control's width.<br>
308 /// <since_tizen> 3 </since_tizen>
309 public VisualTransformPolicyType SizePolicyWidth
313 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
315 return VisualTransformPolicyType.Absolute;
317 return VisualTransformPolicyType.Relative;
321 if (_visualSizePolicy == null)
323 _visualSizePolicy = new Vector2(0.0f, 0.0f);
328 case VisualTransformPolicyType.Relative:
329 _visualSizePolicy.Width = 0.0f;
331 case VisualTransformPolicyType.Absolute:
332 _visualSizePolicy.Width = 1.0f;
335 _visualSizePolicy.Width = 0.0f;
343 /// Gets or sets whether size values of the height are relative<br>
344 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br>
345 /// By default, the height value is relative to the control's height.<br>
348 /// <since_tizen> 3 </since_tizen>
349 public VisualTransformPolicyType SizePolicyHeight
353 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
355 return VisualTransformPolicyType.Absolute;
357 return VisualTransformPolicyType.Relative;
361 if (_visualSizePolicy == null)
363 _visualSizePolicy = new Vector2(0.0f, 0.0f);
368 case VisualTransformPolicyType.Relative:
369 _visualSizePolicy.Height = 0.0f;
371 case VisualTransformPolicyType.Absolute:
372 _visualSizePolicy.Height = 1.0f;
375 _visualSizePolicy.Height = 0.0f;
383 /// Gets or sets the origin of the visual within its control area.<br>
384 /// By default, the origin is center.<br>
387 /// <since_tizen> 3 </since_tizen>
388 public Visual.AlignType Origin
392 return _visualOrigin ?? (Visual.AlignType.Center);
396 _visualOrigin = value;
402 /// Gets or sets the anchor point of the visual.<br>
403 /// By default, the anchor point is center.<br>
406 /// <since_tizen> 3 </since_tizen>
407 public Visual.AlignType AnchorPoint
411 return _visualAnchorPoint ?? (Visual.AlignType.Center);
415 _visualAnchorPoint = value;
421 /// Gets or sets the depth index of the visual.<br>
422 /// By default, the depth index is 0.<br>
425 /// <since_tizen> 3 </since_tizen>
426 public int DepthIndex
430 return _depthIndex ?? (0);
438 private void ComposingTransformMap()
440 _visualTransformMap = new PropertyMap();
441 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
442 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
443 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
444 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
445 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
446 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
450 /// Gets the transform map used by the visual.
452 /// <since_tizen> 3 </since_tizen>
453 public PropertyMap OutputTransformMap
457 ComposingTransformMap();
458 return _visualTransformMap;
462 protected virtual void ComposingPropertyMap()
464 _outputVisualMap = new PropertyMap();
468 /// Gets the property map to create the visual.
470 /// <since_tizen> 3 </since_tizen>
471 public PropertyMap OutputVisualMap
475 ComposingPropertyMap();
476 return _outputVisualMap;
480 internal void UpdateVisual()
484 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
485 Parent.UpdateVisual(VisualIndex, Name, this);
489 NUILog.Debug("VisualIndex was not set");
493 protected PropertyMap _shader = null;
494 //private PropertyMap _transform = null;
495 protected bool? _premultipliedAlpha = null;
496 protected Color _mixColor = null;
497 protected float? _opacity = null;
498 protected PropertyMap _commonlyUsedMap = null;
501 /// The shader to use in the visual.
503 /// <since_tizen> 3 </since_tizen>
504 public PropertyMap Shader
518 /// Enables or disables the premultiplied alpha. <br>
519 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
521 /// <since_tizen> 3 </since_tizen>
522 public bool PremultipliedAlpha
526 return _premultipliedAlpha ?? (false);
530 _premultipliedAlpha = value;
536 /// Mix color is a blend color for any visual.
538 /// <since_tizen> 3 </since_tizen>
539 public Color MixColor
553 /// Opacity is the alpha component of the mix color discussed above.
555 /// <since_tizen> 3 </since_tizen>
560 return _opacity ?? (1.0f);
572 /// A class encapsulating the property map of the image visual.
574 public class ImageVisual : VisualMap
576 public ImageVisual() : base()
580 private string _url = null;
581 private string _alphaMaskUrl = null;
582 private FittingModeType? _fittingMode = null;
583 private SamplingModeType? _samplingMode = null;
584 private int? _desiredWidth = null;
585 private int? _desiredHeight = null;
586 private bool? _synchronousLoading = false;
587 private bool? _borderOnly = null;
588 private Vector4 _pixelArea = null;
589 private WrapModeType? _wrapModeU = null;
590 private WrapModeType? _wrapModeV = null;
591 private float? _maskContentScale = null;
592 private bool? _cropToMask = null;
595 /// Gets or sets the URL of the image.<br>
599 /// <since_tizen> 3 </since_tizen>
615 /// Gets or sets the URL of the alpha mask.<br>
618 /// <since_tizen> 3 </since_tizen>
619 public string AlphaMaskURL
623 return _alphaMaskUrl;
627 _alphaMaskUrl = value;
633 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br>
634 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br>
635 /// For normal quad images only.<br>
638 /// <since_tizen> 3 </since_tizen>
639 public FittingModeType FittingMode
643 return _fittingMode ?? (FittingModeType.ShrinkToFit);
647 _fittingMode = value;
653 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br>
654 /// If not supplied, the default is SamplingModeType.Box.<br>
655 /// For normal quad images only.<br>
658 /// <since_tizen> 3 </since_tizen>
659 public SamplingModeType SamplingMode
663 return _samplingMode ?? (SamplingModeType.Box);
667 _samplingMode = value;
673 /// Gets or sets the desired image width.<br>
674 /// If not specified, the actual image width is used.<br>
675 /// For normal quad images only.<br>
678 /// <since_tizen> 3 </since_tizen>
679 public int DesiredWidth
683 return _desiredWidth ?? (-1);
687 _desiredWidth = value;
693 /// Gets or sets the desired image height.<br>
694 /// If not specified, the actual image height is used.<br>
695 /// For normal quad images only.<br>
698 /// <since_tizen> 3 </since_tizen>
699 public int DesiredHeight
703 return _desiredHeight ?? (-1);
707 _desiredHeight = value;
713 /// Gets or sets whether to load the image synchronously.<br>
714 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br>
715 /// For normal quad images only.<br>
718 /// <since_tizen> 3 </since_tizen>
719 public bool SynchronousLoading
723 return _synchronousLoading ?? (false);
727 _synchronousLoading = value;
733 /// Gets or sets whether to draw the borders only (If true).<br>
734 /// If not specified, the default is false.<br>
735 /// For n-patch images only.<br>
738 /// <since_tizen> 3 </since_tizen>
739 public bool BorderOnly
743 return _borderOnly ?? (false);
753 /// Gets or sets the image area to be displayed.<br>
754 /// It is a rectangular area.<br>
755 /// The first two elements indicate the top-left position of the area, and the last two elements are the areas of the width and the height respectively.<br>
756 /// If not specified, the default value is Vector4 (0.0, 0.0, 1.0, 1.0), i.e., the entire area of the image.<br>
757 /// For normal quad images only.<br>
760 /// <since_tizen> 3 </since_tizen>
761 public Vector4 PixelArea
765 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
775 /// Gets or sets the wrap mode for the u coordinate.<br>
776 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br>
777 /// If not specified, the default is WrapModeType.Default(CLAMP).<br>
778 /// For normal quad images only.<br>
781 /// <since_tizen> 3 </since_tizen>
782 public WrapModeType WrapModeU
786 return _wrapModeU ?? (WrapModeType.Default);
796 /// Gets or sets the wrap mode for the v coordinate.<br>
797 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br>
798 /// The first two elements indicate the top-left position of the area, and the last two elements are the areas of the width and the height respectively.<br>
799 /// If not specified, the default is WrapModeType.Default(CLAMP).<br>
800 /// For normal quad images only.
803 /// <since_tizen> 3 </since_tizen>
804 public WrapModeType WrapModeV
808 return _wrapModeV ?? (WrapModeType.Default);
818 /// Gets or sets scale factor to apply to the content image before masking.
820 /// <since_tizen> 4 </since_tizen>
821 public float MaskContentScale
825 return _maskContentScale ?? 1.0f;
829 _maskContentScale = value;
835 /// Whether to crop image to mask or scale mask to fit image.
837 /// <since_tizen> 4 </since_tizen>
838 public bool CropToMask
842 return _cropToMask ?? false;
851 protected override void ComposingPropertyMap()
855 _outputVisualMap = new PropertyMap();
856 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
857 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
858 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
859 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
860 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
861 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
862 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
863 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
864 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
865 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
866 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
867 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
868 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
869 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
870 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
871 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
872 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
873 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
879 /// A class encapsulating the property map of the text visual.
881 public class TextVisual : VisualMap
883 public TextVisual() : base()
887 private string _text = null;
888 private string _fontFamily = null;
889 private PropertyMap _fontStyle = null;
890 private float? _pointSize = null;
891 private bool? _multiLine = null;
892 private string _horizontalAlignment = null;
893 private string _verticalAlignment = null;
894 private Color _textColor = null;
895 private bool? _enableMarkup = null;
898 /// Gets or sets the text to display in the UTF-8 format.<br>
901 /// <since_tizen> 3 </since_tizen>
916 /// Gets or sets the requested font family to use.<br>
919 /// <since_tizen> 3 </since_tizen>
920 public string FontFamily
934 /// Gets or sets the requested font style to use.<br>
937 /// <since_tizen> 3 </since_tizen>
938 public PropertyMap FontStyle
952 /// Gets or sets the size of font in points.<br>
955 /// <since_tizen> 3 </since_tizen>
956 public float PointSize
960 return _pointSize ?? (0.0f);
970 /// Gets or sets the single-line or multi-line layout option.<br>
971 /// If not specified, the default is false.<br>
974 /// <since_tizen> 3 </since_tizen>
975 public bool MultiLine
979 return _multiLine ?? (false);
989 /// Gets or sets the line horizontal alignment.<br>
990 /// If not specified, the default is begin.<br>
993 /// <since_tizen> 3 </since_tizen>
994 public HorizontalAlignment HorizontalAlignment
998 switch (_horizontalAlignment)
1001 return HorizontalAlignment.Begin;
1003 return HorizontalAlignment.Center;
1005 return HorizontalAlignment.End;
1007 return HorizontalAlignment.Begin;
1014 case HorizontalAlignment.Begin:
1016 _horizontalAlignment = "BEGIN";
1019 case HorizontalAlignment.Center:
1021 _horizontalAlignment = "CENTER";
1024 case HorizontalAlignment.End:
1026 _horizontalAlignment = "END";
1031 _horizontalAlignment = "BEGIN";
1040 /// Gets or sets the line vertical alignment.<br>
1041 /// If not specified, the default is top.<br>
1044 /// <since_tizen> 3 </since_tizen>
1045 public VerticalAlignment VerticalAlignment
1049 switch (_verticalAlignment)
1052 return VerticalAlignment.Top;
1054 return VerticalAlignment.Center;
1056 return VerticalAlignment.Bottom;
1058 return VerticalAlignment.Top;
1065 case VerticalAlignment.Top:
1067 _verticalAlignment = "TOP";
1070 case VerticalAlignment.Center:
1072 _verticalAlignment = "CENTER";
1075 case VerticalAlignment.Bottom:
1077 _verticalAlignment = "BOTTOM";
1082 _verticalAlignment = "TOP";
1091 /// Gets or sets the color of the text.<br>
1094 /// <since_tizen> 3 </since_tizen>
1095 public Color TextColor
1109 /// Gets or sets whether the mark-up processing is enabled.<br>
1112 /// <since_tizen> 3 </since_tizen>
1113 public bool EnableMarkup
1117 return _enableMarkup ?? (false);
1121 _enableMarkup = value;
1126 protected override void ComposingPropertyMap()
1128 if (_text != null && _pointSize != null)
1130 _outputVisualMap = new PropertyMap();
1131 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1132 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1133 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1134 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1135 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1136 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1137 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1138 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1139 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1140 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1141 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1142 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1143 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1144 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1150 /// A class encapsulating the property map of the border visual.
1152 public class BorderVisual : VisualMap
1154 public BorderVisual() : base()
1158 private Color _color = null;
1159 private float? _size = null;
1160 private bool? _antiAliasing = null;
1163 /// Gets or sets the color of the border.<br>
1166 /// <since_tizen> 3 </since_tizen>
1181 /// Gets or sets the width of the border (in pixels).<br>
1184 /// <since_tizen> 3 </since_tizen>
1185 public float BorderSize
1189 return _size ?? (-1.0f);
1199 /// Gets or sets whether the anti-aliasing of the border is required.<br>
1200 /// If not supplied, the default is false.<br>
1203 /// <since_tizen> 3 </since_tizen>
1204 public bool AntiAliasing
1208 return _antiAliasing ?? (false);
1212 _antiAliasing = value;
1217 protected override void ComposingPropertyMap()
1219 if (_color != null && _size != null)
1221 _outputVisualMap = new PropertyMap();
1222 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1223 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1224 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1225 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1226 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1227 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1228 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1229 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1235 /// A class encapsulating the property map of the color visual.
1237 public class ColorVisual : VisualMap
1239 public ColorVisual() : base()
1243 private Color _mixColorForColorVisual = null;
1246 /// Gets or sets the solid color required.<br>
1249 /// <since_tizen> 3 </since_tizen>
1254 return _mixColorForColorVisual;
1258 _mixColorForColorVisual = value;
1263 protected override void ComposingPropertyMap()
1265 if (_mixColorForColorVisual != null)
1267 _outputVisualMap = new PropertyMap();
1268 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1269 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1270 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1271 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1272 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1278 /// A class encapsulating the property map of the gradient visual.
1280 public class GradientVisual : VisualMap
1282 public GradientVisual() : base()
1286 private Vector2 _startPosition = null;
1287 private Vector2 _endPosition = null;
1288 private Vector2 _center = null;
1289 private float? _radius = null;
1290 private PropertyArray _stopOffset = null;
1291 private PropertyArray _stopColor = null;
1292 private GradientVisualUnitsType? _units = null;
1293 private GradientVisualSpreadMethodType? _spreadMethod = null;
1296 /// Gets or sets the start position of a linear gradient.<br>
1297 /// Mandatory for linear.<br>
1299 /// <since_tizen> 3 </since_tizen>
1300 public Vector2 StartPosition
1304 return _startPosition;
1308 _startPosition = value;
1314 /// Gets or sets the end position of a linear gradient.<br>
1315 /// Mandatory for linear.<br>
1317 /// <since_tizen> 3 </since_tizen>
1318 public Vector2 EndPosition
1322 return _endPosition;
1326 _endPosition = value;
1332 /// Gets or sets the center point of a radial gradient.<br>
1333 /// Mandatory for radial.<br>
1335 /// <since_tizen> 3 </since_tizen>
1336 public Vector2 Center
1350 /// Gets or sets the size of the radius of a radial gradient.<br>
1351 /// Mandatory for radial.<br>
1353 /// <since_tizen> 3 </since_tizen>
1358 return _radius ?? (-1.0f);
1368 /// Gets or sets all the stop offsets.<br>
1369 /// A PropertyArray of float.<br>
1370 /// If not supplied, the default is 0.0f and 1.0f.<br>
1373 /// <since_tizen> 3 </since_tizen>
1374 public PropertyArray StopOffset
1382 _stopOffset = value;
1388 /// Gets or sets the color at the stop offsets.<br>
1389 /// A PropertyArray of color.<br>
1390 /// At least 2 values are required to show a gradient.<br>
1393 /// <since_tizen> 3 </since_tizen>
1394 public PropertyArray StopColor
1408 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br>
1409 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br>
1412 /// <since_tizen> 3 </since_tizen>
1413 public GradientVisualUnitsType Units
1417 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1427 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1428 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br>
1431 /// <since_tizen> 3 </since_tizen>
1432 public GradientVisualSpreadMethodType SpreadMethod
1436 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1440 _spreadMethod = value;
1445 protected override void ComposingPropertyMap()
1447 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1449 _outputVisualMap = new PropertyMap();
1450 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1451 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1452 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1453 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1454 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1455 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1456 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1457 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1458 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1459 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1460 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1461 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1462 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1468 /// A class encapsulating the property map of the mesh visual.
1470 public class MeshVisual : VisualMap
1472 public MeshVisual() : base()
1476 private string _objectURL = null;
1477 private string _materialtURL = null;
1478 private string _texturesPath = null;
1479 private MeshVisualShadingModeValue? _shadingMode = null;
1480 private bool? _useMipmapping = null;
1481 private bool? _useSoftNormals = null;
1482 private Vector3 _lightPosition = null;
1485 /// Gets or sets the location of the ".obj" file.<br>
1488 /// <since_tizen> 3 </since_tizen>
1489 public string ObjectURL
1503 /// Gets or sets the location of the ".mtl" file.<br>
1504 /// If not specified, then a textureless object is assumed.<br>
1507 /// <since_tizen> 3 </since_tizen>
1508 public string MaterialtURL
1512 return _materialtURL;
1516 _materialtURL = value;
1522 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br>
1523 /// Mandatory if using material.<br>
1525 /// <since_tizen> 3 </since_tizen>
1526 public string TexturesPath
1530 return _texturesPath;
1534 _texturesPath = value;
1540 /// Gets or sets the type of shading mode that the mesh will use.<br>
1541 /// If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.<br>
1542 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br>
1545 /// <since_tizen> 3 </since_tizen>
1546 public MeshVisualShadingModeValue ShadingMode
1550 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1554 _shadingMode = value;
1560 /// Gets or sets whether to use mipmaps for textures or not.<br>
1561 /// If not specified, the default is true.<br>
1564 /// <since_tizen> 3 </since_tizen>
1565 public bool UseMipmapping
1569 return _useMipmapping ?? (true);
1573 _useMipmapping = value;
1579 /// Gets or sets whether to average normals at each point to smooth textures or not.<br>
1580 /// If not specified, the default is true.<br>
1583 /// <since_tizen> 3 </since_tizen>
1584 public bool UseSoftNormals
1588 return _useSoftNormals ?? (true);
1592 _useSoftNormals = value;
1598 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br>
1599 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1600 /// and using all zeroes will place the light at the top-left corner.<br>
1601 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1604 /// <since_tizen> 3 </since_tizen>
1605 public Vector3 LightPosition
1609 return _lightPosition;
1613 _lightPosition = value;
1618 protected override void ComposingPropertyMap()
1620 if (_objectURL != null)
1622 _outputVisualMap = new PropertyMap();
1623 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1624 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1625 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1626 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1627 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1628 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1629 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1630 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1631 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1632 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1633 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1639 /// A class encapsulating the property map of the primetive visual.
1641 public class PrimitiveVisual : VisualMap
1643 public PrimitiveVisual() : base()
1647 private PrimitiveVisualShapeType? _shape = null;
1648 private Color _mixColorForPrimitiveVisual = null;
1649 private int? _slices = null;
1650 private int? _stacks = null;
1651 private float? _scaleTopRadius = null;
1652 private float? _scaleBottomRadius = null;
1653 private float? _scaleHeight = null;
1654 private float? _scaleRadius = null;
1655 private Vector3 _scaleDimensions = null;
1656 private float? _bevelPercentage = null;
1657 private float? _bevelSmoothness = null;
1658 private Vector3 _lightPosition = null;
1661 /// Gets or sets the specific shape to render.<br>
1662 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br>
1665 /// <since_tizen> 3 </since_tizen>
1666 public PrimitiveVisualShapeType Shape
1670 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1680 /// Gets or sets the color of the shape.<br>
1681 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br>
1682 /// Applies to all shapes.<br>
1685 /// <since_tizen> 3 </since_tizen>
1686 public new Color MixColor
1690 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1694 _mixColorForPrimitiveVisual = value;
1700 /// Gets or sets the number of slices as you go around the shape.<br>
1701 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1702 /// If not specified, the default is 128.<br>
1703 /// The range is from 1 to 255.<br>
1706 /// <since_tizen> 3 </since_tizen>
1711 return _slices ?? (128);
1721 /// Gets or sets the number of stacks as you go down the shape.<br>
1722 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1723 /// If not specified, the default is 128.<br>
1724 /// The range is from 1 to 255.<br>
1727 /// <since_tizen> 3 </since_tizen>
1732 return _stacks ?? (128);
1742 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br>
1743 /// If not specified, the default is 1.0f.<br>
1744 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br>
1745 /// Only values greater than or equal to 0.0f are accepted.<br>
1748 /// <since_tizen> 3 </since_tizen>
1749 public float ScaleTopRadius
1753 return _scaleTopRadius ?? (1.0f);
1757 _scaleTopRadius = value;
1763 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br>
1764 /// If not specified, the default is 1.5f.<br>
1765 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br>
1766 /// - PrimitiveVisualShapeType.Cone<br>
1767 /// Only values greater than or equal to 0.0f are accepted.<br>
1770 /// <since_tizen> 3 </since_tizen>
1771 public float ScaleBottomRadius
1775 return _scaleBottomRadius ?? (1.5f);
1779 _scaleBottomRadius = value;
1785 /// Gets or sets the scale of the height of a conic.<br>
1786 /// If not specified, the default is 3.0f.<br>
1788 /// - PrimitiveVisualShapeType.ConicalFrustrum<br>
1789 /// - PrimitiveVisualShapeType.Cone<br>
1790 /// - PrimitiveVisualShapeType.Cylinder<br>
1791 /// Only values greater than or equal to 0.0f are accepted.<br>
1794 /// <since_tizen> 3 </since_tizen>
1795 public float ScaleHeight
1799 return _scaleHeight ?? (3.0f);
1803 _scaleHeight = value;
1809 /// Gets or sets the scale of the radius of a cylinder.<br>
1810 /// If not specified, the default is 1.0f.<br>
1812 /// - PrimitiveVisualShapeType.Cylinder<br>
1813 /// Only values greater than or equal to 0.0f are accepted.<br>
1816 /// <since_tizen> 3 </since_tizen>
1817 public float ScaleRadius
1821 return _scaleRadius ?? (1.0f);
1825 _scaleRadius = value;
1831 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1832 /// If not specified, the default is Vector3.One.<br>
1834 /// - PrimitiveVisualShapeType.Cube<br>
1835 /// - PrimitiveVisualShapeType.Octahedron<br>
1836 /// - PrimitiveVisualShapeType.BevelledCube<br>
1837 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br>
1840 /// <since_tizen> 3 </since_tizen>
1841 public Vector3 ScaleDimensions
1845 return _scaleDimensions ?? (Vector3.One);
1849 _scaleDimensions = value;
1855 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1856 /// Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.<br>
1857 /// If not specified, the default is 0.0f (no bevel).<br>
1859 /// - PrimitiveVisualShapeType.BevelledCube<br>
1860 /// The range is from 0.0f to 1.0f.<br>
1863 /// <since_tizen> 3 </since_tizen>
1864 public float BevelPercentage
1868 return _bevelPercentage ?? (0.0f);
1872 _bevelPercentage = value;
1878 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br>
1879 /// If not specified, the default is 0.0f (sharp edges).<br>
1881 /// - PrimitiveVisualShapeType.BevelledCube<br>
1882 /// The range is from 0.0f to 1.0f.<br>
1885 /// <since_tizen> 3 </since_tizen>
1886 public float BevelSmoothness
1890 return _bevelSmoothness ?? (0.0f);
1894 _bevelSmoothness = value;
1900 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br>
1901 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1902 /// and using all zeroes will place the light at the top-left corner.<br>
1903 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1904 /// Applies to all shapes.<br>
1907 /// <since_tizen> 3 </since_tizen>
1908 public Vector3 LightPosition
1912 return _lightPosition;
1916 _lightPosition = value;
1921 protected override void ComposingPropertyMap()
1923 _outputVisualMap = new PropertyMap(); ;
1924 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1925 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1926 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1927 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1928 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1929 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1930 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1931 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1932 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1933 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1934 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1935 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1936 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1937 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1938 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1939 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1944 /// A class encapsulating the property map of the n-patch image visual.
1946 public class NPatchVisual : VisualMap
1948 public NPatchVisual() : base()
1952 private string _url = null;
1953 private bool? _borderOnly = null;
1954 private Rectangle _border = null;
1957 /// Gets or sets the URL of the image.<br>
1960 /// <since_tizen> 3 </since_tizen>
1975 /// Gets or sets whether to draw the borders only (If true).<br>
1976 /// If not specified, the default is false.<br>
1977 /// For n-patch images only.<br>
1980 /// <since_tizen> 3 </since_tizen>
1981 public bool BorderOnly
1985 return _borderOnly ?? false;
1989 _borderOnly = value;
1995 /// The border of the image is in the order: left, right, bottom, top.<br>
1996 /// For n-patch images only.<br>
1999 /// <since_tizen> 3 </since_tizen>
2000 public Rectangle Border
2013 protected override void ComposingPropertyMap()
2017 _outputVisualMap = new PropertyMap();
2018 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2019 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2020 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2021 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2022 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2023 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2024 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2025 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2031 /// A class encapsulating the property map of the SVG visual.
2033 public class SVGVisual : VisualMap
2035 public SVGVisual() : base()
2039 private string _url = null;
2054 protected override void ComposingPropertyMap()
2058 _outputVisualMap = new PropertyMap();
2059 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2060 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2061 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2062 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2063 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2064 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2070 /// A class encapsulating the property map of the animated image (AGIF) visual.
2072 public class AnimatedImageVisual : VisualMap
2074 public AnimatedImageVisual() : base()
2078 private List<string> _urls = null;
2079 private int? _batchSize = null;
2080 private int? _cacheSize = null;
2081 private float? _frameDelay = null;
2084 /// Gets and Sets the url in the AnimatedImageVisual.
2086 /// <since_tizen> 4 </since_tizen>
2104 _urls = new List<string>();
2116 /// Gets and Sets the url list in the AnimatedImageVisual.
2118 /// <since_tizen> 4 </since_tizen>
2119 public List<string> URLS
2133 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2135 /// <since_tizen> 4 </since_tizen>
2136 public int BatchSize
2140 return _batchSize ?? 1;
2150 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2152 /// <since_tizen> 4 </since_tizen>
2153 public int CacheSize
2157 return _cacheSize ?? 1;
2167 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2169 /// <since_tizen> 4 </since_tizen>
2170 public float FrameDelay
2174 return _frameDelay ?? 0.1f;
2178 _frameDelay = value;
2183 protected override void ComposingPropertyMap()
2187 _outputVisualMap = new PropertyMap();
2188 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2189 if( _urls.Count == 1 )
2191 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2195 var urlArray = new PropertyArray();
2196 foreach( var url in _urls)
2198 urlArray.Add(new PropertyValue(url));
2200 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2202 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2203 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2204 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2205 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2206 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2207 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2208 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2214 //temporary fix for TCT
2216 /// A class encapsulating the property map of the transition data.
2218 public class VisualAnimator : VisualMap
2221 /// Create VisualAnimator object.
2223 /// <since_tizen> 3 </since_tizen>
2224 public VisualAnimator() : base()
2228 private string _alphaFunction = null;
2229 private int _startTime = 0;
2230 private int _endTime = 0;
2231 private string _target = null;
2232 private string _propertyIndex = null;
2233 private object _destinationValue = null;
2236 /// Sets and Gets the AlphaFunction of this transition.
2238 /// <since_tizen> 3 </since_tizen>
2239 public AlphaFunction.BuiltinFunctions AlphaFunction
2243 switch (_alphaFunction)
2246 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2248 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2249 case "EASE_IN_SQUARE":
2250 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2251 case "EASE_OUT_SQUARE":
2252 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2254 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2256 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2258 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2259 case "EASE_IN_SINE":
2260 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2261 case "EASE_OUT_SINE":
2262 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2263 case "EASE_IN_OUT_SINE":
2264 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2266 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2268 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2269 case "EASE_OUT_BACK":
2270 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2272 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2279 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2281 _alphaFunction = "LINEAR";
2284 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2286 _alphaFunction = "REVERSE";
2289 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2291 _alphaFunction = "EASE_IN_SQUARE";
2294 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2296 _alphaFunction = "EASE_OUT_SQUARE";
2299 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2301 _alphaFunction = "EASE_IN";
2304 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2306 _alphaFunction = "EASE_OUT";
2309 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2311 _alphaFunction = "EASE_IN_OUT";
2314 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2316 _alphaFunction = "EASE_IN_SINE";
2319 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2321 _alphaFunction = "EASE_OUT_SINE";
2324 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2326 _alphaFunction = "EASE_IN_OUT_SINE";
2329 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2331 _alphaFunction = "BOUNCE";
2334 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2336 _alphaFunction = "SIN";
2339 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2341 _alphaFunction = "EASE_OUT_BACK";
2346 _alphaFunction = "DEFAULT";
2354 /// Sets and Gets the StartTime of this transition.
2356 /// <since_tizen> 3 </since_tizen>
2357 public int StartTime
2370 /// Sets and Gets the EndTime of this transition.
2372 /// <since_tizen> 3 </since_tizen>
2386 /// Sets and Gets the Target of this transition.
2388 /// <since_tizen> 3 </since_tizen>
2389 public string Target
2402 /// Sets and Gets the PropertyIndex of this transition.
2404 /// <since_tizen> 3 </since_tizen>
2405 public string PropertyIndex
2409 return _propertyIndex;
2413 _propertyIndex = value;
2418 /// Sets and Gets the DestinationValue of this transition.
2420 /// <since_tizen> 3 </since_tizen>
2421 public object DestinationValue
2425 return _destinationValue;
2429 _destinationValue = value;
2433 protected override void ComposingPropertyMap()
2435 PropertyMap _animator = new PropertyMap();
2436 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2438 PropertyMap _timePeriod = new PropertyMap();
2439 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2440 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2441 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2443 StringBuilder sb = new StringBuilder(_propertyIndex);
2444 sb[0] = (char)(sb[0] | 0x20);
2445 string _str = sb.ToString();
2447 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2449 PropertyMap _transition = new PropertyMap();
2450 _transition.Add("target", new PropertyValue(_target));
2451 _transition.Add("property", new PropertyValue(_str));
2452 _transition.Add("targetValue", val);
2453 _transition.Add("animator", new PropertyValue(_animator));
2455 _outputVisualMap = _transition;
2458 //temporary fix for TCT