2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 using System.Collections.Generic;
23 using Tizen.NUI.BaseComponents;
26 /// A class encapsulating the transform map of the visual.
28 public class VisualMap
30 private Vector2 _visualSize = null;
31 private Vector2 _visualOffset = null;
32 private Vector2 _visualOffsetPolicy = null;
33 private Vector2 _visualSizePolicy = null;
34 private Visual.AlignType? _visualOrigin = null;
35 private Visual.AlignType? _visualAnchorPoint = null;
37 private PropertyMap _visualTransformMap = null;
39 private int? _depthIndex = null;
44 /// <since_tizen> 3 </since_tizen>
45 protected PropertyMap _outputVisualMap = null;
53 internal int VisualIndex
59 internal VisualView Parent
73 /// Gets or sets the size of the visual.<br />
74 /// It can be either relative (percentage of the parent)
75 /// or absolute (in world units).<br />
78 /// <since_tizen> 3 </since_tizen>
83 return _visualSize ?? (new Size2D(1, 1));
88 if (_visualSizePolicy == null)
90 _visualSizePolicy = new Vector2(1.0f, 1.0f);
97 /// Gets or sets the offset of the visual.<br />
98 /// It can be either relative (percentage of the parent)
99 /// or absolute (in world units).<br />
102 /// <since_tizen> 3 </since_tizen>
103 public Vector2 Position
107 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
111 _visualOffset = value;
112 if (_visualOffsetPolicy == null)
114 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
121 /// Gets or sets the relative size of the visual<br />
122 /// (percentage [0.0f to 1.0f] of the control).<br />
125 /// <since_tizen> 3 </since_tizen>
126 public RelativeVector2 RelativeSize
130 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
135 _visualSizePolicy = new Vector2(0.0f, 0.0f);
141 /// Gets or sets the relative offset of the visual<br />
142 /// (percentage [0.0f to 1.0f] of the control).<br />
145 /// <since_tizen> 3 </since_tizen>
146 public RelativeVector2 RelativePosition
150 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
154 _visualOffset = value;
155 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
161 /// Gets or sets whether the x and y offset values are relative<br />
162 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
163 /// By default, both the x and the y offset are relative.<br />
166 /// <since_tizen> 3 </since_tizen>
167 public VisualTransformPolicyType PositionPolicy
171 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
172 && _visualOffsetPolicy.Y == 1.0f)
174 return VisualTransformPolicyType.Absolute;
176 return VisualTransformPolicyType.Relative;
182 case VisualTransformPolicyType.Relative:
183 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
185 case VisualTransformPolicyType.Absolute:
186 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
189 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
197 /// Gets or sets whether the x offset values are relative<br />
198 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
199 /// By default, the x offset is relative.<br />
202 /// <since_tizen> 3 </since_tizen>
203 public VisualTransformPolicyType PositionPolicyX
207 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
209 return VisualTransformPolicyType.Absolute;
211 return VisualTransformPolicyType.Relative;
215 if (_visualOffsetPolicy == null)
217 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
222 case VisualTransformPolicyType.Relative:
223 _visualOffsetPolicy.X = 0.0f;
225 case VisualTransformPolicyType.Absolute:
226 _visualOffsetPolicy.X = 1.0f;
229 _visualOffsetPolicy.X = 0.0f;
238 /// Gets or sets whether the y offset values are relative<br />
239 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
240 /// By default, the y offset is relative.<br />
243 /// <since_tizen> 3 </since_tizen>
244 public VisualTransformPolicyType PositionPolicyY
248 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
250 return VisualTransformPolicyType.Absolute;
252 return VisualTransformPolicyType.Relative;
256 if (_visualOffsetPolicy == null)
258 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
263 case VisualTransformPolicyType.Relative:
264 _visualOffsetPolicy.Y = 0.0f;
266 case VisualTransformPolicyType.Absolute:
267 _visualOffsetPolicy.Y = 1.0f;
270 _visualOffsetPolicy.Y = 0.0f;
278 /// Gets or sets whether the size values of the width or the height are relative<br />
279 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
280 /// By default, offsets of both the width and the height are relative to the control's size.<br />
283 /// <since_tizen> 3 </since_tizen>
284 public VisualTransformPolicyType SizePolicy
288 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
289 && _visualSizePolicy.Y == 1.0f)
291 return VisualTransformPolicyType.Absolute;
293 return VisualTransformPolicyType.Relative;
299 case VisualTransformPolicyType.Relative:
300 _visualSizePolicy = new Vector2(0.0f, 0.0f);
302 case VisualTransformPolicyType.Absolute:
303 _visualSizePolicy = new Vector2(1.0f, 1.0f);
306 _visualSizePolicy = new Vector2(0.0f, 0.0f);
314 /// Gets or sets whether size values of the width are relative.<br />
315 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
316 /// By default, the value of the width is relative to the control's width.<br />
319 /// <since_tizen> 3 </since_tizen>
320 public VisualTransformPolicyType SizePolicyWidth
324 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
326 return VisualTransformPolicyType.Absolute;
328 return VisualTransformPolicyType.Relative;
332 if (_visualSizePolicy == null)
334 _visualSizePolicy = new Vector2(0.0f, 0.0f);
339 case VisualTransformPolicyType.Relative:
340 _visualSizePolicy.Width = 0.0f;
342 case VisualTransformPolicyType.Absolute:
343 _visualSizePolicy.Width = 1.0f;
346 _visualSizePolicy.Width = 0.0f;
354 /// Gets or sets whether size values of the height are relative<br />
355 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
356 /// By default, the height value is relative to the control's height.<br />
359 /// <since_tizen> 3 </since_tizen>
360 public VisualTransformPolicyType SizePolicyHeight
364 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
366 return VisualTransformPolicyType.Absolute;
368 return VisualTransformPolicyType.Relative;
372 if (_visualSizePolicy == null)
374 _visualSizePolicy = new Vector2(0.0f, 0.0f);
379 case VisualTransformPolicyType.Relative:
380 _visualSizePolicy.Height = 0.0f;
382 case VisualTransformPolicyType.Absolute:
383 _visualSizePolicy.Height = 1.0f;
386 _visualSizePolicy.Height = 0.0f;
394 /// Gets or sets the origin of the visual within its control area.<br />
395 /// By default, the origin is center.<br />
398 /// <since_tizen> 3 </since_tizen>
399 public Visual.AlignType Origin
403 return _visualOrigin ?? (Visual.AlignType.Center);
407 _visualOrigin = value;
413 /// Gets or sets the anchor point of the visual.<br />
414 /// By default, the anchor point is center.<br />
417 /// <since_tizen> 3 </since_tizen>
418 public Visual.AlignType AnchorPoint
422 return _visualAnchorPoint ?? (Visual.AlignType.Center);
426 _visualAnchorPoint = value;
432 /// Gets or sets the depth index of the visual.<br />
433 /// By default, the depth index is 0.<br />
436 /// <since_tizen> 3 </since_tizen>
437 public int DepthIndex
441 return _depthIndex ?? (0);
449 private void ComposingTransformMap()
451 _visualTransformMap = new PropertyMap();
452 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
453 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
454 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
455 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
456 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
457 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
461 /// Gets the transform map used by the visual.
463 /// <since_tizen> 3 </since_tizen>
464 public PropertyMap OutputTransformMap
468 ComposingTransformMap();
469 return _visualTransformMap;
474 /// Compose the out visual map.
476 /// <since_tizen> 3 </since_tizen>
477 protected virtual void ComposingPropertyMap()
479 _outputVisualMap = new PropertyMap();
483 /// Gets the property map to create the visual.
485 /// <since_tizen> 3 </since_tizen>
486 public PropertyMap OutputVisualMap
490 ComposingPropertyMap();
491 return _outputVisualMap;
495 internal void UpdateVisual()
499 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
500 Parent.UpdateVisual(VisualIndex, Name, this);
504 NUILog.Debug("VisualIndex was not set");
509 /// The shader of the visual.
511 /// <since_tizen> 3 </since_tizen>
512 protected PropertyMap _shader = null;
513 //private PropertyMap _transform = null;
516 /// The premultipliedAlpha of the visual.
518 /// <since_tizen> 3 </since_tizen>
519 protected bool? _premultipliedAlpha = null;
522 /// The mixColor of the Visual.
524 /// <since_tizen> 3 </since_tizen>
525 protected Color _mixColor = null;
528 /// The opacity of the visual.
530 /// <since_tizen> 3 </since_tizen>
531 protected float? _opacity = null;
534 /// The map for visual.
536 /// <since_tizen> 3 </since_tizen>
537 protected PropertyMap _commonlyUsedMap = null;
540 /// The shader to use in the visual.
542 /// <since_tizen> 3 </since_tizen>
543 public PropertyMap Shader
557 /// Enables or disables the premultiplied alpha. <br />
558 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
560 /// <since_tizen> 3 </since_tizen>
561 public bool PremultipliedAlpha
565 return _premultipliedAlpha ?? (false);
569 _premultipliedAlpha = value;
575 /// Mix color is a blend color for any visual.
577 /// <since_tizen> 3 </since_tizen>
578 public Color MixColor
592 /// Opacity is the alpha component of the mix color discussed above.
594 /// <since_tizen> 3 </since_tizen>
599 return _opacity ?? (1.0f);
611 /// A class encapsulating the property map of the image visual.
613 public class ImageVisual : VisualMap
618 /// <since_tizen> 3 </since_tizen>
619 public ImageVisual() : base()
623 private string _url = null;
624 private string _alphaMaskUrl = null;
625 private FittingModeType? _fittingMode = null;
626 private SamplingModeType? _samplingMode = null;
627 private int? _desiredWidth = null;
628 private int? _desiredHeight = null;
629 private bool? _synchronousLoading = false;
630 private bool? _borderOnly = null;
631 private Vector4 _pixelArea = null;
632 private WrapModeType? _wrapModeU = null;
633 private WrapModeType? _wrapModeV = null;
634 private float? _maskContentScale = null;
635 private bool? _cropToMask = null;
638 /// Gets or sets the URL of the image.<br />
641 /// <since_tizen> 3 </since_tizen>
657 /// Gets or sets the URL of the alpha mask.<br />
660 /// <since_tizen> 3 </since_tizen>
661 public string AlphaMaskURL
665 return _alphaMaskUrl;
669 _alphaMaskUrl = value;
675 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
676 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
677 /// For normal quad images only.<br />
680 /// <since_tizen> 3 </since_tizen>
681 public FittingModeType FittingMode
685 return _fittingMode ?? (FittingModeType.ShrinkToFit);
689 _fittingMode = value;
695 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
696 /// If not supplied, the default is SamplingModeType.Box.<br />
697 /// For normal quad images only.<br />
700 /// <since_tizen> 3 </since_tizen>
701 public SamplingModeType SamplingMode
705 return _samplingMode ?? (SamplingModeType.Box);
709 _samplingMode = value;
715 /// Gets or sets the desired image width.<br />
716 /// If not specified, the actual image width is used.<br />
717 /// For normal quad images only.<br />
720 /// <since_tizen> 3 </since_tizen>
721 public int DesiredWidth
725 return _desiredWidth ?? (-1);
729 _desiredWidth = value;
735 /// Gets or sets the desired image height.<br />
736 /// If not specified, the actual image height is used.<br />
737 /// For normal quad images only.<br />
740 /// <since_tizen> 3 </since_tizen>
741 public int DesiredHeight
745 return _desiredHeight ?? (-1);
749 _desiredHeight = value;
755 /// Gets or sets whether to load the image synchronously.<br />
756 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
757 /// For normal quad images only.<br />
760 /// <since_tizen> 3 </since_tizen>
761 public bool SynchronousLoading
765 return _synchronousLoading ?? (false);
769 _synchronousLoading = value;
775 /// Gets or sets whether to draw the borders only (If true).<br />
776 /// If not specified, the default is false.<br />
777 /// For n-patch images only.<br />
780 /// <since_tizen> 3 </since_tizen>
781 public bool BorderOnly
785 return _borderOnly ?? (false);
795 /// Gets or sets the image area to be displayed.<br />
796 /// It is a rectangular area.<br />
797 /// 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 />
798 /// 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 />
799 /// For normal quad images only.<br />
802 /// <since_tizen> 3 </since_tizen>
803 public Vector4 PixelArea
807 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
817 /// Gets or sets the wrap mode for the u coordinate.<br />
818 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
819 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
820 /// For normal quad images only.<br />
823 /// <since_tizen> 3 </since_tizen>
824 public WrapModeType WrapModeU
828 return _wrapModeU ?? (WrapModeType.Default);
838 /// Gets or sets the wrap mode for the v coordinate.<br />
839 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
840 /// 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 />
841 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
842 /// For normal quad images only.
845 /// <since_tizen> 3 </since_tizen>
846 public WrapModeType WrapModeV
850 return _wrapModeV ?? (WrapModeType.Default);
860 /// Gets or sets scale factor to apply to the content image before masking.
862 /// <since_tizen> 4 </since_tizen>
863 public float MaskContentScale
867 return _maskContentScale ?? 1.0f;
871 _maskContentScale = value;
877 /// Whether to crop image to mask or scale mask to fit image.
879 /// <since_tizen> 4 </since_tizen>
880 public bool CropToMask
884 return _cropToMask ?? false;
894 /// Compose the out visual map.
896 /// <since_tizen> 3 </since_tizen>
897 protected override void ComposingPropertyMap()
901 _outputVisualMap = new PropertyMap();
902 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
903 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
904 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
905 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
906 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
907 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
908 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
909 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
910 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
911 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
912 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
913 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
914 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
915 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
916 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
917 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
918 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
919 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
925 /// A class encapsulating the property map of the text visual.
927 public class TextVisual : VisualMap
932 /// <since_tizen> 3 </since_tizen>
933 public TextVisual() : base()
937 private string _text = null;
938 private string _fontFamily = null;
939 private PropertyMap _fontStyle = null;
940 private float? _pointSize = null;
941 private bool? _multiLine = null;
942 private string _horizontalAlignment = null;
943 private string _verticalAlignment = null;
944 private Color _textColor = null;
945 private bool? _enableMarkup = null;
948 /// Gets or sets the text to display in the UTF-8 format.<br />
951 /// <since_tizen> 3 </since_tizen>
966 /// Gets or sets the requested font family to use.<br />
969 /// <since_tizen> 3 </since_tizen>
970 public string FontFamily
984 /// Gets or sets the requested font style to use.<br />
987 /// <since_tizen> 3 </since_tizen>
988 public PropertyMap FontStyle
1002 /// Gets or sets the size of font in points.<br />
1005 /// <since_tizen> 3 </since_tizen>
1006 public float PointSize
1010 return _pointSize ?? (0.0f);
1020 /// Gets or sets the single-line or multi-line layout option.<br />
1021 /// If not specified, the default is false.<br />
1024 /// <since_tizen> 3 </since_tizen>
1025 public bool MultiLine
1029 return _multiLine ?? (false);
1039 /// Gets or sets the line horizontal alignment.<br />
1040 /// If not specified, the default is begin.<br />
1043 /// <since_tizen> 3 </since_tizen>
1044 public HorizontalAlignment HorizontalAlignment
1048 switch (_horizontalAlignment)
1051 return HorizontalAlignment.Begin;
1053 return HorizontalAlignment.Center;
1055 return HorizontalAlignment.End;
1057 return HorizontalAlignment.Begin;
1064 case HorizontalAlignment.Begin:
1066 _horizontalAlignment = "BEGIN";
1069 case HorizontalAlignment.Center:
1071 _horizontalAlignment = "CENTER";
1074 case HorizontalAlignment.End:
1076 _horizontalAlignment = "END";
1081 _horizontalAlignment = "BEGIN";
1090 /// Gets or sets the line vertical alignment.<br />
1091 /// If not specified, the default is top.<br />
1094 /// <since_tizen> 3 </since_tizen>
1095 public VerticalAlignment VerticalAlignment
1099 switch (_verticalAlignment)
1102 return VerticalAlignment.Top;
1104 return VerticalAlignment.Center;
1106 return VerticalAlignment.Bottom;
1108 return VerticalAlignment.Top;
1115 case VerticalAlignment.Top:
1117 _verticalAlignment = "TOP";
1120 case VerticalAlignment.Center:
1122 _verticalAlignment = "CENTER";
1125 case VerticalAlignment.Bottom:
1127 _verticalAlignment = "BOTTOM";
1132 _verticalAlignment = "TOP";
1141 /// Gets or sets the color of the text.<br />
1144 /// <since_tizen> 3 </since_tizen>
1145 public Color TextColor
1159 /// Gets or sets whether the mark-up processing is enabled.<br />
1162 /// <since_tizen> 3 </since_tizen>
1163 public bool EnableMarkup
1167 return _enableMarkup ?? (false);
1171 _enableMarkup = value;
1177 /// Compose the out visual map.
1179 /// <since_tizen> 3 </since_tizen>
1180 protected override void ComposingPropertyMap()
1182 if (_text != null && _pointSize != null)
1184 _outputVisualMap = new PropertyMap();
1185 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1186 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1187 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1188 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1189 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1190 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1191 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1192 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1193 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1194 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1195 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1196 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1197 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1198 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1204 /// A class encapsulating the property map of the border visual.
1206 public class BorderVisual : VisualMap
1211 /// <since_tizen> 3 </since_tizen>
1212 public BorderVisual() : base()
1216 private Color _color = null;
1217 private float? _size = null;
1218 private bool? _antiAliasing = null;
1221 /// Gets or sets the color of the border.<br />
1224 /// <since_tizen> 3 </since_tizen>
1239 /// Gets or sets the width of the border (in pixels).<br />
1242 /// <since_tizen> 3 </since_tizen>
1243 public float BorderSize
1247 return _size ?? (-1.0f);
1257 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1258 /// If not supplied, the default is false.<br />
1261 /// <since_tizen> 3 </since_tizen>
1262 public bool AntiAliasing
1266 return _antiAliasing ?? (false);
1270 _antiAliasing = value;
1276 /// Compose the out visual map.
1278 /// <since_tizen> 3 </since_tizen>
1279 protected override void ComposingPropertyMap()
1281 if (_color != null && _size != null)
1283 _outputVisualMap = new PropertyMap();
1284 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1285 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1286 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1287 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1288 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1289 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1290 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1291 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1297 /// A class encapsulating the property map of the color visual.
1299 public class ColorVisual : VisualMap
1304 /// <since_tizen> 3 </since_tizen>
1305 public ColorVisual() : base()
1309 private Color _mixColorForColorVisual = null;
1312 /// Gets or sets the solid color required.<br />
1315 /// <since_tizen> 3 </since_tizen>
1320 return _mixColorForColorVisual;
1324 _mixColorForColorVisual = value;
1330 /// Compose the out visual map.
1332 /// <since_tizen> 3 </since_tizen>
1333 protected override void ComposingPropertyMap()
1335 if (_mixColorForColorVisual != null)
1337 _outputVisualMap = new PropertyMap();
1338 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1339 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1340 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1341 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1342 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1348 /// A class encapsulating the property map of the gradient visual.
1350 public class GradientVisual : VisualMap
1355 /// <since_tizen> 3 </since_tizen>
1356 public GradientVisual() : base()
1360 private Vector2 _startPosition = null;
1361 private Vector2 _endPosition = null;
1362 private Vector2 _center = null;
1363 private float? _radius = null;
1364 private PropertyArray _stopOffset = null;
1365 private PropertyArray _stopColor = null;
1366 private GradientVisualUnitsType? _units = null;
1367 private GradientVisualSpreadMethodType? _spreadMethod = null;
1370 /// Gets or sets the start position of a linear gradient.<br />
1371 /// Mandatory for linear.<br />
1373 /// <since_tizen> 3 </since_tizen>
1374 public Vector2 StartPosition
1378 return _startPosition;
1382 _startPosition = value;
1388 /// Gets or sets the end position of a linear gradient.<br />
1389 /// Mandatory for linear.<br />
1391 /// <since_tizen> 3 </since_tizen>
1392 public Vector2 EndPosition
1396 return _endPosition;
1400 _endPosition = value;
1406 /// Gets or sets the center point of a radial gradient.<br />
1407 /// Mandatory for radial.<br />
1409 /// <since_tizen> 3 </since_tizen>
1410 public Vector2 Center
1424 /// Gets or sets the size of the radius of a radial gradient.<br />
1425 /// Mandatory for radial.<br />
1427 /// <since_tizen> 3 </since_tizen>
1432 return _radius ?? (-1.0f);
1442 /// Gets or sets all the stop offsets.<br />
1443 /// A PropertyArray of float.<br />
1444 /// If not supplied, the default is 0.0f and 1.0f.<br />
1447 /// <since_tizen> 3 </since_tizen>
1448 public PropertyArray StopOffset
1456 _stopOffset = value;
1462 /// Gets or sets the color at the stop offsets.<br />
1463 /// A PropertyArray of color.<br />
1464 /// At least 2 values are required to show a gradient.<br />
1467 /// <since_tizen> 3 </since_tizen>
1468 public PropertyArray StopColor
1482 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1483 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1486 /// <since_tizen> 3 </since_tizen>
1487 public GradientVisualUnitsType Units
1491 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1501 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1502 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1505 /// <since_tizen> 3 </since_tizen>
1506 public GradientVisualSpreadMethodType SpreadMethod
1510 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1514 _spreadMethod = value;
1520 /// Compose the out visual map.
1522 /// <since_tizen> 3 </since_tizen>
1523 protected override void ComposingPropertyMap()
1525 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1527 _outputVisualMap = new PropertyMap();
1528 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1529 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1530 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1531 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1532 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1533 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1534 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1535 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1536 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1537 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1538 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1539 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1540 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1546 /// A class encapsulating the property map of the mesh visual.
1548 public class MeshVisual : VisualMap
1553 /// <since_tizen> 3 </since_tizen>
1554 public MeshVisual() : base()
1558 private string _objectURL = null;
1559 private string _materialtURL = null;
1560 private string _texturesPath = null;
1561 private MeshVisualShadingModeValue? _shadingMode = null;
1562 private bool? _useMipmapping = null;
1563 private bool? _useSoftNormals = null;
1564 private Vector3 _lightPosition = null;
1567 /// Gets or sets the location of the ".obj" file.<br />
1570 /// <since_tizen> 3 </since_tizen>
1571 public string ObjectURL
1585 /// Gets or sets the location of the ".mtl" file.<br />
1586 /// If not specified, then a textureless object is assumed.<br />
1589 /// <since_tizen> 3 </since_tizen>
1590 public string MaterialtURL
1594 return _materialtURL;
1598 _materialtURL = value;
1604 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1605 /// Mandatory if using material.<br />
1607 /// <since_tizen> 3 </since_tizen>
1608 public string TexturesPath
1612 return _texturesPath;
1616 _texturesPath = value;
1622 /// Gets or sets the type of shading mode that the mesh will use.<br />
1623 /// 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 />
1624 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1627 /// <since_tizen> 3 </since_tizen>
1628 public MeshVisualShadingModeValue ShadingMode
1632 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1636 _shadingMode = value;
1642 /// Gets or sets whether to use mipmaps for textures or not.<br />
1643 /// If not specified, the default is true.<br />
1646 /// <since_tizen> 3 </since_tizen>
1647 public bool UseMipmapping
1651 return _useMipmapping ?? (true);
1655 _useMipmapping = value;
1661 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1662 /// If not specified, the default is true.<br />
1665 /// <since_tizen> 3 </since_tizen>
1666 public bool UseSoftNormals
1670 return _useSoftNormals ?? (true);
1674 _useSoftNormals = value;
1680 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1681 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1682 /// and using all zeroes will place the light at the top-left corner.<br />
1683 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1686 /// <since_tizen> 3 </since_tizen>
1687 public Vector3 LightPosition
1691 return _lightPosition;
1695 _lightPosition = value;
1701 /// Compose the out visual map.
1703 /// <since_tizen> 3 </since_tizen>
1704 protected override void ComposingPropertyMap()
1706 if (_objectURL != null)
1708 _outputVisualMap = new PropertyMap();
1709 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1710 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1711 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1712 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1713 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1714 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1715 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1716 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1717 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1718 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1719 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1725 /// A class encapsulating the property map of the primetive visual.
1727 public class PrimitiveVisual : VisualMap
1732 /// <since_tizen> 3 </since_tizen>
1733 public PrimitiveVisual() : base()
1737 private PrimitiveVisualShapeType? _shape = null;
1738 private Color _mixColorForPrimitiveVisual = null;
1739 private int? _slices = null;
1740 private int? _stacks = null;
1741 private float? _scaleTopRadius = null;
1742 private float? _scaleBottomRadius = null;
1743 private float? _scaleHeight = null;
1744 private float? _scaleRadius = null;
1745 private Vector3 _scaleDimensions = null;
1746 private float? _bevelPercentage = null;
1747 private float? _bevelSmoothness = null;
1748 private Vector3 _lightPosition = null;
1751 /// Gets or sets the specific shape to render.<br />
1752 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
1755 /// <since_tizen> 3 </since_tizen>
1756 public PrimitiveVisualShapeType Shape
1760 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1770 /// Gets or sets the color of the shape.<br />
1771 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
1772 /// Applies to all shapes.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public new Color MixColor
1780 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1784 _mixColorForPrimitiveVisual = value;
1790 /// Gets or sets the number of slices as you go around the shape.<br />
1791 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
1792 /// If not specified, the default is 128.<br />
1793 /// The range is from 1 to 255.<br />
1796 /// <since_tizen> 3 </since_tizen>
1801 return _slices ?? (128);
1811 /// Gets or sets the number of stacks as you go down the shape.<br />
1812 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
1813 /// If not specified, the default is 128.<br />
1814 /// The range is from 1 to 255.<br />
1817 /// <since_tizen> 3 </since_tizen>
1822 return _stacks ?? (128);
1832 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
1833 /// If not specified, the default is 1.0f.<br />
1834 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1835 /// Only values greater than or equal to 0.0f are accepted.<br />
1838 /// <since_tizen> 3 </since_tizen>
1839 public float ScaleTopRadius
1843 return _scaleTopRadius ?? (1.0f);
1847 _scaleTopRadius = value;
1853 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
1854 /// If not specified, the default is 1.5f.<br />
1855 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1856 /// - PrimitiveVisualShapeType.Cone<br />
1857 /// Only values greater than or equal to 0.0f are accepted.<br />
1860 /// <since_tizen> 3 </since_tizen>
1861 public float ScaleBottomRadius
1865 return _scaleBottomRadius ?? (1.5f);
1869 _scaleBottomRadius = value;
1875 /// Gets or sets the scale of the height of a conic.<br />
1876 /// If not specified, the default is 3.0f.<br />
1877 /// Applies to:<br />
1878 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
1879 /// - PrimitiveVisualShapeType.Cone<br />
1880 /// - PrimitiveVisualShapeType.Cylinder<br />
1881 /// Only values greater than or equal to 0.0f are accepted.<br />
1884 /// <since_tizen> 3 </since_tizen>
1885 public float ScaleHeight
1889 return _scaleHeight ?? (3.0f);
1893 _scaleHeight = value;
1899 /// Gets or sets the scale of the radius of a cylinder.<br />
1900 /// If not specified, the default is 1.0f.<br />
1901 /// Applies to:<br />
1902 /// - PrimitiveVisualShapeType.Cylinder<br />
1903 /// Only values greater than or equal to 0.0f are accepted.<br />
1906 /// <since_tizen> 3 </since_tizen>
1907 public float ScaleRadius
1911 return _scaleRadius ?? (1.0f);
1915 _scaleRadius = value;
1921 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
1922 /// If not specified, the default is Vector3.One.<br />
1923 /// Applies to:<br />
1924 /// - PrimitiveVisualShapeType.Cube<br />
1925 /// - PrimitiveVisualShapeType.Octahedron<br />
1926 /// - PrimitiveVisualShapeType.BevelledCube<br />
1927 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
1930 /// <since_tizen> 3 </since_tizen>
1931 public Vector3 ScaleDimensions
1935 return _scaleDimensions ?? (Vector3.One);
1939 _scaleDimensions = value;
1945 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
1946 /// 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 />
1947 /// If not specified, the default is 0.0f (no bevel).<br />
1948 /// Applies to:<br />
1949 /// - PrimitiveVisualShapeType.BevelledCube<br />
1950 /// The range is from 0.0f to 1.0f.<br />
1953 /// <since_tizen> 3 </since_tizen>
1954 public float BevelPercentage
1958 return _bevelPercentage ?? (0.0f);
1962 _bevelPercentage = value;
1968 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
1969 /// If not specified, the default is 0.0f (sharp edges).<br />
1970 /// Applies to:<br />
1971 /// - PrimitiveVisualShapeType.BevelledCube<br />
1972 /// The range is from 0.0f to 1.0f.<br />
1975 /// <since_tizen> 3 </since_tizen>
1976 public float BevelSmoothness
1980 return _bevelSmoothness ?? (0.0f);
1984 _bevelSmoothness = value;
1990 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1991 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1992 /// and using all zeroes will place the light at the top-left corner.<br />
1993 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1994 /// Applies to all shapes.<br />
1997 /// <since_tizen> 3 </since_tizen>
1998 public Vector3 LightPosition
2002 return _lightPosition;
2006 _lightPosition = value;
2012 /// Compose the out visual map.
2014 /// <since_tizen> 3 </since_tizen>
2015 protected override void ComposingPropertyMap()
2017 _outputVisualMap = new PropertyMap(); ;
2018 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2019 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2020 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2021 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2022 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2023 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2024 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2025 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2026 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2027 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2028 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2029 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2030 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2031 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2032 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2033 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2038 /// A class encapsulating the property map of the n-patch image visual.
2040 public class NPatchVisual : VisualMap
2045 /// <since_tizen> 3 </since_tizen>
2046 public NPatchVisual() : base()
2050 private string _url = null;
2051 private bool? _borderOnly = null;
2052 private Rectangle _border = null;
2055 /// Gets or sets the URL of the image.<br />
2058 /// <since_tizen> 3 </since_tizen>
2073 /// Gets or sets whether to draw the borders only (If true).<br />
2074 /// If not specified, the default is false.<br />
2075 /// For n-patch images only.<br />
2078 /// <since_tizen> 3 </since_tizen>
2079 public bool BorderOnly
2083 return _borderOnly ?? false;
2087 _borderOnly = value;
2093 /// The border of the image is in the order: left, right, bottom, top.<br />
2094 /// For n-patch images only.<br />
2097 /// <since_tizen> 3 </since_tizen>
2098 public Rectangle Border
2112 /// Compose the out visual map.
2114 /// <since_tizen> 3 </since_tizen>
2115 protected override void ComposingPropertyMap()
2119 _outputVisualMap = new PropertyMap();
2120 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2121 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2122 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2123 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2124 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2125 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2126 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2127 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2133 /// A class encapsulating the property map of the SVG visual.
2135 public class SVGVisual : VisualMap
2140 /// <since_tizen> 3 </since_tizen>
2141 public SVGVisual() : base()
2145 private string _url = null;
2148 /// The url of the svg resource.
2150 /// <since_tizen> 3 </since_tizen>
2165 /// Compose the out visual map.
2167 /// <since_tizen> 3 </since_tizen>
2168 protected override void ComposingPropertyMap()
2172 _outputVisualMap = new PropertyMap();
2173 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2174 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2175 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2176 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2177 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2178 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2184 /// A class encapsulating the property map of the animated image (AGIF) visual.
2186 public class AnimatedImageVisual : VisualMap
2191 /// <since_tizen> 3 </since_tizen>
2192 public AnimatedImageVisual() : base()
2196 private List<string> _urls = null;
2197 private int? _batchSize = null;
2198 private int? _cacheSize = null;
2199 private float? _frameDelay = null;
2202 /// Gets and Sets the url in the AnimatedImageVisual.
2204 /// <since_tizen> 4 </since_tizen>
2222 _urls = new List<string>();
2234 /// Gets and Sets the url list in the AnimatedImageVisual.
2236 /// <since_tizen> 4 </since_tizen>
2237 public List<string> URLS
2251 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2253 /// <since_tizen> 4 </since_tizen>
2254 public int BatchSize
2258 return _batchSize ?? 1;
2268 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2270 /// <since_tizen> 4 </since_tizen>
2271 public int CacheSize
2275 return _cacheSize ?? 1;
2285 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2287 /// <since_tizen> 4 </since_tizen>
2288 public float FrameDelay
2292 return _frameDelay ?? 0.1f;
2296 _frameDelay = value;
2302 /// Compose the out visual map.
2304 /// <since_tizen> 3 </since_tizen>
2305 protected override void ComposingPropertyMap()
2309 _outputVisualMap = new PropertyMap();
2310 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2311 if( _urls.Count == 1 )
2313 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2317 var urlArray = new PropertyArray();
2318 foreach( var url in _urls)
2320 urlArray.Add(new PropertyValue(url));
2322 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2324 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2325 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2326 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2327 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2328 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2329 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2330 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2336 //temporary fix for TCT
2338 /// A class encapsulating the property map of the transition data.
2340 public class VisualAnimator : VisualMap
2343 /// Create VisualAnimator object.
2345 /// <since_tizen> 3 </since_tizen>
2346 public VisualAnimator() : base()
2350 private string _alphaFunction = null;
2351 private int _startTime = 0;
2352 private int _endTime = 0;
2353 private string _target = null;
2354 private string _propertyIndex = null;
2355 private object _destinationValue = null;
2358 /// Sets and Gets the AlphaFunction of this transition.
2360 /// <since_tizen> 3 </since_tizen>
2361 public AlphaFunction.BuiltinFunctions AlphaFunction
2365 switch (_alphaFunction)
2368 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2370 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2371 case "EASE_IN_SQUARE":
2372 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2373 case "EASE_OUT_SQUARE":
2374 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2376 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2378 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2380 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2381 case "EASE_IN_SINE":
2382 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2383 case "EASE_OUT_SINE":
2384 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2385 case "EASE_IN_OUT_SINE":
2386 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2388 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2390 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2391 case "EASE_OUT_BACK":
2392 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2394 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2401 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2403 _alphaFunction = "LINEAR";
2406 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2408 _alphaFunction = "REVERSE";
2411 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2413 _alphaFunction = "EASE_IN_SQUARE";
2416 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2418 _alphaFunction = "EASE_OUT_SQUARE";
2421 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2423 _alphaFunction = "EASE_IN";
2426 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2428 _alphaFunction = "EASE_OUT";
2431 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2433 _alphaFunction = "EASE_IN_OUT";
2436 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2438 _alphaFunction = "EASE_IN_SINE";
2441 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2443 _alphaFunction = "EASE_OUT_SINE";
2446 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2448 _alphaFunction = "EASE_IN_OUT_SINE";
2451 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2453 _alphaFunction = "BOUNCE";
2456 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2458 _alphaFunction = "SIN";
2461 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2463 _alphaFunction = "EASE_OUT_BACK";
2468 _alphaFunction = "DEFAULT";
2476 /// Sets and Gets the StartTime of this transition.
2478 /// <since_tizen> 3 </since_tizen>
2479 public int StartTime
2492 /// Sets and Gets the EndTime of this transition.
2494 /// <since_tizen> 3 </since_tizen>
2508 /// Sets and Gets the Target of this transition.
2510 /// <since_tizen> 3 </since_tizen>
2511 public string Target
2524 /// Sets and Gets the PropertyIndex of this transition.
2526 /// <since_tizen> 3 </since_tizen>
2527 public string PropertyIndex
2531 return _propertyIndex;
2535 _propertyIndex = value;
2540 /// Sets and Gets the DestinationValue of this transition.
2542 /// <since_tizen> 3 </since_tizen>
2543 public object DestinationValue
2547 return _destinationValue;
2551 _destinationValue = value;
2556 /// Compose the out visual map.
2558 /// <since_tizen> 3 </since_tizen>
2559 protected override void ComposingPropertyMap()
2561 PropertyMap _animator = new PropertyMap();
2562 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2564 PropertyMap _timePeriod = new PropertyMap();
2565 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2566 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2567 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2569 StringBuilder sb = new StringBuilder(_propertyIndex);
2570 sb[0] = (char)(sb[0] | 0x20);
2571 string _str = sb.ToString();
2573 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2575 PropertyMap _transition = new PropertyMap();
2576 _transition.Add("target", new PropertyValue(_target));
2577 _transition.Add("property", new PropertyValue(_str));
2578 _transition.Add("targetValue", val);
2579 _transition.Add("animator", new PropertyValue(_animator));
2581 _outputVisualMap = _transition;
2584 //temporary fix for TCT