2 * Copyright(c) 2018 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 FittingMode of the visual.
537 /// <since_tizen> 5 </since_tizen>
538 protected VisualFittingModeType? _visualFittingMode = null;
541 /// The map for visual.
543 /// <since_tizen> 3 </since_tizen>
544 protected PropertyMap _commonlyUsedMap = null;
547 /// The shader to use in the visual.
549 /// <since_tizen> 3 </since_tizen>
550 public PropertyMap Shader
564 /// Enables or disables the premultiplied alpha. <br />
565 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
567 /// <since_tizen> 3 </since_tizen>
568 public bool PremultipliedAlpha
572 return _premultipliedAlpha ?? (false);
576 _premultipliedAlpha = value;
582 /// Mix color is a blend color for any visual.
584 /// <since_tizen> 3 </since_tizen>
585 public Color MixColor
599 /// Opacity is the alpha component of the mix color discussed above.
601 /// <since_tizen> 3 </since_tizen>
606 return _opacity ?? (1.0f);
616 /// The fitting mode of the visual.
617 /// The default is defined by the type of visual (if it is suitable to be stretched or not).
619 /// <since_tizen> 5 </since_tizen>
620 public VisualFittingModeType VisualFittingMode
624 if (_visualFittingMode == null)
626 if (this is AnimatedImageVisual ||
627 this is MeshVisual ||
628 this is PrimitiveVisual ||
631 return VisualFittingModeType.FitKeepAspectRatio;
635 return VisualFittingModeType.Fill;
640 return (VisualFittingModeType)_visualFittingMode;
645 _visualFittingMode = value;
652 /// A class encapsulating the property map of the image visual.
654 /// <since_tizen> 3 </since_tizen>
655 public class ImageVisual : VisualMap
660 /// <since_tizen> 3 </since_tizen>
661 public ImageVisual() : base()
665 private string _url = null;
666 private string _alphaMaskUrl = null;
667 private string _auxiliaryImageUrl = null;
668 private FittingModeType? _fittingMode = null;
669 private SamplingModeType? _samplingMode = null;
670 private int? _desiredWidth = null;
671 private int? _desiredHeight = null;
672 private bool? _synchronousLoading = false;
673 private bool? _borderOnly = null;
674 private Vector4 _pixelArea = null;
675 private WrapModeType? _wrapModeU = null;
676 private WrapModeType? _wrapModeV = null;
677 private float? _auxiliaryImageAlpha = null;
678 private float? _maskContentScale = null;
679 private bool? _cropToMask = null;
680 private ReleasePolicyType? _releasePolicy = null;
681 private LoadPolicyType? _loadPolicy = null;
682 private bool? _orientationCorrection = true;
683 private bool? _atlasing = false;
686 /// Gets or sets the URL of the image.<br />
689 /// <since_tizen> 3 </since_tizen>
705 /// Gets or sets the URL of the alpha mask.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public string AlphaMaskURL
713 return _alphaMaskUrl;
717 _alphaMaskUrl = value;
723 /// Overlays the auxiliary image on top of an NPatch image.
724 /// The resulting visual image will be at least as large as the smallest possible n-patch or the auxiliary image, whichever is larger.
726 /// <since_tizen> 5 </since_tizen>
727 public string AuxiliaryImageURL
731 return _auxiliaryImageUrl;
735 _auxiliaryImageUrl = value;
741 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
742 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
743 /// For normal quad images only.<br />
746 /// <since_tizen> 3 </since_tizen>
747 public FittingModeType FittingMode
751 return _fittingMode ?? (FittingModeType.ShrinkToFit);
755 _fittingMode = value;
761 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
762 /// If not supplied, the default is SamplingModeType.Box.<br />
763 /// For normal quad images only.<br />
766 /// <since_tizen> 3 </since_tizen>
767 public SamplingModeType SamplingMode
771 return _samplingMode ?? (SamplingModeType.Box);
775 _samplingMode = value;
781 /// Gets or sets the desired image width.<br />
782 /// If not specified, the actual image width is used.<br />
783 /// For normal quad images only.<br />
786 /// <since_tizen> 3 </since_tizen>
787 public int DesiredWidth
791 return _desiredWidth ?? (-1);
795 _desiredWidth = value;
801 /// Gets or sets the desired image height.<br />
802 /// If not specified, the actual image height is used.<br />
803 /// For normal quad images only.<br />
806 /// <since_tizen> 3 </since_tizen>
807 public int DesiredHeight
811 return _desiredHeight ?? (-1);
815 _desiredHeight = value;
821 /// Gets or sets whether to load the image synchronously.<br />
822 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
823 /// For normal quad images only.<br />
826 /// <since_tizen> 3 </since_tizen>
827 public bool SynchronousLoading
831 return _synchronousLoading ?? (false);
835 _synchronousLoading = value;
841 /// Gets or sets whether to draw the borders only (If true).<br />
842 /// If not specified, the default is false.<br />
843 /// For n-patch images only.<br />
846 /// <since_tizen> 3 </since_tizen>
847 public bool BorderOnly
851 return _borderOnly ?? (false);
861 /// Gets or sets the image area to be displayed.<br />
862 /// It is a rectangular area.<br />
863 /// 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 />
864 /// 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 />
865 /// For normal quad images only.<br />
868 /// <since_tizen> 3 </since_tizen>
869 public Vector4 PixelArea
873 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
883 /// Gets or sets the wrap mode for the u coordinate.<br />
884 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
885 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
886 /// For normal quad images only.<br />
889 /// <since_tizen> 3 </since_tizen>
890 public WrapModeType WrapModeU
894 return _wrapModeU ?? (WrapModeType.Default);
904 /// Gets or sets the wrap mode for the v coordinate.<br />
905 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
906 /// 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 />
907 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
908 /// For normal quad images only.
911 /// <since_tizen> 3 </since_tizen>
912 public WrapModeType WrapModeV
916 return _wrapModeV ?? (WrapModeType.Default);
926 /// Gets or sets scale factor to apply to the content image before masking.
928 /// <since_tizen> 4 </since_tizen>
929 public float MaskContentScale
933 return _maskContentScale ?? 1.0f;
937 _maskContentScale = value;
943 /// Whether to crop image to mask or scale mask to fit image.
945 /// <since_tizen> 4 </since_tizen>
946 public bool CropToMask
950 return _cropToMask ?? false;
960 /// An alpha value for mixing between the masked main NPatch image and the auxiliary image.
962 /// <since_tizen> 5 </since_tizen>
963 public float AuxiliaryImageAlpha
967 return _auxiliaryImageAlpha ?? 1.0f;
971 _auxiliaryImageAlpha = value;
977 /// Gets or sets the Image Visual release policy.<br/>
978 /// It decides if a texture should be released from the cache or kept to reduce the loading time.<br/>
980 /// <since_tizen> 5 </since_tizen>
981 public ReleasePolicyType ReleasePolicy
985 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
989 _releasePolicy = value;
996 /// Gets or sets the Image Visual image loading policy.<br />
997 /// It decides if a texture should be loaded immediately after source set or only after the visual is added to the window.<br />
999 /// <since_tizen> 5 </since_tizen>
1000 public LoadPolicyType LoadPolicy
1004 return _loadPolicy ?? (LoadPolicyType.Attached);
1008 _loadPolicy = value;
1014 /// Gets or sets whether to automatically correct the orientation based on the Exchangeable Image File (EXIF) data.<br />
1015 /// If not specified, the default is true.<br />
1016 /// For JPEG images only.<br />
1019 /// <since_tizen> 5 </since_tizen>
1020 public bool OrientationCorrection
1024 return _orientationCorrection ?? (true);
1028 _orientationCorrection = value;
1034 /// Whether to use the texture atlas or not.
1035 /// Optional. By default atlasing is off.
1037 /// <since_tizen> 5 </since_tizen>
1038 public bool Atlasing
1042 return _atlasing ?? (false);
1052 /// Compose the out visual map.
1054 /// <since_tizen> 3 </since_tizen>
1055 protected override void ComposingPropertyMap()
1059 _outputVisualMap = new PropertyMap();
1060 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
1061 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1062 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
1063 if (_auxiliaryImageUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(_auxiliaryImageUrl)); }
1064 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
1065 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
1066 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
1067 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
1068 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
1069 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1070 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
1071 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
1072 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
1073 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1074 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1075 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1076 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1077 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
1078 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
1079 if (_auxiliaryImageAlpha != null) { _outputVisualMap.Add((int)ImageVisualProperty.AuxiliaryImageAlpha, new PropertyValue((float)_auxiliaryImageAlpha)); }
1080 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
1081 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
1082 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
1083 if (_atlasing != null) { _outputVisualMap.Add( ImageVisualProperty.Atlasing, new PropertyValue((bool)_atlasing)); }
1084 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1090 /// A class encapsulating the property map of the text visual.
1092 /// <since_tizen> 3 </since_tizen>
1093 public class TextVisual : VisualMap
1098 /// <since_tizen> 3 </since_tizen>
1099 public TextVisual() : base()
1103 private string _text = null;
1104 private string _fontFamily = null;
1105 private PropertyMap _fontStyle = null;
1106 private float? _pointSize = null;
1107 private bool? _multiLine = null;
1108 private string _horizontalAlignment = null;
1109 private string _verticalAlignment = null;
1110 private Color _textColor = null;
1111 private bool? _enableMarkup = null;
1112 private PropertyMap _shadow = null;
1113 private PropertyMap _underline = null;
1114 private PropertyMap _outline = null;
1115 private PropertyMap _background = null;
1118 /// Gets or sets the text to display in the UTF-8 format.<br />
1121 /// <since_tizen> 3 </since_tizen>
1136 /// Gets or sets the requested font family to use.<br />
1139 /// <since_tizen> 3 </since_tizen>
1140 public string FontFamily
1148 _fontFamily = value;
1154 /// Gets or sets the requested font style to use.<br />
1157 /// <since_tizen> 3 </since_tizen>
1158 public PropertyMap FontStyle
1172 /// Gets or sets the size of font in points.<br />
1175 /// <since_tizen> 3 </since_tizen>
1176 public float PointSize
1180 return _pointSize ?? (0.0f);
1190 /// Gets or sets the single-line or multi-line layout option.<br />
1191 /// If not specified, the default is false.<br />
1194 /// <since_tizen> 3 </since_tizen>
1195 public bool MultiLine
1199 return _multiLine ?? (false);
1209 /// Gets or sets the line horizontal alignment.<br />
1210 /// If not specified, the default is begin.<br />
1213 /// <since_tizen> 3 </since_tizen>
1214 public HorizontalAlignment HorizontalAlignment
1218 switch (_horizontalAlignment)
1221 return HorizontalAlignment.Begin;
1223 return HorizontalAlignment.Center;
1225 return HorizontalAlignment.End;
1227 return HorizontalAlignment.Begin;
1234 case HorizontalAlignment.Begin:
1236 _horizontalAlignment = "BEGIN";
1239 case HorizontalAlignment.Center:
1241 _horizontalAlignment = "CENTER";
1244 case HorizontalAlignment.End:
1246 _horizontalAlignment = "END";
1251 _horizontalAlignment = "BEGIN";
1260 /// Gets or sets the line vertical alignment.<br />
1261 /// If not specified, the default is top.<br />
1264 /// <since_tizen> 3 </since_tizen>
1265 public VerticalAlignment VerticalAlignment
1269 switch (_verticalAlignment)
1272 return VerticalAlignment.Top;
1274 return VerticalAlignment.Center;
1276 return VerticalAlignment.Bottom;
1278 return VerticalAlignment.Top;
1285 case VerticalAlignment.Top:
1287 _verticalAlignment = "TOP";
1290 case VerticalAlignment.Center:
1292 _verticalAlignment = "CENTER";
1295 case VerticalAlignment.Bottom:
1297 _verticalAlignment = "BOTTOM";
1302 _verticalAlignment = "TOP";
1311 /// Gets or sets the color of the text.<br />
1314 /// <since_tizen> 3 </since_tizen>
1315 public Color TextColor
1329 /// Gets or sets whether the mark-up processing is enabled.<br />
1332 /// <since_tizen> 3 </since_tizen>
1333 public bool EnableMarkup
1337 return _enableMarkup ?? (false);
1341 _enableMarkup = value;
1347 /// Gets or sets the shadow parameters.
1349 /// <since_tizen> 5 </since_tizen>
1350 public PropertyMap Shadow
1364 /// Gets or sets the underline parameters.
1366 /// <since_tizen> 5 </since_tizen>
1367 public PropertyMap Underline
1381 /// Gets or sets the outline parameters.
1383 /// <since_tizen> 5 </since_tizen>
1384 public PropertyMap Outline
1398 /// Gets or sets the background parameters.
1400 /// <since_tizen> 5 </since_tizen>
1401 public PropertyMap Background
1409 _background = value;
1415 /// Compose the out visual map.
1417 /// <since_tizen> 3 </since_tizen>
1418 protected override void ComposingPropertyMap()
1420 if (_text != null && _pointSize != null)
1422 _outputVisualMap = new PropertyMap();
1423 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1424 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1425 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1426 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1427 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1428 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1429 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1430 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1431 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1432 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1433 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1434 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1435 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1436 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1437 if (_shadow != null) { _outputVisualMap.Add(TextVisualProperty.Shadow, new PropertyValue(_shadow)); }
1438 if (_underline != null) { _outputVisualMap.Add(TextVisualProperty.Underline, new PropertyValue(_underline)); }
1439 if (_outline != null) { _outputVisualMap.Add(TextVisualProperty.Outline, new PropertyValue(_outline)); }
1440 if (_background != null) { _outputVisualMap.Add(TextVisualProperty.Background, new PropertyValue(_background)); }
1441 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1447 /// A class encapsulating the property map of the border visual.
1449 /// <since_tizen> 3 </since_tizen>
1450 public class BorderVisual : VisualMap
1455 /// <since_tizen> 3 </since_tizen>
1456 public BorderVisual() : base()
1460 private Color _color = null;
1461 private float? _size = null;
1462 private bool? _antiAliasing = null;
1465 /// Gets or sets the color of the border.<br />
1468 /// <since_tizen> 3 </since_tizen>
1483 /// Gets or sets the width of the border (in pixels).<br />
1486 /// <since_tizen> 3 </since_tizen>
1487 public float BorderSize
1491 return _size ?? (-1.0f);
1501 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1502 /// If not supplied, the default is false.<br />
1505 /// <since_tizen> 3 </since_tizen>
1506 public bool AntiAliasing
1510 return _antiAliasing ?? (false);
1514 _antiAliasing = value;
1520 /// Compose the out visual map.
1522 /// <since_tizen> 3 </since_tizen>
1523 protected override void ComposingPropertyMap()
1525 if (_color != null && _size != null)
1527 _outputVisualMap = new PropertyMap();
1528 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1529 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1530 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1531 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1532 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1533 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1534 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1535 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1536 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1542 /// A class encapsulating the property map of the color visual.
1544 /// <since_tizen> 3 </since_tizen>
1545 public class ColorVisual : VisualMap
1550 /// <since_tizen> 3 </since_tizen>
1551 public ColorVisual() : base()
1555 private Color _mixColorForColorVisual = null;
1556 private bool? _renderIfTransparent = false;
1559 /// Gets or sets the solid color required.<br />
1562 /// <since_tizen> 3 </since_tizen>
1567 return _mixColorForColorVisual;
1571 _mixColorForColorVisual = value;
1577 /// Gets or sets whether to render if the MixColor is transparent.
1578 /// By default it is false, which means that the ColorVisual will not render if the MIX_COLOR is transparent.
1580 /// <since_tizen> 5 </since_tizen>
1581 public bool RenderIfTransparent
1585 return _renderIfTransparent ?? (false);
1589 _renderIfTransparent = value;
1595 /// Compose the out visual map.
1597 /// <since_tizen> 3 </since_tizen>
1598 protected override void ComposingPropertyMap()
1600 if (_mixColorForColorVisual != null)
1602 _outputVisualMap = new PropertyMap();
1603 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1604 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1605 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1606 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1607 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1608 if (_renderIfTransparent != null) { _outputVisualMap.Add(ColorVisualProperty.RenderIfTransparent, new PropertyValue((bool)_renderIfTransparent)); }
1609 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1615 /// A class encapsulating the property map of the gradient visual.
1617 /// <since_tizen> 3 </since_tizen>
1618 public class GradientVisual : VisualMap
1623 /// <since_tizen> 3 </since_tizen>
1624 public GradientVisual() : base()
1628 private Vector2 _startPosition = null;
1629 private Vector2 _endPosition = null;
1630 private Vector2 _center = null;
1631 private float? _radius = null;
1632 private PropertyArray _stopOffset = null;
1633 private PropertyArray _stopColor = null;
1634 private GradientVisualUnitsType? _units = null;
1635 private GradientVisualSpreadMethodType? _spreadMethod = null;
1638 /// Gets or sets the start position of a linear gradient.<br />
1639 /// Mandatory for linear.<br />
1641 /// <since_tizen> 3 </since_tizen>
1642 public Vector2 StartPosition
1646 return _startPosition;
1650 _startPosition = value;
1656 /// Gets or sets the end position of a linear gradient.<br />
1657 /// Mandatory for linear.<br />
1659 /// <since_tizen> 3 </since_tizen>
1660 public Vector2 EndPosition
1664 return _endPosition;
1668 _endPosition = value;
1674 /// Gets or sets the center point of a radial gradient.<br />
1675 /// Mandatory for radial.<br />
1677 /// <since_tizen> 3 </since_tizen>
1678 public Vector2 Center
1692 /// Gets or sets the size of the radius of a radial gradient.<br />
1693 /// Mandatory for radial.<br />
1695 /// <since_tizen> 3 </since_tizen>
1700 return _radius ?? (-1.0f);
1710 /// Gets or sets all the stop offsets.<br />
1711 /// A PropertyArray of float.<br />
1712 /// If not supplied, the default is 0.0f and 1.0f.<br />
1715 /// <since_tizen> 3 </since_tizen>
1716 public PropertyArray StopOffset
1724 _stopOffset = value;
1730 /// Gets or sets the color at the stop offsets.<br />
1731 /// A PropertyArray of color.<br />
1732 /// At least 2 values are required to show a gradient.<br />
1735 /// <since_tizen> 3 </since_tizen>
1736 public PropertyArray StopColor
1750 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1751 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1754 /// <since_tizen> 3 </since_tizen>
1755 public GradientVisualUnitsType Units
1759 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1769 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1770 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1773 /// <since_tizen> 3 </since_tizen>
1774 public GradientVisualSpreadMethodType SpreadMethod
1778 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1782 _spreadMethod = value;
1788 /// Compose the out visual map.
1790 /// <since_tizen> 3 </since_tizen>
1791 protected override void ComposingPropertyMap()
1793 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1795 _outputVisualMap = new PropertyMap();
1796 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1797 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1798 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1799 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1800 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1801 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1802 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1803 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1804 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1805 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1806 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1807 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1808 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1809 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1815 /// A class encapsulating the property map of the mesh visual.
1817 /// <since_tizen> 3 </since_tizen>
1818 public class MeshVisual : VisualMap
1823 /// <since_tizen> 3 </since_tizen>
1824 public MeshVisual() : base()
1828 private string _objectURL = null;
1829 private string _materialtURL = null;
1830 private string _texturesPath = null;
1831 private MeshVisualShadingModeValue? _shadingMode = null;
1832 private bool? _useMipmapping = null;
1833 private bool? _useSoftNormals = null;
1834 private Vector3 _lightPosition = null;
1837 /// Gets or sets the location of the ".obj" file.<br />
1840 /// <since_tizen> 3 </since_tizen>
1841 public string ObjectURL
1855 /// Gets or sets the location of the ".mtl" file.<br />
1856 /// If not specified, then a textureless object is assumed.<br />
1859 /// <since_tizen> 3 </since_tizen>
1860 public string MaterialtURL
1864 return _materialtURL;
1868 _materialtURL = value;
1874 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1875 /// Mandatory if using material.<br />
1877 /// <since_tizen> 3 </since_tizen>
1878 public string TexturesPath
1882 return _texturesPath;
1886 _texturesPath = value;
1892 /// Gets or sets the type of shading mode that the mesh will use.<br />
1893 /// 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 />
1894 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1897 /// <since_tizen> 3 </since_tizen>
1898 public MeshVisualShadingModeValue ShadingMode
1902 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1906 _shadingMode = value;
1912 /// Gets or sets whether to use mipmaps for textures or not.<br />
1913 /// If not specified, the default is true.<br />
1916 /// <since_tizen> 3 </since_tizen>
1917 public bool UseMipmapping
1921 return _useMipmapping ?? (true);
1925 _useMipmapping = value;
1931 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1932 /// If not specified, the default is true.<br />
1935 /// <since_tizen> 3 </since_tizen>
1936 public bool UseSoftNormals
1940 return _useSoftNormals ?? (true);
1944 _useSoftNormals = value;
1950 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1951 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1952 /// and using all zeroes will place the light at the top-left corner.<br />
1953 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1956 /// <since_tizen> 3 </since_tizen>
1957 public Vector3 LightPosition
1961 return _lightPosition;
1965 _lightPosition = value;
1971 /// Compose the out visual map.
1973 /// <since_tizen> 3 </since_tizen>
1974 protected override void ComposingPropertyMap()
1976 if (_objectURL != null)
1978 _outputVisualMap = new PropertyMap();
1979 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1980 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1981 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1982 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1983 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1984 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1985 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1986 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1987 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1988 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1989 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1990 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1996 /// A class encapsulating the property map of the primetive visual.
1998 /// <since_tizen> 3 </since_tizen>
1999 public class PrimitiveVisual : VisualMap
2004 /// <since_tizen> 3 </since_tizen>
2005 public PrimitiveVisual() : base()
2009 private PrimitiveVisualShapeType? _shape = null;
2010 private Color _mixColorForPrimitiveVisual = null;
2011 private int? _slices = null;
2012 private int? _stacks = null;
2013 private float? _scaleTopRadius = null;
2014 private float? _scaleBottomRadius = null;
2015 private float? _scaleHeight = null;
2016 private float? _scaleRadius = null;
2017 private Vector3 _scaleDimensions = null;
2018 private float? _bevelPercentage = null;
2019 private float? _bevelSmoothness = null;
2020 private Vector3 _lightPosition = null;
2023 /// Gets or sets the specific shape to render.<br />
2024 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
2027 /// <since_tizen> 3 </since_tizen>
2028 public PrimitiveVisualShapeType Shape
2032 return _shape ?? (PrimitiveVisualShapeType.Sphere);
2042 /// Gets or sets the color of the shape.<br />
2043 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
2044 /// Applies to all shapes.<br />
2047 /// <since_tizen> 3 </since_tizen>
2048 public new Color MixColor
2052 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
2056 _mixColorForPrimitiveVisual = value;
2062 /// Gets or sets the number of slices as you go around the shape.<br />
2063 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
2064 /// If not specified, the default is 128.<br />
2065 /// The range is from 1 to 255.<br />
2068 /// <since_tizen> 3 </since_tizen>
2073 return _slices ?? (128);
2083 /// Gets or sets the number of stacks as you go down the shape.<br />
2084 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
2085 /// If not specified, the default is 128.<br />
2086 /// The range is from 1 to 255.<br />
2089 /// <since_tizen> 3 </since_tizen>
2094 return _stacks ?? (128);
2104 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
2105 /// If not specified, the default is 1.0f.<br />
2106 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2107 /// Only values greater than or equal to 0.0f are accepted.<br />
2110 /// <since_tizen> 3 </since_tizen>
2111 public float ScaleTopRadius
2115 return _scaleTopRadius ?? (1.0f);
2119 _scaleTopRadius = value;
2125 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
2126 /// If not specified, the default is 1.5f.<br />
2127 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2128 /// - PrimitiveVisualShapeType.Cone<br />
2129 /// Only values greater than or equal to 0.0f are accepted.<br />
2132 /// <since_tizen> 3 </since_tizen>
2133 public float ScaleBottomRadius
2137 return _scaleBottomRadius ?? (1.5f);
2141 _scaleBottomRadius = value;
2147 /// Gets or sets the scale of the height of a conic.<br />
2148 /// If not specified, the default is 3.0f.<br />
2149 /// Applies to:<br />
2150 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
2151 /// - PrimitiveVisualShapeType.Cone<br />
2152 /// - PrimitiveVisualShapeType.Cylinder<br />
2153 /// Only values greater than or equal to 0.0f are accepted.<br />
2156 /// <since_tizen> 3 </since_tizen>
2157 public float ScaleHeight
2161 return _scaleHeight ?? (3.0f);
2165 _scaleHeight = value;
2171 /// Gets or sets the scale of the radius of a cylinder.<br />
2172 /// If not specified, the default is 1.0f.<br />
2173 /// Applies to:<br />
2174 /// - PrimitiveVisualShapeType.Cylinder<br />
2175 /// Only values greater than or equal to 0.0f are accepted.<br />
2178 /// <since_tizen> 3 </since_tizen>
2179 public float ScaleRadius
2183 return _scaleRadius ?? (1.0f);
2187 _scaleRadius = value;
2193 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
2194 /// If not specified, the default is Vector3.One.<br />
2195 /// Applies to:<br />
2196 /// - PrimitiveVisualShapeType.Cube<br />
2197 /// - PrimitiveVisualShapeType.Octahedron<br />
2198 /// - PrimitiveVisualShapeType.BevelledCube<br />
2199 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2202 /// <since_tizen> 3 </since_tizen>
2203 public Vector3 ScaleDimensions
2207 return _scaleDimensions ?? (Vector3.One);
2211 _scaleDimensions = value;
2217 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2218 /// 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 />
2219 /// If not specified, the default is 0.0f (no bevel).<br />
2220 /// Applies to:<br />
2221 /// - PrimitiveVisualShapeType.BevelledCube<br />
2222 /// The range is from 0.0f to 1.0f.<br />
2225 /// <since_tizen> 3 </since_tizen>
2226 public float BevelPercentage
2230 return _bevelPercentage ?? (0.0f);
2234 _bevelPercentage = value;
2240 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2241 /// If not specified, the default is 0.0f (sharp edges).<br />
2242 /// Applies to:<br />
2243 /// - PrimitiveVisualShapeType.BevelledCube<br />
2244 /// The range is from 0.0f to 1.0f.<br />
2247 /// <since_tizen> 3 </since_tizen>
2248 public float BevelSmoothness
2252 return _bevelSmoothness ?? (0.0f);
2256 _bevelSmoothness = value;
2262 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2263 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2264 /// and using all zeroes will place the light at the top-left corner.<br />
2265 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2266 /// Applies to all shapes.<br />
2269 /// <since_tizen> 3 </since_tizen>
2270 public Vector3 LightPosition
2274 return _lightPosition;
2278 _lightPosition = value;
2284 /// Compose the out visual map.
2286 /// <since_tizen> 3 </since_tizen>
2287 protected override void ComposingPropertyMap()
2289 _outputVisualMap = new PropertyMap(); ;
2290 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2291 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2292 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2293 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2294 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2295 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2296 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2297 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2298 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2299 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2300 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2301 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2302 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2303 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2304 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2305 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2306 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2311 /// A class encapsulating the property map of the n-patch image visual.
2313 /// <since_tizen> 3 </since_tizen>
2314 public class NPatchVisual : VisualMap
2319 /// <since_tizen> 3 </since_tizen>
2320 public NPatchVisual() : base()
2324 private string _url = null;
2325 private bool? _borderOnly = null;
2326 private Rectangle _border = null;
2329 /// Gets or sets the URL of the image.<br />
2332 /// <since_tizen> 3 </since_tizen>
2347 /// Gets or sets whether to draw the borders only (If true).<br />
2348 /// If not specified, the default is false.<br />
2349 /// For n-patch images only.<br />
2352 /// <since_tizen> 3 </since_tizen>
2353 public bool BorderOnly
2357 return _borderOnly ?? false;
2361 _borderOnly = value;
2367 /// The border of the image is in the order: left, right, bottom, top.<br />
2368 /// For n-patch images only.<br />
2371 /// <since_tizen> 3 </since_tizen>
2372 public Rectangle Border
2386 /// Compose the out visual map.
2388 /// <since_tizen> 3 </since_tizen>
2389 protected override void ComposingPropertyMap()
2393 _outputVisualMap = new PropertyMap();
2394 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2395 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2396 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2397 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2398 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2399 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2400 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2401 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2402 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2408 /// A class encapsulating the property map of the SVG visual.
2410 /// <since_tizen> 3 </since_tizen>
2411 public class SVGVisual : VisualMap
2416 /// <since_tizen> 3 </since_tizen>
2417 public SVGVisual() : base()
2421 private string _url = null;
2424 /// The url of the svg resource.
2426 /// <since_tizen> 3 </since_tizen>
2441 /// Compose the out visual map.
2443 /// <since_tizen> 3 </since_tizen>
2444 protected override void ComposingPropertyMap()
2448 _outputVisualMap = new PropertyMap();
2449 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2450 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2451 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2452 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2453 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2454 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2455 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2461 /// A class encapsulating the property map of the animated image (AGIF) visual.
2463 /// <since_tizen> 3 </since_tizen>
2464 public class AnimatedImageVisual : VisualMap
2469 /// <since_tizen> 3 </since_tizen>
2470 public AnimatedImageVisual() : base()
2474 private List<string> _urls = null;
2475 private int? _batchSize = null;
2476 private int? _cacheSize = null;
2477 private float? _frameDelay = null;
2478 private float? _loopCount = null;
2481 /// Gets and Sets the url in the AnimatedImageVisual.
2483 /// <since_tizen> 3 </since_tizen>
2501 _urls = new List<string>();
2513 /// Gets and Sets the url list in the AnimatedImageVisual.
2515 /// <since_tizen> 4 </since_tizen>
2516 public List<string> URLS
2530 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2532 /// <since_tizen> 4 </since_tizen>
2533 public int BatchSize
2537 return _batchSize ?? 1;
2547 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2549 /// <since_tizen> 4 </since_tizen>
2550 public int CacheSize
2554 return _cacheSize ?? 1;
2564 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2566 /// <since_tizen> 4 </since_tizen>
2567 public float FrameDelay
2571 return _frameDelay ?? 0.1f;
2575 _frameDelay = value;
2581 /// Gets and sets the number of times the AnimatedImageVisual will be looped.
2582 /// The default is -1. If the number is less than 0 then it loops unlimited,otherwise loop loopCount times.
2584 /// <since_tizen> 5 </since_tizen>
2585 public float LoopCount
2589 return _loopCount ?? -1;
2599 /// Compose the out visual map.
2601 /// <since_tizen> 3 </since_tizen>
2602 protected override void ComposingPropertyMap()
2606 _outputVisualMap = new PropertyMap();
2607 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2608 if( _urls.Count == 1 )
2610 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2614 var urlArray = new PropertyArray();
2615 foreach( var url in _urls)
2617 urlArray.Add(new PropertyValue(url));
2619 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2621 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2622 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2623 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2624 if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
2625 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2626 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2627 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2628 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2629 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2635 //temporary fix for TCT
2637 /// A class encapsulating the property map of the transition data.
2639 /// <since_tizen> 3 </since_tizen>
2640 public class VisualAnimator : VisualMap
2643 /// Create VisualAnimator object.
2645 /// <since_tizen> 3 </since_tizen>
2646 public VisualAnimator() : base()
2650 private string _alphaFunction = null;
2651 private int _startTime = 0;
2652 private int _endTime = 0;
2653 private string _target = null;
2654 private string _propertyIndex = null;
2655 private object _destinationValue = null;
2658 /// Sets and Gets the AlphaFunction of this transition.
2660 /// <since_tizen> 3 </since_tizen>
2661 public AlphaFunction.BuiltinFunctions AlphaFunction
2665 switch (_alphaFunction)
2668 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2670 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2671 case "EASE_IN_SQUARE":
2672 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2673 case "EASE_OUT_SQUARE":
2674 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2676 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2678 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2680 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2681 case "EASE_IN_SINE":
2682 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2683 case "EASE_OUT_SINE":
2684 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2685 case "EASE_IN_OUT_SINE":
2686 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2688 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2690 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2691 case "EASE_OUT_BACK":
2692 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2694 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2701 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2703 _alphaFunction = "LINEAR";
2706 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2708 _alphaFunction = "REVERSE";
2711 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2713 _alphaFunction = "EASE_IN_SQUARE";
2716 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2718 _alphaFunction = "EASE_OUT_SQUARE";
2721 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2723 _alphaFunction = "EASE_IN";
2726 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2728 _alphaFunction = "EASE_OUT";
2731 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2733 _alphaFunction = "EASE_IN_OUT";
2736 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2738 _alphaFunction = "EASE_IN_SINE";
2741 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2743 _alphaFunction = "EASE_OUT_SINE";
2746 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2748 _alphaFunction = "EASE_IN_OUT_SINE";
2751 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2753 _alphaFunction = "BOUNCE";
2756 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2758 _alphaFunction = "SIN";
2761 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2763 _alphaFunction = "EASE_OUT_BACK";
2768 _alphaFunction = "DEFAULT";
2776 /// Sets and Gets the StartTime of this transition.
2778 /// <since_tizen> 3 </since_tizen>
2779 public int StartTime
2792 /// Sets and Gets the EndTime of this transition.
2794 /// <since_tizen> 3 </since_tizen>
2808 /// Sets and Gets the Target of this transition.
2810 /// <since_tizen> 3 </since_tizen>
2811 public string Target
2824 /// Sets and Gets the PropertyIndex of this transition.
2826 /// <since_tizen> 3 </since_tizen>
2827 public string PropertyIndex
2831 return _propertyIndex;
2835 _propertyIndex = value;
2840 /// Sets and Gets the DestinationValue of this transition.
2842 /// <since_tizen> 3 </since_tizen>
2843 public object DestinationValue
2847 return _destinationValue;
2851 _destinationValue = value;
2856 /// Compose the out visual map.
2858 /// <since_tizen> 3 </since_tizen>
2859 protected override void ComposingPropertyMap()
2861 PropertyMap _animator = new PropertyMap();
2862 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2864 PropertyMap _timePeriod = new PropertyMap();
2865 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2866 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2867 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2869 StringBuilder sb = new StringBuilder(_propertyIndex);
2870 sb[0] = (char)(sb[0] | 0x20);
2871 string _str = sb.ToString();
2873 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2875 PropertyMap _transition = new PropertyMap();
2876 _transition.Add("target", new PropertyValue(_target));
2877 _transition.Add("property", new PropertyValue(_str));
2878 _transition.Add("targetValue", val);
2879 _transition.Add("animator", new PropertyValue(_animator));
2881 _outputVisualMap = _transition;
2884 //temporary fix for TCT