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.
18 using System.Collections.Generic;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
25 /// A class encapsulating the transform map of the visual.
27 /// <since_tizen> 3 </since_tizen>
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
68 /// <since_tizen> 3 </since_tizen>
74 /// Gets or sets the size of the visual.<br />
75 /// It can be either relative (percentage of the parent)
76 /// or absolute (in world units).<br />
79 /// <since_tizen> 3 </since_tizen>
84 return _visualSize ?? (new Size2D(1, 1));
89 if (_visualSizePolicy == null)
91 _visualSizePolicy = new Vector2(1.0f, 1.0f);
98 /// Gets or sets the offset of the visual.<br />
99 /// It can be either relative (percentage of the parent)
100 /// or absolute (in world units).<br />
103 /// <since_tizen> 3 </since_tizen>
104 public Vector2 Position
108 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
112 _visualOffset = value;
113 if (_visualOffsetPolicy == null)
115 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
122 /// Gets or sets the relative size of the visual<br />
123 /// (percentage [0.0f to 1.0f] of the control).<br />
126 /// <since_tizen> 3 </since_tizen>
127 public RelativeVector2 RelativeSize
131 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
136 _visualSizePolicy = new Vector2(0.0f, 0.0f);
142 /// Gets or sets the relative offset of the visual<br />
143 /// (percentage [0.0f to 1.0f] of the control).<br />
146 /// <since_tizen> 3 </since_tizen>
147 public RelativeVector2 RelativePosition
151 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
155 _visualOffset = value;
156 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
162 /// Gets or sets whether the x and y offset values are relative<br />
163 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
164 /// By default, both the x and the y offset are relative.<br />
167 /// <since_tizen> 3 </since_tizen>
168 public VisualTransformPolicyType PositionPolicy
172 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
173 && _visualOffsetPolicy.Y == 1.0f)
175 return VisualTransformPolicyType.Absolute;
177 return VisualTransformPolicyType.Relative;
183 case VisualTransformPolicyType.Relative:
184 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
186 case VisualTransformPolicyType.Absolute:
187 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
190 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
198 /// Gets or sets whether the x offset values are relative<br />
199 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
200 /// By default, the x offset is relative.<br />
203 /// <since_tizen> 3 </since_tizen>
204 public VisualTransformPolicyType PositionPolicyX
208 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
210 return VisualTransformPolicyType.Absolute;
212 return VisualTransformPolicyType.Relative;
216 if (_visualOffsetPolicy == null)
218 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
223 case VisualTransformPolicyType.Relative:
224 _visualOffsetPolicy.X = 0.0f;
226 case VisualTransformPolicyType.Absolute:
227 _visualOffsetPolicy.X = 1.0f;
230 _visualOffsetPolicy.X = 0.0f;
239 /// Gets or sets whether the y offset values are relative<br />
240 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
241 /// By default, the y offset is relative.<br />
244 /// <since_tizen> 3 </since_tizen>
245 public VisualTransformPolicyType PositionPolicyY
249 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
251 return VisualTransformPolicyType.Absolute;
253 return VisualTransformPolicyType.Relative;
257 if (_visualOffsetPolicy == null)
259 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
264 case VisualTransformPolicyType.Relative:
265 _visualOffsetPolicy.Y = 0.0f;
267 case VisualTransformPolicyType.Absolute:
268 _visualOffsetPolicy.Y = 1.0f;
271 _visualOffsetPolicy.Y = 0.0f;
279 /// Gets or sets whether the size values of the width or the height are relative<br />
280 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
281 /// By default, offsets of both the width and the height are relative to the control's size.<br />
284 /// <since_tizen> 3 </since_tizen>
285 public VisualTransformPolicyType SizePolicy
289 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
290 && _visualSizePolicy.Y == 1.0f)
292 return VisualTransformPolicyType.Absolute;
294 return VisualTransformPolicyType.Relative;
300 case VisualTransformPolicyType.Relative:
301 _visualSizePolicy = new Vector2(0.0f, 0.0f);
303 case VisualTransformPolicyType.Absolute:
304 _visualSizePolicy = new Vector2(1.0f, 1.0f);
307 _visualSizePolicy = new Vector2(0.0f, 0.0f);
315 /// Gets or sets whether size values of the width are relative.<br />
316 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
317 /// By default, the value of the width is relative to the control's width.<br />
320 /// <since_tizen> 3 </since_tizen>
321 public VisualTransformPolicyType SizePolicyWidth
325 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
327 return VisualTransformPolicyType.Absolute;
329 return VisualTransformPolicyType.Relative;
333 if (_visualSizePolicy == null)
335 _visualSizePolicy = new Vector2(0.0f, 0.0f);
340 case VisualTransformPolicyType.Relative:
341 _visualSizePolicy.Width = 0.0f;
343 case VisualTransformPolicyType.Absolute:
344 _visualSizePolicy.Width = 1.0f;
347 _visualSizePolicy.Width = 0.0f;
355 /// Gets or sets whether size values of the height are relative<br />
356 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
357 /// By default, the height value is relative to the control's height.<br />
360 /// <since_tizen> 3 </since_tizen>
361 public VisualTransformPolicyType SizePolicyHeight
365 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
367 return VisualTransformPolicyType.Absolute;
369 return VisualTransformPolicyType.Relative;
373 if (_visualSizePolicy == null)
375 _visualSizePolicy = new Vector2(0.0f, 0.0f);
380 case VisualTransformPolicyType.Relative:
381 _visualSizePolicy.Height = 0.0f;
383 case VisualTransformPolicyType.Absolute:
384 _visualSizePolicy.Height = 1.0f;
387 _visualSizePolicy.Height = 0.0f;
395 /// Gets or sets the origin of the visual within its control area.<br />
396 /// By default, the origin is center.<br />
399 /// <since_tizen> 3 </since_tizen>
400 public Visual.AlignType Origin
404 return _visualOrigin ?? (Visual.AlignType.Center);
408 _visualOrigin = value;
414 /// Gets or sets the anchor point of the visual.<br />
415 /// By default, the anchor point is center.<br />
418 /// <since_tizen> 3 </since_tizen>
419 public Visual.AlignType AnchorPoint
423 return _visualAnchorPoint ?? (Visual.AlignType.Center);
427 _visualAnchorPoint = value;
433 /// Gets or sets the depth index of the visual.<br />
434 /// By default, the depth index is 0.<br />
437 /// <since_tizen> 3 </since_tizen>
438 public int DepthIndex
442 return _depthIndex ?? (0);
450 private void ComposingTransformMap()
452 _visualTransformMap = new PropertyMap();
453 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
454 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
455 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
456 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
457 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
458 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
462 /// Gets the transform map used by the visual.
464 /// <since_tizen> 3 </since_tizen>
465 public PropertyMap OutputTransformMap
469 ComposingTransformMap();
470 return _visualTransformMap;
475 /// Compose the out visual map.
477 /// <since_tizen> 3 </since_tizen>
478 protected virtual void ComposingPropertyMap()
480 _outputVisualMap = new PropertyMap();
484 /// Gets the property map to create the visual.
486 /// <since_tizen> 3 </since_tizen>
487 public PropertyMap OutputVisualMap
491 ComposingPropertyMap();
492 return _outputVisualMap;
496 internal void UpdateVisual()
500 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
501 Parent.UpdateVisual(VisualIndex, Name, this);
505 NUILog.Debug("VisualIndex was not set");
510 /// The shader of the visual.
512 /// <since_tizen> 3 </since_tizen>
513 protected PropertyMap _shader = null;
514 //private PropertyMap _transform = null;
517 /// The premultipliedAlpha of the visual.
519 /// <since_tizen> 3 </since_tizen>
520 protected bool? _premultipliedAlpha = null;
523 /// The mixColor of the Visual.
525 /// <since_tizen> 3 </since_tizen>
526 protected Color _mixColor = null;
529 /// The opacity of the visual.
531 /// <since_tizen> 3 </since_tizen>
532 protected float? _opacity = null;
535 /// The map for visual.
537 /// <since_tizen> 3 </since_tizen>
538 protected PropertyMap _commonlyUsedMap = null;
541 /// The shader to use in the visual.
543 /// <since_tizen> 3 </since_tizen>
544 public PropertyMap Shader
558 /// Enables or disables the premultiplied alpha. <br />
559 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
561 /// <since_tizen> 3 </since_tizen>
562 public bool PremultipliedAlpha
566 return _premultipliedAlpha ?? (false);
570 _premultipliedAlpha = value;
576 /// Mix color is a blend color for any visual.
578 /// <since_tizen> 3 </since_tizen>
579 public Color MixColor
593 /// Opacity is the alpha component of the mix color discussed above.
595 /// <since_tizen> 3 </since_tizen>
600 return _opacity ?? (1.0f);
612 /// A class encapsulating the property map of the image visual.
614 /// <since_tizen> 3 </since_tizen>
615 public class ImageVisual : VisualMap
620 /// <since_tizen> 3 </since_tizen>
621 public ImageVisual() : base()
625 private string _url = null;
626 private string _alphaMaskUrl = null;
627 private FittingModeType? _fittingMode = null;
628 private SamplingModeType? _samplingMode = null;
629 private int? _desiredWidth = null;
630 private int? _desiredHeight = null;
631 private bool? _synchronousLoading = false;
632 private bool? _borderOnly = null;
633 private Vector4 _pixelArea = null;
634 private WrapModeType? _wrapModeU = null;
635 private WrapModeType? _wrapModeV = null;
636 private float? _maskContentScale = null;
637 private bool? _cropToMask = null;
638 private ReleasePolicyType? _releasePolicy = null;
639 private LoadPolicyType? _loadPolicy = null;
640 private bool? _orientationCorrection = true;
643 /// Gets or sets the URL of the image.<br />
646 /// <since_tizen> 3 </since_tizen>
662 /// Gets or sets the URL of the alpha mask.<br />
665 /// <since_tizen> 3 </since_tizen>
666 public string AlphaMaskURL
670 return _alphaMaskUrl;
674 _alphaMaskUrl = value;
680 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
681 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
682 /// For normal quad images only.<br />
685 /// <since_tizen> 3 </since_tizen>
686 public FittingModeType FittingMode
690 return _fittingMode ?? (FittingModeType.ShrinkToFit);
694 _fittingMode = value;
700 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
701 /// If not supplied, the default is SamplingModeType.Box.<br />
702 /// For normal quad images only.<br />
705 /// <since_tizen> 3 </since_tizen>
706 public SamplingModeType SamplingMode
710 return _samplingMode ?? (SamplingModeType.Box);
714 _samplingMode = value;
720 /// Gets or sets the desired image width.<br />
721 /// If not specified, the actual image width is used.<br />
722 /// For normal quad images only.<br />
725 /// <since_tizen> 3 </since_tizen>
726 public int DesiredWidth
730 return _desiredWidth ?? (-1);
734 _desiredWidth = value;
740 /// Gets or sets the desired image height.<br />
741 /// If not specified, the actual image height is used.<br />
742 /// For normal quad images only.<br />
745 /// <since_tizen> 3 </since_tizen>
746 public int DesiredHeight
750 return _desiredHeight ?? (-1);
754 _desiredHeight = value;
760 /// Gets or sets whether to load the image synchronously.<br />
761 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
762 /// For normal quad images only.<br />
765 /// <since_tizen> 3 </since_tizen>
766 public bool SynchronousLoading
770 return _synchronousLoading ?? (false);
774 _synchronousLoading = value;
780 /// Gets or sets whether to draw the borders only (If true).<br />
781 /// If not specified, the default is false.<br />
782 /// For n-patch images only.<br />
785 /// <since_tizen> 3 </since_tizen>
786 public bool BorderOnly
790 return _borderOnly ?? (false);
800 /// Gets or sets the image area to be displayed.<br />
801 /// It is a rectangular area.<br />
802 /// 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 />
803 /// 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 />
804 /// For normal quad images only.<br />
807 /// <since_tizen> 3 </since_tizen>
808 public Vector4 PixelArea
812 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
822 /// Gets or sets the wrap mode for the u coordinate.<br />
823 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
824 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
825 /// For normal quad images only.<br />
828 /// <since_tizen> 3 </since_tizen>
829 public WrapModeType WrapModeU
833 return _wrapModeU ?? (WrapModeType.Default);
843 /// Gets or sets the wrap mode for the v coordinate.<br />
844 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
845 /// 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 />
846 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
847 /// For normal quad images only.
850 /// <since_tizen> 3 </since_tizen>
851 public WrapModeType WrapModeV
855 return _wrapModeV ?? (WrapModeType.Default);
865 /// Gets or sets scale factor to apply to the content image before masking.
867 /// <since_tizen> 4 </since_tizen>
868 public float MaskContentScale
872 return _maskContentScale ?? 1.0f;
876 _maskContentScale = value;
882 /// Whether to crop image to mask or scale mask to fit image.
884 /// <since_tizen> 4 </since_tizen>
885 public bool CropToMask
889 return _cropToMask ?? false;
900 /// Get or set the Image Visual release policy<br />
901 /// It decides if a texture should be released from the cache or kept to reduce loading time <br />
903 /// <since_tizen> 5 </since_tizen>
904 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
905 [EditorBrowsable(EditorBrowsableState.Never)]
906 public ReleasePolicyType ReleasePolicy
910 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
914 _releasePolicy = value;
921 /// Get or set the Image Visual image loading policy<br />
922 /// It decides if a texture should be loaded immediately after source set or only after visual is added to window <br />
924 /// <since_tizen> 5 </since_tizen>
925 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
926 [EditorBrowsable(EditorBrowsableState.Never)]
927 public LoadPolicyType LoadPolicy
931 return _loadPolicy ?? (LoadPolicyType.Attached);
941 /// Get or set whether to automatically correct the orientation based on exif data.<br />
942 /// If not specified, the default is true.<br />
943 /// For JPEG images only.<br />
946 /// <since_tizen> 5 </since_tizen>
947 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
948 [EditorBrowsable(EditorBrowsableState.Never)]
949 public bool OrientationCorrection
953 return _orientationCorrection ?? (true);
957 _orientationCorrection = value;
964 /// Compose the out visual map.
966 /// <since_tizen> 3 </since_tizen>
967 protected override void ComposingPropertyMap()
971 _outputVisualMap = new PropertyMap();
972 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
973 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
974 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
975 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
976 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
977 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
978 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
979 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
980 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
981 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
982 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
983 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
984 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
985 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
986 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
987 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
988 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
989 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
990 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
991 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
992 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
998 /// A class encapsulating the property map of the text visual.
1000 /// <since_tizen> 3 </since_tizen>
1001 public class TextVisual : VisualMap
1006 /// <since_tizen> 3 </since_tizen>
1007 public TextVisual() : base()
1011 private string _text = null;
1012 private string _fontFamily = null;
1013 private PropertyMap _fontStyle = null;
1014 private float? _pointSize = null;
1015 private bool? _multiLine = null;
1016 private string _horizontalAlignment = null;
1017 private string _verticalAlignment = null;
1018 private Color _textColor = null;
1019 private bool? _enableMarkup = null;
1022 /// Gets or sets the text to display in the UTF-8 format.<br />
1025 /// <since_tizen> 3 </since_tizen>
1040 /// Gets or sets the requested font family to use.<br />
1043 /// <since_tizen> 3 </since_tizen>
1044 public string FontFamily
1052 _fontFamily = value;
1058 /// Gets or sets the requested font style to use.<br />
1061 /// <since_tizen> 3 </since_tizen>
1062 public PropertyMap FontStyle
1076 /// Gets or sets the size of font in points.<br />
1079 /// <since_tizen> 3 </since_tizen>
1080 public float PointSize
1084 return _pointSize ?? (0.0f);
1094 /// Gets or sets the single-line or multi-line layout option.<br />
1095 /// If not specified, the default is false.<br />
1098 /// <since_tizen> 3 </since_tizen>
1099 public bool MultiLine
1103 return _multiLine ?? (false);
1113 /// Gets or sets the line horizontal alignment.<br />
1114 /// If not specified, the default is begin.<br />
1117 /// <since_tizen> 3 </since_tizen>
1118 public HorizontalAlignment HorizontalAlignment
1122 switch (_horizontalAlignment)
1125 return HorizontalAlignment.Begin;
1127 return HorizontalAlignment.Center;
1129 return HorizontalAlignment.End;
1131 return HorizontalAlignment.Begin;
1138 case HorizontalAlignment.Begin:
1140 _horizontalAlignment = "BEGIN";
1143 case HorizontalAlignment.Center:
1145 _horizontalAlignment = "CENTER";
1148 case HorizontalAlignment.End:
1150 _horizontalAlignment = "END";
1155 _horizontalAlignment = "BEGIN";
1164 /// Gets or sets the line vertical alignment.<br />
1165 /// If not specified, the default is top.<br />
1168 /// <since_tizen> 3 </since_tizen>
1169 public VerticalAlignment VerticalAlignment
1173 switch (_verticalAlignment)
1176 return VerticalAlignment.Top;
1178 return VerticalAlignment.Center;
1180 return VerticalAlignment.Bottom;
1182 return VerticalAlignment.Top;
1189 case VerticalAlignment.Top:
1191 _verticalAlignment = "TOP";
1194 case VerticalAlignment.Center:
1196 _verticalAlignment = "CENTER";
1199 case VerticalAlignment.Bottom:
1201 _verticalAlignment = "BOTTOM";
1206 _verticalAlignment = "TOP";
1215 /// Gets or sets the color of the text.<br />
1218 /// <since_tizen> 3 </since_tizen>
1219 public Color TextColor
1233 /// Gets or sets whether the mark-up processing is enabled.<br />
1236 /// <since_tizen> 3 </since_tizen>
1237 public bool EnableMarkup
1241 return _enableMarkup ?? (false);
1245 _enableMarkup = value;
1251 /// Compose the out visual map.
1253 /// <since_tizen> 3 </since_tizen>
1254 protected override void ComposingPropertyMap()
1256 if (_text != null && _pointSize != null)
1258 _outputVisualMap = new PropertyMap();
1259 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1260 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1261 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1262 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1263 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1264 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1265 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1266 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1267 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1268 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1269 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1270 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1271 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1272 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1278 /// A class encapsulating the property map of the border visual.
1280 /// <since_tizen> 3 </since_tizen>
1281 public class BorderVisual : VisualMap
1286 /// <since_tizen> 3 </since_tizen>
1287 public BorderVisual() : base()
1291 private Color _color = null;
1292 private float? _size = null;
1293 private bool? _antiAliasing = null;
1296 /// Gets or sets the color of the border.<br />
1299 /// <since_tizen> 3 </since_tizen>
1314 /// Gets or sets the width of the border (in pixels).<br />
1317 /// <since_tizen> 3 </since_tizen>
1318 public float BorderSize
1322 return _size ?? (-1.0f);
1332 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1333 /// If not supplied, the default is false.<br />
1336 /// <since_tizen> 3 </since_tizen>
1337 public bool AntiAliasing
1341 return _antiAliasing ?? (false);
1345 _antiAliasing = value;
1351 /// Compose the out visual map.
1353 /// <since_tizen> 3 </since_tizen>
1354 protected override void ComposingPropertyMap()
1356 if (_color != null && _size != null)
1358 _outputVisualMap = new PropertyMap();
1359 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1360 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1361 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1362 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1363 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1364 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1365 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1366 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1372 /// A class encapsulating the property map of the color visual.
1374 /// <since_tizen> 3 </since_tizen>
1375 public class ColorVisual : VisualMap
1380 /// <since_tizen> 3 </since_tizen>
1381 public ColorVisual() : base()
1385 private Color _mixColorForColorVisual = null;
1388 /// Gets or sets the solid color required.<br />
1391 /// <since_tizen> 3 </since_tizen>
1396 return _mixColorForColorVisual;
1400 _mixColorForColorVisual = value;
1406 /// Compose the out visual map.
1408 /// <since_tizen> 3 </since_tizen>
1409 protected override void ComposingPropertyMap()
1411 if (_mixColorForColorVisual != null)
1413 _outputVisualMap = new PropertyMap();
1414 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1415 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1416 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1417 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1418 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1424 /// A class encapsulating the property map of the gradient visual.
1426 /// <since_tizen> 3 </since_tizen>
1427 public class GradientVisual : VisualMap
1432 /// <since_tizen> 3 </since_tizen>
1433 public GradientVisual() : base()
1437 private Vector2 _startPosition = null;
1438 private Vector2 _endPosition = null;
1439 private Vector2 _center = null;
1440 private float? _radius = null;
1441 private PropertyArray _stopOffset = null;
1442 private PropertyArray _stopColor = null;
1443 private GradientVisualUnitsType? _units = null;
1444 private GradientVisualSpreadMethodType? _spreadMethod = null;
1447 /// Gets or sets the start position of a linear gradient.<br />
1448 /// Mandatory for linear.<br />
1450 /// <since_tizen> 3 </since_tizen>
1451 public Vector2 StartPosition
1455 return _startPosition;
1459 _startPosition = value;
1465 /// Gets or sets the end position of a linear gradient.<br />
1466 /// Mandatory for linear.<br />
1468 /// <since_tizen> 3 </since_tizen>
1469 public Vector2 EndPosition
1473 return _endPosition;
1477 _endPosition = value;
1483 /// Gets or sets the center point of a radial gradient.<br />
1484 /// Mandatory for radial.<br />
1486 /// <since_tizen> 3 </since_tizen>
1487 public Vector2 Center
1501 /// Gets or sets the size of the radius of a radial gradient.<br />
1502 /// Mandatory for radial.<br />
1504 /// <since_tizen> 3 </since_tizen>
1509 return _radius ?? (-1.0f);
1519 /// Gets or sets all the stop offsets.<br />
1520 /// A PropertyArray of float.<br />
1521 /// If not supplied, the default is 0.0f and 1.0f.<br />
1524 /// <since_tizen> 3 </since_tizen>
1525 public PropertyArray StopOffset
1533 _stopOffset = value;
1539 /// Gets or sets the color at the stop offsets.<br />
1540 /// A PropertyArray of color.<br />
1541 /// At least 2 values are required to show a gradient.<br />
1544 /// <since_tizen> 3 </since_tizen>
1545 public PropertyArray StopColor
1559 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1560 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1563 /// <since_tizen> 3 </since_tizen>
1564 public GradientVisualUnitsType Units
1568 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1578 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1579 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1582 /// <since_tizen> 3 </since_tizen>
1583 public GradientVisualSpreadMethodType SpreadMethod
1587 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1591 _spreadMethod = value;
1597 /// Compose the out visual map.
1599 /// <since_tizen> 3 </since_tizen>
1600 protected override void ComposingPropertyMap()
1602 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1604 _outputVisualMap = new PropertyMap();
1605 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1606 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1607 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1608 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1609 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1610 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1611 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1612 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1613 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1614 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1615 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1616 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1617 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1623 /// A class encapsulating the property map of the mesh visual.
1625 /// <since_tizen> 3 </since_tizen>
1626 public class MeshVisual : VisualMap
1631 /// <since_tizen> 3 </since_tizen>
1632 public MeshVisual() : base()
1636 private string _objectURL = null;
1637 private string _materialtURL = null;
1638 private string _texturesPath = null;
1639 private MeshVisualShadingModeValue? _shadingMode = null;
1640 private bool? _useMipmapping = null;
1641 private bool? _useSoftNormals = null;
1642 private Vector3 _lightPosition = null;
1645 /// Gets or sets the location of the ".obj" file.<br />
1648 /// <since_tizen> 3 </since_tizen>
1649 public string ObjectURL
1663 /// Gets or sets the location of the ".mtl" file.<br />
1664 /// If not specified, then a textureless object is assumed.<br />
1667 /// <since_tizen> 3 </since_tizen>
1668 public string MaterialtURL
1672 return _materialtURL;
1676 _materialtURL = value;
1682 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1683 /// Mandatory if using material.<br />
1685 /// <since_tizen> 3 </since_tizen>
1686 public string TexturesPath
1690 return _texturesPath;
1694 _texturesPath = value;
1700 /// Gets or sets the type of shading mode that the mesh will use.<br />
1701 /// 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 />
1702 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1705 /// <since_tizen> 3 </since_tizen>
1706 public MeshVisualShadingModeValue ShadingMode
1710 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1714 _shadingMode = value;
1720 /// Gets or sets whether to use mipmaps for textures or not.<br />
1721 /// If not specified, the default is true.<br />
1724 /// <since_tizen> 3 </since_tizen>
1725 public bool UseMipmapping
1729 return _useMipmapping ?? (true);
1733 _useMipmapping = value;
1739 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1740 /// If not specified, the default is true.<br />
1743 /// <since_tizen> 3 </since_tizen>
1744 public bool UseSoftNormals
1748 return _useSoftNormals ?? (true);
1752 _useSoftNormals = value;
1758 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1759 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1760 /// and using all zeroes will place the light at the top-left corner.<br />
1761 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1764 /// <since_tizen> 3 </since_tizen>
1765 public Vector3 LightPosition
1769 return _lightPosition;
1773 _lightPosition = value;
1779 /// Compose the out visual map.
1781 /// <since_tizen> 3 </since_tizen>
1782 protected override void ComposingPropertyMap()
1784 if (_objectURL != null)
1786 _outputVisualMap = new PropertyMap();
1787 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1788 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1789 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1790 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1791 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1792 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1793 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1794 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1795 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1796 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1797 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1803 /// A class encapsulating the property map of the primetive visual.
1805 /// <since_tizen> 3 </since_tizen>
1806 public class PrimitiveVisual : VisualMap
1811 /// <since_tizen> 3 </since_tizen>
1812 public PrimitiveVisual() : base()
1816 private PrimitiveVisualShapeType? _shape = null;
1817 private Color _mixColorForPrimitiveVisual = null;
1818 private int? _slices = null;
1819 private int? _stacks = null;
1820 private float? _scaleTopRadius = null;
1821 private float? _scaleBottomRadius = null;
1822 private float? _scaleHeight = null;
1823 private float? _scaleRadius = null;
1824 private Vector3 _scaleDimensions = null;
1825 private float? _bevelPercentage = null;
1826 private float? _bevelSmoothness = null;
1827 private Vector3 _lightPosition = null;
1830 /// Gets or sets the specific shape to render.<br />
1831 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
1834 /// <since_tizen> 3 </since_tizen>
1835 public PrimitiveVisualShapeType Shape
1839 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1849 /// Gets or sets the color of the shape.<br />
1850 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
1851 /// Applies to all shapes.<br />
1854 /// <since_tizen> 3 </since_tizen>
1855 public new Color MixColor
1859 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1863 _mixColorForPrimitiveVisual = value;
1869 /// Gets or sets the number of slices as you go around the shape.<br />
1870 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
1871 /// If not specified, the default is 128.<br />
1872 /// The range is from 1 to 255.<br />
1875 /// <since_tizen> 3 </since_tizen>
1880 return _slices ?? (128);
1890 /// Gets or sets the number of stacks as you go down the shape.<br />
1891 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
1892 /// If not specified, the default is 128.<br />
1893 /// The range is from 1 to 255.<br />
1896 /// <since_tizen> 3 </since_tizen>
1901 return _stacks ?? (128);
1911 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
1912 /// If not specified, the default is 1.0f.<br />
1913 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1914 /// Only values greater than or equal to 0.0f are accepted.<br />
1917 /// <since_tizen> 3 </since_tizen>
1918 public float ScaleTopRadius
1922 return _scaleTopRadius ?? (1.0f);
1926 _scaleTopRadius = value;
1932 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
1933 /// If not specified, the default is 1.5f.<br />
1934 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1935 /// - PrimitiveVisualShapeType.Cone<br />
1936 /// Only values greater than or equal to 0.0f are accepted.<br />
1939 /// <since_tizen> 3 </since_tizen>
1940 public float ScaleBottomRadius
1944 return _scaleBottomRadius ?? (1.5f);
1948 _scaleBottomRadius = value;
1954 /// Gets or sets the scale of the height of a conic.<br />
1955 /// If not specified, the default is 3.0f.<br />
1956 /// Applies to:<br />
1957 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
1958 /// - PrimitiveVisualShapeType.Cone<br />
1959 /// - PrimitiveVisualShapeType.Cylinder<br />
1960 /// Only values greater than or equal to 0.0f are accepted.<br />
1963 /// <since_tizen> 3 </since_tizen>
1964 public float ScaleHeight
1968 return _scaleHeight ?? (3.0f);
1972 _scaleHeight = value;
1978 /// Gets or sets the scale of the radius of a cylinder.<br />
1979 /// If not specified, the default is 1.0f.<br />
1980 /// Applies to:<br />
1981 /// - PrimitiveVisualShapeType.Cylinder<br />
1982 /// Only values greater than or equal to 0.0f are accepted.<br />
1985 /// <since_tizen> 3 </since_tizen>
1986 public float ScaleRadius
1990 return _scaleRadius ?? (1.0f);
1994 _scaleRadius = value;
2000 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
2001 /// If not specified, the default is Vector3.One.<br />
2002 /// Applies to:<br />
2003 /// - PrimitiveVisualShapeType.Cube<br />
2004 /// - PrimitiveVisualShapeType.Octahedron<br />
2005 /// - PrimitiveVisualShapeType.BevelledCube<br />
2006 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2009 /// <since_tizen> 3 </since_tizen>
2010 public Vector3 ScaleDimensions
2014 return _scaleDimensions ?? (Vector3.One);
2018 _scaleDimensions = value;
2024 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2025 /// 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 />
2026 /// If not specified, the default is 0.0f (no bevel).<br />
2027 /// Applies to:<br />
2028 /// - PrimitiveVisualShapeType.BevelledCube<br />
2029 /// The range is from 0.0f to 1.0f.<br />
2032 /// <since_tizen> 3 </since_tizen>
2033 public float BevelPercentage
2037 return _bevelPercentage ?? (0.0f);
2041 _bevelPercentage = value;
2047 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2048 /// If not specified, the default is 0.0f (sharp edges).<br />
2049 /// Applies to:<br />
2050 /// - PrimitiveVisualShapeType.BevelledCube<br />
2051 /// The range is from 0.0f to 1.0f.<br />
2054 /// <since_tizen> 3 </since_tizen>
2055 public float BevelSmoothness
2059 return _bevelSmoothness ?? (0.0f);
2063 _bevelSmoothness = value;
2069 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2070 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2071 /// and using all zeroes will place the light at the top-left corner.<br />
2072 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2073 /// Applies to all shapes.<br />
2076 /// <since_tizen> 3 </since_tizen>
2077 public Vector3 LightPosition
2081 return _lightPosition;
2085 _lightPosition = value;
2091 /// Compose the out visual map.
2093 /// <since_tizen> 3 </since_tizen>
2094 protected override void ComposingPropertyMap()
2096 _outputVisualMap = new PropertyMap(); ;
2097 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2098 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2099 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2100 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2101 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2102 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2103 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2104 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2105 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2106 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2107 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2108 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2109 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2110 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2111 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2112 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2117 /// A class encapsulating the property map of the n-patch image visual.
2119 /// <since_tizen> 3 </since_tizen>
2120 public class NPatchVisual : VisualMap
2125 /// <since_tizen> 3 </since_tizen>
2126 public NPatchVisual() : base()
2130 private string _url = null;
2131 private bool? _borderOnly = null;
2132 private Rectangle _border = null;
2135 /// Gets or sets the URL of the image.<br />
2138 /// <since_tizen> 3 </since_tizen>
2153 /// Gets or sets whether to draw the borders only (If true).<br />
2154 /// If not specified, the default is false.<br />
2155 /// For n-patch images only.<br />
2158 /// <since_tizen> 3 </since_tizen>
2159 public bool BorderOnly
2163 return _borderOnly ?? false;
2167 _borderOnly = value;
2173 /// The border of the image is in the order: left, right, bottom, top.<br />
2174 /// For n-patch images only.<br />
2177 /// <since_tizen> 3 </since_tizen>
2178 public Rectangle Border
2192 /// Compose the out visual map.
2194 /// <since_tizen> 3 </since_tizen>
2195 protected override void ComposingPropertyMap()
2199 _outputVisualMap = new PropertyMap();
2200 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2201 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2202 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2203 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2204 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2205 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2206 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2207 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2213 /// A class encapsulating the property map of the SVG visual.
2215 /// <since_tizen> 3 </since_tizen>
2216 public class SVGVisual : VisualMap
2221 /// <since_tizen> 3 </since_tizen>
2222 public SVGVisual() : base()
2226 private string _url = null;
2229 /// The url of the svg resource.
2231 /// <since_tizen> 3 </since_tizen>
2246 /// Compose the out visual map.
2248 /// <since_tizen> 3 </since_tizen>
2249 protected override void ComposingPropertyMap()
2253 _outputVisualMap = new PropertyMap();
2254 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2255 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2256 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2257 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2258 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2259 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2265 /// A class encapsulating the property map of the animated image (AGIF) visual.
2267 /// <since_tizen> 3 </since_tizen>
2268 public class AnimatedImageVisual : VisualMap
2273 /// <since_tizen> 3 </since_tizen>
2274 public AnimatedImageVisual() : base()
2278 private List<string> _urls = null;
2279 private int? _batchSize = null;
2280 private int? _cacheSize = null;
2281 private float? _frameDelay = null;
2284 /// Gets and Sets the url in the AnimatedImageVisual.
2286 /// <since_tizen> 3 </since_tizen>
2304 _urls = new List<string>();
2316 /// Gets and Sets the url list in the AnimatedImageVisual.
2318 /// <since_tizen> 4 </since_tizen>
2319 public List<string> URLS
2333 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2335 /// <since_tizen> 4 </since_tizen>
2336 public int BatchSize
2340 return _batchSize ?? 1;
2350 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2352 /// <since_tizen> 4 </since_tizen>
2353 public int CacheSize
2357 return _cacheSize ?? 1;
2367 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2369 /// <since_tizen> 4 </since_tizen>
2370 public float FrameDelay
2374 return _frameDelay ?? 0.1f;
2378 _frameDelay = value;
2384 /// Compose the out visual map.
2386 /// <since_tizen> 3 </since_tizen>
2387 protected override void ComposingPropertyMap()
2391 _outputVisualMap = new PropertyMap();
2392 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2393 if( _urls.Count == 1 )
2395 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2399 var urlArray = new PropertyArray();
2400 foreach( var url in _urls)
2402 urlArray.Add(new PropertyValue(url));
2404 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2406 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2407 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2408 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2409 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2410 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2411 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2412 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2418 //temporary fix for TCT
2420 /// A class encapsulating the property map of the transition data.
2422 /// <since_tizen> 3 </since_tizen>
2423 public class VisualAnimator : VisualMap
2426 /// Create VisualAnimator object.
2428 /// <since_tizen> 3 </since_tizen>
2429 public VisualAnimator() : base()
2433 private string _alphaFunction = null;
2434 private int _startTime = 0;
2435 private int _endTime = 0;
2436 private string _target = null;
2437 private string _propertyIndex = null;
2438 private object _destinationValue = null;
2441 /// Sets and Gets the AlphaFunction of this transition.
2443 /// <since_tizen> 3 </since_tizen>
2444 public AlphaFunction.BuiltinFunctions AlphaFunction
2448 switch (_alphaFunction)
2451 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2453 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2454 case "EASE_IN_SQUARE":
2455 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2456 case "EASE_OUT_SQUARE":
2457 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2459 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2461 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2463 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2464 case "EASE_IN_SINE":
2465 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2466 case "EASE_OUT_SINE":
2467 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2468 case "EASE_IN_OUT_SINE":
2469 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2471 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2473 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2474 case "EASE_OUT_BACK":
2475 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2477 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2484 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2486 _alphaFunction = "LINEAR";
2489 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2491 _alphaFunction = "REVERSE";
2494 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2496 _alphaFunction = "EASE_IN_SQUARE";
2499 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2501 _alphaFunction = "EASE_OUT_SQUARE";
2504 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2506 _alphaFunction = "EASE_IN";
2509 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2511 _alphaFunction = "EASE_OUT";
2514 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2516 _alphaFunction = "EASE_IN_OUT";
2519 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2521 _alphaFunction = "EASE_IN_SINE";
2524 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2526 _alphaFunction = "EASE_OUT_SINE";
2529 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2531 _alphaFunction = "EASE_IN_OUT_SINE";
2534 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2536 _alphaFunction = "BOUNCE";
2539 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2541 _alphaFunction = "SIN";
2544 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2546 _alphaFunction = "EASE_OUT_BACK";
2551 _alphaFunction = "DEFAULT";
2559 /// Sets and Gets the StartTime of this transition.
2561 /// <since_tizen> 3 </since_tizen>
2562 public int StartTime
2575 /// Sets and Gets the EndTime of this transition.
2577 /// <since_tizen> 3 </since_tizen>
2591 /// Sets and Gets the Target of this transition.
2593 /// <since_tizen> 3 </since_tizen>
2594 public string Target
2607 /// Sets and Gets the PropertyIndex of this transition.
2609 /// <since_tizen> 3 </since_tizen>
2610 public string PropertyIndex
2614 return _propertyIndex;
2618 _propertyIndex = value;
2623 /// Sets and Gets the DestinationValue of this transition.
2625 /// <since_tizen> 3 </since_tizen>
2626 public object DestinationValue
2630 return _destinationValue;
2634 _destinationValue = value;
2639 /// Compose the out visual map.
2641 /// <since_tizen> 3 </since_tizen>
2642 protected override void ComposingPropertyMap()
2644 PropertyMap _animator = new PropertyMap();
2645 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2647 PropertyMap _timePeriod = new PropertyMap();
2648 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2649 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2650 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2652 StringBuilder sb = new StringBuilder(_propertyIndex);
2653 sb[0] = (char)(sb[0] | 0x20);
2654 string _str = sb.ToString();
2656 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2658 PropertyMap _transition = new PropertyMap();
2659 _transition.Add("target", new PropertyValue(_target));
2660 _transition.Add("property", new PropertyValue(_str));
2661 _transition.Add("targetValue", val);
2662 _transition.Add("animator", new PropertyValue(_animator));
2664 _outputVisualMap = _transition;
2667 //temporary fix for TCT