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 public ReleasePolicyType ReleasePolicy
908 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
912 _releasePolicy = value;
919 /// Get or set the Image Visual image loading policy<br />
920 /// It decides if a texture should be loaded immediately after source set or only after visual is added to window <br />
922 /// <since_tizen> 5 </since_tizen>
923 public LoadPolicyType LoadPolicy
927 return _loadPolicy ?? (LoadPolicyType.Attached);
937 /// Get or set whether to automatically correct the orientation based on exif data.<br />
938 /// If not specified, the default is true.<br />
939 /// For JPEG images only.<br />
942 /// <since_tizen> 5 </since_tizen>
943 public bool OrientationCorrection
947 return _orientationCorrection ?? (true);
951 _orientationCorrection = value;
958 /// Compose the out visual map.
960 /// <since_tizen> 3 </since_tizen>
961 protected override void ComposingPropertyMap()
965 _outputVisualMap = new PropertyMap();
966 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
967 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
968 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
969 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
970 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
971 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
972 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
973 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
974 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
975 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
976 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
977 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
978 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
979 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
980 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
981 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
982 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
983 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
984 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
985 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
986 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
992 /// A class encapsulating the property map of the text visual.
994 /// <since_tizen> 3 </since_tizen>
995 public class TextVisual : VisualMap
1000 /// <since_tizen> 3 </since_tizen>
1001 public TextVisual() : base()
1005 private string _text = null;
1006 private string _fontFamily = null;
1007 private PropertyMap _fontStyle = null;
1008 private float? _pointSize = null;
1009 private bool? _multiLine = null;
1010 private string _horizontalAlignment = null;
1011 private string _verticalAlignment = null;
1012 private Color _textColor = null;
1013 private bool? _enableMarkup = null;
1016 /// Gets or sets the text to display in the UTF-8 format.<br />
1019 /// <since_tizen> 3 </since_tizen>
1034 /// Gets or sets the requested font family to use.<br />
1037 /// <since_tizen> 3 </since_tizen>
1038 public string FontFamily
1046 _fontFamily = value;
1052 /// Gets or sets the requested font style to use.<br />
1055 /// <since_tizen> 3 </since_tizen>
1056 public PropertyMap FontStyle
1070 /// Gets or sets the size of font in points.<br />
1073 /// <since_tizen> 3 </since_tizen>
1074 public float PointSize
1078 return _pointSize ?? (0.0f);
1088 /// Gets or sets the single-line or multi-line layout option.<br />
1089 /// If not specified, the default is false.<br />
1092 /// <since_tizen> 3 </since_tizen>
1093 public bool MultiLine
1097 return _multiLine ?? (false);
1107 /// Gets or sets the line horizontal alignment.<br />
1108 /// If not specified, the default is begin.<br />
1111 /// <since_tizen> 3 </since_tizen>
1112 public HorizontalAlignment HorizontalAlignment
1116 switch (_horizontalAlignment)
1119 return HorizontalAlignment.Begin;
1121 return HorizontalAlignment.Center;
1123 return HorizontalAlignment.End;
1125 return HorizontalAlignment.Begin;
1132 case HorizontalAlignment.Begin:
1134 _horizontalAlignment = "BEGIN";
1137 case HorizontalAlignment.Center:
1139 _horizontalAlignment = "CENTER";
1142 case HorizontalAlignment.End:
1144 _horizontalAlignment = "END";
1149 _horizontalAlignment = "BEGIN";
1158 /// Gets or sets the line vertical alignment.<br />
1159 /// If not specified, the default is top.<br />
1162 /// <since_tizen> 3 </since_tizen>
1163 public VerticalAlignment VerticalAlignment
1167 switch (_verticalAlignment)
1170 return VerticalAlignment.Top;
1172 return VerticalAlignment.Center;
1174 return VerticalAlignment.Bottom;
1176 return VerticalAlignment.Top;
1183 case VerticalAlignment.Top:
1185 _verticalAlignment = "TOP";
1188 case VerticalAlignment.Center:
1190 _verticalAlignment = "CENTER";
1193 case VerticalAlignment.Bottom:
1195 _verticalAlignment = "BOTTOM";
1200 _verticalAlignment = "TOP";
1209 /// Gets or sets the color of the text.<br />
1212 /// <since_tizen> 3 </since_tizen>
1213 public Color TextColor
1227 /// Gets or sets whether the mark-up processing is enabled.<br />
1230 /// <since_tizen> 3 </since_tizen>
1231 public bool EnableMarkup
1235 return _enableMarkup ?? (false);
1239 _enableMarkup = value;
1245 /// Compose the out visual map.
1247 /// <since_tizen> 3 </since_tizen>
1248 protected override void ComposingPropertyMap()
1250 if (_text != null && _pointSize != null)
1252 _outputVisualMap = new PropertyMap();
1253 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1254 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1255 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1256 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1257 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1258 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1259 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1260 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1261 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1262 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1263 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1264 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1265 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1266 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1272 /// A class encapsulating the property map of the border visual.
1274 /// <since_tizen> 3 </since_tizen>
1275 public class BorderVisual : VisualMap
1280 /// <since_tizen> 3 </since_tizen>
1281 public BorderVisual() : base()
1285 private Color _color = null;
1286 private float? _size = null;
1287 private bool? _antiAliasing = null;
1290 /// Gets or sets the color of the border.<br />
1293 /// <since_tizen> 3 </since_tizen>
1308 /// Gets or sets the width of the border (in pixels).<br />
1311 /// <since_tizen> 3 </since_tizen>
1312 public float BorderSize
1316 return _size ?? (-1.0f);
1326 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1327 /// If not supplied, the default is false.<br />
1330 /// <since_tizen> 3 </since_tizen>
1331 public bool AntiAliasing
1335 return _antiAliasing ?? (false);
1339 _antiAliasing = value;
1345 /// Compose the out visual map.
1347 /// <since_tizen> 3 </since_tizen>
1348 protected override void ComposingPropertyMap()
1350 if (_color != null && _size != null)
1352 _outputVisualMap = new PropertyMap();
1353 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1354 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1355 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1356 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1357 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1358 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1359 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1360 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1366 /// A class encapsulating the property map of the color visual.
1368 /// <since_tizen> 3 </since_tizen>
1369 public class ColorVisual : VisualMap
1374 /// <since_tizen> 3 </since_tizen>
1375 public ColorVisual() : base()
1379 private Color _mixColorForColorVisual = null;
1382 /// Gets or sets the solid color required.<br />
1385 /// <since_tizen> 3 </since_tizen>
1390 return _mixColorForColorVisual;
1394 _mixColorForColorVisual = value;
1400 /// Compose the out visual map.
1402 /// <since_tizen> 3 </since_tizen>
1403 protected override void ComposingPropertyMap()
1405 if (_mixColorForColorVisual != null)
1407 _outputVisualMap = new PropertyMap();
1408 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1409 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1410 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1411 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1412 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1418 /// A class encapsulating the property map of the gradient visual.
1420 /// <since_tizen> 3 </since_tizen>
1421 public class GradientVisual : VisualMap
1426 /// <since_tizen> 3 </since_tizen>
1427 public GradientVisual() : base()
1431 private Vector2 _startPosition = null;
1432 private Vector2 _endPosition = null;
1433 private Vector2 _center = null;
1434 private float? _radius = null;
1435 private PropertyArray _stopOffset = null;
1436 private PropertyArray _stopColor = null;
1437 private GradientVisualUnitsType? _units = null;
1438 private GradientVisualSpreadMethodType? _spreadMethod = null;
1441 /// Gets or sets the start position of a linear gradient.<br />
1442 /// Mandatory for linear.<br />
1444 /// <since_tizen> 3 </since_tizen>
1445 public Vector2 StartPosition
1449 return _startPosition;
1453 _startPosition = value;
1459 /// Gets or sets the end position of a linear gradient.<br />
1460 /// Mandatory for linear.<br />
1462 /// <since_tizen> 3 </since_tizen>
1463 public Vector2 EndPosition
1467 return _endPosition;
1471 _endPosition = value;
1477 /// Gets or sets the center point of a radial gradient.<br />
1478 /// Mandatory for radial.<br />
1480 /// <since_tizen> 3 </since_tizen>
1481 public Vector2 Center
1495 /// Gets or sets the size of the radius of a radial gradient.<br />
1496 /// Mandatory for radial.<br />
1498 /// <since_tizen> 3 </since_tizen>
1503 return _radius ?? (-1.0f);
1513 /// Gets or sets all the stop offsets.<br />
1514 /// A PropertyArray of float.<br />
1515 /// If not supplied, the default is 0.0f and 1.0f.<br />
1518 /// <since_tizen> 3 </since_tizen>
1519 public PropertyArray StopOffset
1527 _stopOffset = value;
1533 /// Gets or sets the color at the stop offsets.<br />
1534 /// A PropertyArray of color.<br />
1535 /// At least 2 values are required to show a gradient.<br />
1538 /// <since_tizen> 3 </since_tizen>
1539 public PropertyArray StopColor
1553 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1554 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1557 /// <since_tizen> 3 </since_tizen>
1558 public GradientVisualUnitsType Units
1562 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1572 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1573 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1576 /// <since_tizen> 3 </since_tizen>
1577 public GradientVisualSpreadMethodType SpreadMethod
1581 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1585 _spreadMethod = value;
1591 /// Compose the out visual map.
1593 /// <since_tizen> 3 </since_tizen>
1594 protected override void ComposingPropertyMap()
1596 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1598 _outputVisualMap = new PropertyMap();
1599 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1600 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1601 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1602 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1603 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1604 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1605 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1606 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1607 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1608 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1609 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1610 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1611 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1617 /// A class encapsulating the property map of the mesh visual.
1619 /// <since_tizen> 3 </since_tizen>
1620 public class MeshVisual : VisualMap
1625 /// <since_tizen> 3 </since_tizen>
1626 public MeshVisual() : base()
1630 private string _objectURL = null;
1631 private string _materialtURL = null;
1632 private string _texturesPath = null;
1633 private MeshVisualShadingModeValue? _shadingMode = null;
1634 private bool? _useMipmapping = null;
1635 private bool? _useSoftNormals = null;
1636 private Vector3 _lightPosition = null;
1639 /// Gets or sets the location of the ".obj" file.<br />
1642 /// <since_tizen> 3 </since_tizen>
1643 public string ObjectURL
1657 /// Gets or sets the location of the ".mtl" file.<br />
1658 /// If not specified, then a textureless object is assumed.<br />
1661 /// <since_tizen> 3 </since_tizen>
1662 public string MaterialtURL
1666 return _materialtURL;
1670 _materialtURL = value;
1676 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1677 /// Mandatory if using material.<br />
1679 /// <since_tizen> 3 </since_tizen>
1680 public string TexturesPath
1684 return _texturesPath;
1688 _texturesPath = value;
1694 /// Gets or sets the type of shading mode that the mesh will use.<br />
1695 /// 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 />
1696 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1699 /// <since_tizen> 3 </since_tizen>
1700 public MeshVisualShadingModeValue ShadingMode
1704 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1708 _shadingMode = value;
1714 /// Gets or sets whether to use mipmaps for textures or not.<br />
1715 /// If not specified, the default is true.<br />
1718 /// <since_tizen> 3 </since_tizen>
1719 public bool UseMipmapping
1723 return _useMipmapping ?? (true);
1727 _useMipmapping = value;
1733 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1734 /// If not specified, the default is true.<br />
1737 /// <since_tizen> 3 </since_tizen>
1738 public bool UseSoftNormals
1742 return _useSoftNormals ?? (true);
1746 _useSoftNormals = value;
1752 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1753 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1754 /// and using all zeroes will place the light at the top-left corner.<br />
1755 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1758 /// <since_tizen> 3 </since_tizen>
1759 public Vector3 LightPosition
1763 return _lightPosition;
1767 _lightPosition = value;
1773 /// Compose the out visual map.
1775 /// <since_tizen> 3 </since_tizen>
1776 protected override void ComposingPropertyMap()
1778 if (_objectURL != null)
1780 _outputVisualMap = new PropertyMap();
1781 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1782 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1783 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1784 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1785 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1786 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1787 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1788 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1789 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1790 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1791 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1797 /// A class encapsulating the property map of the primetive visual.
1799 /// <since_tizen> 3 </since_tizen>
1800 public class PrimitiveVisual : VisualMap
1805 /// <since_tizen> 3 </since_tizen>
1806 public PrimitiveVisual() : base()
1810 private PrimitiveVisualShapeType? _shape = null;
1811 private Color _mixColorForPrimitiveVisual = null;
1812 private int? _slices = null;
1813 private int? _stacks = null;
1814 private float? _scaleTopRadius = null;
1815 private float? _scaleBottomRadius = null;
1816 private float? _scaleHeight = null;
1817 private float? _scaleRadius = null;
1818 private Vector3 _scaleDimensions = null;
1819 private float? _bevelPercentage = null;
1820 private float? _bevelSmoothness = null;
1821 private Vector3 _lightPosition = null;
1824 /// Gets or sets the specific shape to render.<br />
1825 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
1828 /// <since_tizen> 3 </since_tizen>
1829 public PrimitiveVisualShapeType Shape
1833 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1843 /// Gets or sets the color of the shape.<br />
1844 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
1845 /// Applies to all shapes.<br />
1848 /// <since_tizen> 3 </since_tizen>
1849 public new Color MixColor
1853 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1857 _mixColorForPrimitiveVisual = value;
1863 /// Gets or sets the number of slices as you go around the shape.<br />
1864 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
1865 /// If not specified, the default is 128.<br />
1866 /// The range is from 1 to 255.<br />
1869 /// <since_tizen> 3 </since_tizen>
1874 return _slices ?? (128);
1884 /// Gets or sets the number of stacks as you go down the shape.<br />
1885 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
1886 /// If not specified, the default is 128.<br />
1887 /// The range is from 1 to 255.<br />
1890 /// <since_tizen> 3 </since_tizen>
1895 return _stacks ?? (128);
1905 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
1906 /// If not specified, the default is 1.0f.<br />
1907 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1908 /// Only values greater than or equal to 0.0f are accepted.<br />
1911 /// <since_tizen> 3 </since_tizen>
1912 public float ScaleTopRadius
1916 return _scaleTopRadius ?? (1.0f);
1920 _scaleTopRadius = value;
1926 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
1927 /// If not specified, the default is 1.5f.<br />
1928 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1929 /// - PrimitiveVisualShapeType.Cone<br />
1930 /// Only values greater than or equal to 0.0f are accepted.<br />
1933 /// <since_tizen> 3 </since_tizen>
1934 public float ScaleBottomRadius
1938 return _scaleBottomRadius ?? (1.5f);
1942 _scaleBottomRadius = value;
1948 /// Gets or sets the scale of the height of a conic.<br />
1949 /// If not specified, the default is 3.0f.<br />
1950 /// Applies to:<br />
1951 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
1952 /// - PrimitiveVisualShapeType.Cone<br />
1953 /// - PrimitiveVisualShapeType.Cylinder<br />
1954 /// Only values greater than or equal to 0.0f are accepted.<br />
1957 /// <since_tizen> 3 </since_tizen>
1958 public float ScaleHeight
1962 return _scaleHeight ?? (3.0f);
1966 _scaleHeight = value;
1972 /// Gets or sets the scale of the radius of a cylinder.<br />
1973 /// If not specified, the default is 1.0f.<br />
1974 /// Applies to:<br />
1975 /// - PrimitiveVisualShapeType.Cylinder<br />
1976 /// Only values greater than or equal to 0.0f are accepted.<br />
1979 /// <since_tizen> 3 </since_tizen>
1980 public float ScaleRadius
1984 return _scaleRadius ?? (1.0f);
1988 _scaleRadius = value;
1994 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
1995 /// If not specified, the default is Vector3.One.<br />
1996 /// Applies to:<br />
1997 /// - PrimitiveVisualShapeType.Cube<br />
1998 /// - PrimitiveVisualShapeType.Octahedron<br />
1999 /// - PrimitiveVisualShapeType.BevelledCube<br />
2000 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2003 /// <since_tizen> 3 </since_tizen>
2004 public Vector3 ScaleDimensions
2008 return _scaleDimensions ?? (Vector3.One);
2012 _scaleDimensions = value;
2018 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2019 /// 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 />
2020 /// If not specified, the default is 0.0f (no bevel).<br />
2021 /// Applies to:<br />
2022 /// - PrimitiveVisualShapeType.BevelledCube<br />
2023 /// The range is from 0.0f to 1.0f.<br />
2026 /// <since_tizen> 3 </since_tizen>
2027 public float BevelPercentage
2031 return _bevelPercentage ?? (0.0f);
2035 _bevelPercentage = value;
2041 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2042 /// If not specified, the default is 0.0f (sharp edges).<br />
2043 /// Applies to:<br />
2044 /// - PrimitiveVisualShapeType.BevelledCube<br />
2045 /// The range is from 0.0f to 1.0f.<br />
2048 /// <since_tizen> 3 </since_tizen>
2049 public float BevelSmoothness
2053 return _bevelSmoothness ?? (0.0f);
2057 _bevelSmoothness = value;
2063 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2064 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2065 /// and using all zeroes will place the light at the top-left corner.<br />
2066 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2067 /// Applies to all shapes.<br />
2070 /// <since_tizen> 3 </since_tizen>
2071 public Vector3 LightPosition
2075 return _lightPosition;
2079 _lightPosition = value;
2085 /// Compose the out visual map.
2087 /// <since_tizen> 3 </since_tizen>
2088 protected override void ComposingPropertyMap()
2090 _outputVisualMap = new PropertyMap(); ;
2091 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2092 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2093 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2094 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2095 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2096 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2097 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2098 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2099 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2100 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2101 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2102 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2103 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2104 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2105 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2106 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2111 /// A class encapsulating the property map of the n-patch image visual.
2113 /// <since_tizen> 3 </since_tizen>
2114 public class NPatchVisual : VisualMap
2119 /// <since_tizen> 3 </since_tizen>
2120 public NPatchVisual() : base()
2124 private string _url = null;
2125 private bool? _borderOnly = null;
2126 private Rectangle _border = null;
2129 /// Gets or sets the URL of the image.<br />
2132 /// <since_tizen> 3 </since_tizen>
2147 /// Gets or sets whether to draw the borders only (If true).<br />
2148 /// If not specified, the default is false.<br />
2149 /// For n-patch images only.<br />
2152 /// <since_tizen> 3 </since_tizen>
2153 public bool BorderOnly
2157 return _borderOnly ?? false;
2161 _borderOnly = value;
2167 /// The border of the image is in the order: left, right, bottom, top.<br />
2168 /// For n-patch images only.<br />
2171 /// <since_tizen> 3 </since_tizen>
2172 public Rectangle Border
2186 /// Compose the out visual map.
2188 /// <since_tizen> 3 </since_tizen>
2189 protected override void ComposingPropertyMap()
2193 _outputVisualMap = new PropertyMap();
2194 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2195 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2196 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2197 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2198 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2199 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2200 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2201 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2207 /// A class encapsulating the property map of the SVG visual.
2209 /// <since_tizen> 3 </since_tizen>
2210 public class SVGVisual : VisualMap
2215 /// <since_tizen> 3 </since_tizen>
2216 public SVGVisual() : base()
2220 private string _url = null;
2223 /// The url of the svg resource.
2225 /// <since_tizen> 3 </since_tizen>
2240 /// Compose the out visual map.
2242 /// <since_tizen> 3 </since_tizen>
2243 protected override void ComposingPropertyMap()
2247 _outputVisualMap = new PropertyMap();
2248 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2249 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2250 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2251 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2252 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2253 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2259 /// A class encapsulating the property map of the animated image (AGIF) visual.
2261 /// <since_tizen> 3 </since_tizen>
2262 public class AnimatedImageVisual : VisualMap
2267 /// <since_tizen> 3 </since_tizen>
2268 public AnimatedImageVisual() : base()
2272 private List<string> _urls = null;
2273 private int? _batchSize = null;
2274 private int? _cacheSize = null;
2275 private float? _frameDelay = null;
2278 /// Gets and Sets the url in the AnimatedImageVisual.
2280 /// <since_tizen> 3 </since_tizen>
2298 _urls = new List<string>();
2310 /// Gets and Sets the url list in the AnimatedImageVisual.
2312 /// <since_tizen> 4 </since_tizen>
2313 public List<string> URLS
2327 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2329 /// <since_tizen> 4 </since_tizen>
2330 public int BatchSize
2334 return _batchSize ?? 1;
2344 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2346 /// <since_tizen> 4 </since_tizen>
2347 public int CacheSize
2351 return _cacheSize ?? 1;
2361 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2363 /// <since_tizen> 4 </since_tizen>
2364 public float FrameDelay
2368 return _frameDelay ?? 0.1f;
2372 _frameDelay = value;
2378 /// Compose the out visual map.
2380 /// <since_tizen> 3 </since_tizen>
2381 protected override void ComposingPropertyMap()
2385 _outputVisualMap = new PropertyMap();
2386 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2387 if( _urls.Count == 1 )
2389 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2393 var urlArray = new PropertyArray();
2394 foreach( var url in _urls)
2396 urlArray.Add(new PropertyValue(url));
2398 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2400 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2401 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2402 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2403 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2404 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2405 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2406 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2412 //temporary fix for TCT
2414 /// A class encapsulating the property map of the transition data.
2416 /// <since_tizen> 3 </since_tizen>
2417 public class VisualAnimator : VisualMap
2420 /// Create VisualAnimator object.
2422 /// <since_tizen> 3 </since_tizen>
2423 public VisualAnimator() : base()
2427 private string _alphaFunction = null;
2428 private int _startTime = 0;
2429 private int _endTime = 0;
2430 private string _target = null;
2431 private string _propertyIndex = null;
2432 private object _destinationValue = null;
2435 /// Sets and Gets the AlphaFunction of this transition.
2437 /// <since_tizen> 3 </since_tizen>
2438 public AlphaFunction.BuiltinFunctions AlphaFunction
2442 switch (_alphaFunction)
2445 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2447 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2448 case "EASE_IN_SQUARE":
2449 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2450 case "EASE_OUT_SQUARE":
2451 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2453 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2455 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2457 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2458 case "EASE_IN_SINE":
2459 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2460 case "EASE_OUT_SINE":
2461 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2462 case "EASE_IN_OUT_SINE":
2463 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2465 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2467 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2468 case "EASE_OUT_BACK":
2469 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2471 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2478 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2480 _alphaFunction = "LINEAR";
2483 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2485 _alphaFunction = "REVERSE";
2488 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2490 _alphaFunction = "EASE_IN_SQUARE";
2493 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2495 _alphaFunction = "EASE_OUT_SQUARE";
2498 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2500 _alphaFunction = "EASE_IN";
2503 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2505 _alphaFunction = "EASE_OUT";
2508 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2510 _alphaFunction = "EASE_IN_OUT";
2513 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2515 _alphaFunction = "EASE_IN_SINE";
2518 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2520 _alphaFunction = "EASE_OUT_SINE";
2523 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2525 _alphaFunction = "EASE_IN_OUT_SINE";
2528 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2530 _alphaFunction = "BOUNCE";
2533 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2535 _alphaFunction = "SIN";
2538 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2540 _alphaFunction = "EASE_OUT_BACK";
2545 _alphaFunction = "DEFAULT";
2553 /// Sets and Gets the StartTime of this transition.
2555 /// <since_tizen> 3 </since_tizen>
2556 public int StartTime
2569 /// Sets and Gets the EndTime of this transition.
2571 /// <since_tizen> 3 </since_tizen>
2585 /// Sets and Gets the Target of this transition.
2587 /// <since_tizen> 3 </since_tizen>
2588 public string Target
2601 /// Sets and Gets the PropertyIndex of this transition.
2603 /// <since_tizen> 3 </since_tizen>
2604 public string PropertyIndex
2608 return _propertyIndex;
2612 _propertyIndex = value;
2617 /// Sets and Gets the DestinationValue of this transition.
2619 /// <since_tizen> 3 </since_tizen>
2620 public object DestinationValue
2624 return _destinationValue;
2628 _destinationValue = value;
2633 /// Compose the out visual map.
2635 /// <since_tizen> 3 </since_tizen>
2636 protected override void ComposingPropertyMap()
2638 PropertyMap _animator = new PropertyMap();
2639 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2641 PropertyMap _timePeriod = new PropertyMap();
2642 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2643 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2644 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2646 StringBuilder sb = new StringBuilder(_propertyIndex);
2647 sb[0] = (char)(sb[0] | 0x20);
2648 string _str = sb.ToString();
2650 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2652 PropertyMap _transition = new PropertyMap();
2653 _transition.Add("target", new PropertyValue(_target));
2654 _transition.Add("property", new PropertyValue(_str));
2655 _transition.Add("targetValue", val);
2656 _transition.Add("animator", new PropertyValue(_animator));
2658 _outputVisualMap = _transition;
2661 //temporary fix for TCT