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
33 /// <since_tizen> 3 </since_tizen>
34 protected PropertyMap _outputVisualMap = null;
37 /// The shader of the visual.
39 /// <since_tizen> 3 </since_tizen>
40 protected PropertyMap _shader = null;
41 //private PropertyMap _transform = null;
44 /// The premultipliedAlpha of the visual.
46 /// <since_tizen> 3 </since_tizen>
47 protected bool? _premultipliedAlpha = null;
50 /// The mixColor of the Visual.
52 /// <since_tizen> 3 </since_tizen>
53 protected Color _mixColor = null;
56 /// The opacity of the visual.
58 /// <since_tizen> 3 </since_tizen>
59 protected float? _opacity = null;
62 /// The FittingMode of the visual.
64 /// <since_tizen> 5 </since_tizen>
65 protected VisualFittingModeType? _visualFittingMode = null;
68 /// The map for visual.
70 /// <since_tizen> 3 </since_tizen>
71 protected PropertyMap _commonlyUsedMap = null;
73 private Vector2 _visualSize = null;
74 private Vector2 _visualOffset = null;
75 private Vector2 _visualOffsetPolicy = null;
76 private Vector2 _visualSizePolicy = null;
77 private Visual.AlignType? _visualOrigin = null;
78 private Visual.AlignType? _visualAnchorPoint = null;
80 private PropertyMap _visualTransformMap = null;
82 private int? _depthIndex = null;
87 /// <since_tizen> 3 </since_tizen>
93 /// Gets or sets the size of the visual.<br />
94 /// It can be either relative (percentage of the parent)
95 /// or absolute (in world units).<br />
98 /// <since_tizen> 3 </since_tizen>
103 return _visualSize ?? (new Size2D(1, 1));
108 if (_visualSizePolicy == null)
110 _visualSizePolicy = new Vector2(1.0f, 1.0f);
117 /// Gets or sets the offset of the visual.<br />
118 /// It can be either relative (percentage of the parent)
119 /// or absolute (in world units).<br />
122 /// <since_tizen> 3 </since_tizen>
123 public Vector2 Position
127 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
131 _visualOffset = value;
132 if (_visualOffsetPolicy == null)
134 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
141 /// Gets or sets the relative size of the visual<br />
142 /// (percentage [0.0f to 1.0f] of the control).<br />
145 /// <since_tizen> 3 </since_tizen>
146 public RelativeVector2 RelativeSize
150 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
155 _visualSizePolicy = new Vector2(0.0f, 0.0f);
161 /// Gets or sets the relative offset of the visual<br />
162 /// (percentage [0.0f to 1.0f] of the control).<br />
165 /// <since_tizen> 3 </since_tizen>
166 public RelativeVector2 RelativePosition
170 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
174 _visualOffset = value;
175 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
181 /// Gets or sets whether the x and y offset values are relative<br />
182 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
183 /// By default, both the x and the y offset are relative.<br />
186 /// <since_tizen> 3 </since_tizen>
187 public VisualTransformPolicyType PositionPolicy
191 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
192 && _visualOffsetPolicy.Y == 1.0f)
194 return VisualTransformPolicyType.Absolute;
196 return VisualTransformPolicyType.Relative;
202 case VisualTransformPolicyType.Relative:
203 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
205 case VisualTransformPolicyType.Absolute:
206 _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
209 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
217 /// Gets or sets whether the x offset values are relative<br />
218 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
219 /// By default, the x offset is relative.<br />
222 /// <since_tizen> 3 </since_tizen>
223 public VisualTransformPolicyType PositionPolicyX
227 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
229 return VisualTransformPolicyType.Absolute;
231 return VisualTransformPolicyType.Relative;
235 if (_visualOffsetPolicy == null)
237 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
242 case VisualTransformPolicyType.Relative:
243 _visualOffsetPolicy.X = 0.0f;
245 case VisualTransformPolicyType.Absolute:
246 _visualOffsetPolicy.X = 1.0f;
249 _visualOffsetPolicy.X = 0.0f;
258 /// Gets or sets whether the y offset values are relative<br />
259 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
260 /// By default, the y offset is relative.<br />
263 /// <since_tizen> 3 </since_tizen>
264 public VisualTransformPolicyType PositionPolicyY
268 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
270 return VisualTransformPolicyType.Absolute;
272 return VisualTransformPolicyType.Relative;
276 if (_visualOffsetPolicy == null)
278 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
283 case VisualTransformPolicyType.Relative:
284 _visualOffsetPolicy.Y = 0.0f;
286 case VisualTransformPolicyType.Absolute:
287 _visualOffsetPolicy.Y = 1.0f;
290 _visualOffsetPolicy.Y = 0.0f;
298 /// Gets or sets whether the size values of the width or the height are relative<br />
299 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
300 /// By default, offsets of both the width and the height are relative to the control's size.<br />
303 /// <since_tizen> 3 </since_tizen>
304 public VisualTransformPolicyType SizePolicy
308 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
309 && _visualSizePolicy.Y == 1.0f)
311 return VisualTransformPolicyType.Absolute;
313 return VisualTransformPolicyType.Relative;
319 case VisualTransformPolicyType.Relative:
320 _visualSizePolicy = new Vector2(0.0f, 0.0f);
322 case VisualTransformPolicyType.Absolute:
323 _visualSizePolicy = new Vector2(1.0f, 1.0f);
326 _visualSizePolicy = new Vector2(0.0f, 0.0f);
334 /// Gets or sets whether size values of the width are relative.<br />
335 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
336 /// By default, the value of the width is relative to the control's width.<br />
339 /// <since_tizen> 3 </since_tizen>
340 public VisualTransformPolicyType SizePolicyWidth
344 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
346 return VisualTransformPolicyType.Absolute;
348 return VisualTransformPolicyType.Relative;
352 if (_visualSizePolicy == null)
354 _visualSizePolicy = new Vector2(0.0f, 0.0f);
359 case VisualTransformPolicyType.Relative:
360 _visualSizePolicy.Width = 0.0f;
362 case VisualTransformPolicyType.Absolute:
363 _visualSizePolicy.Width = 1.0f;
366 _visualSizePolicy.Width = 0.0f;
374 /// Gets or sets whether size values of the height are relative<br />
375 /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
376 /// By default, the height value is relative to the control's height.<br />
379 /// <since_tizen> 3 </since_tizen>
380 public VisualTransformPolicyType SizePolicyHeight
384 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
386 return VisualTransformPolicyType.Absolute;
388 return VisualTransformPolicyType.Relative;
392 if (_visualSizePolicy == null)
394 _visualSizePolicy = new Vector2(0.0f, 0.0f);
399 case VisualTransformPolicyType.Relative:
400 _visualSizePolicy.Height = 0.0f;
402 case VisualTransformPolicyType.Absolute:
403 _visualSizePolicy.Height = 1.0f;
406 _visualSizePolicy.Height = 0.0f;
414 /// Gets or sets the origin of the visual within its control area.<br />
415 /// By default, the origin is center.<br />
418 /// <since_tizen> 3 </since_tizen>
419 public Visual.AlignType Origin
423 return _visualOrigin ?? (Visual.AlignType.Center);
427 _visualOrigin = value;
433 /// Gets or sets the anchor point of the visual.<br />
434 /// By default, the anchor point is center.<br />
437 /// <since_tizen> 3 </since_tizen>
438 public Visual.AlignType AnchorPoint
442 return _visualAnchorPoint ?? (Visual.AlignType.Center);
446 _visualAnchorPoint = value;
452 /// Gets or sets the depth index of the visual.<br />
453 /// By default, the depth index is 0.<br />
456 /// <since_tizen> 3 </since_tizen>
457 public int DepthIndex
461 return _depthIndex ?? (0);
470 /// Gets the transform map used by the visual.
472 /// <since_tizen> 3 </since_tizen>
473 public PropertyMap OutputTransformMap
477 ComposingTransformMap();
478 return _visualTransformMap;
483 /// Gets the property map to create the visual.
485 /// <since_tizen> 3 </since_tizen>
486 public PropertyMap OutputVisualMap
490 ComposingPropertyMap();
491 return _outputVisualMap;
497 /// The shader to use in the visual.
499 /// <since_tizen> 3 </since_tizen>
500 public PropertyMap Shader
514 /// Enables or disables the premultiplied alpha. <br />
515 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
517 /// <since_tizen> 3 </since_tizen>
518 public bool PremultipliedAlpha
522 return _premultipliedAlpha ?? (false);
526 _premultipliedAlpha = value;
532 /// Mix color is a blend color for any visual.
534 /// <since_tizen> 3 </since_tizen>
535 public Color MixColor
549 /// Opacity is the alpha component of the mix color discussed above.
551 /// <since_tizen> 3 </since_tizen>
556 return _opacity ?? (1.0f);
566 /// The fitting mode of the visual.
567 /// The default is defined by the type of visual (if it is suitable to be stretched or not).
569 /// <since_tizen> 5 </since_tizen>
570 public VisualFittingModeType VisualFittingMode
574 if (_visualFittingMode == null)
576 if (this is AnimatedImageVisual ||
577 this is MeshVisual ||
578 this is PrimitiveVisual ||
581 return VisualFittingModeType.FitKeepAspectRatio;
585 return VisualFittingModeType.Fill;
590 return (VisualFittingModeType)_visualFittingMode;
595 _visualFittingMode = value;
606 internal int VisualIndex
612 internal VisualView Parent
618 internal void UpdateVisual()
622 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
623 Parent.UpdateVisual(VisualIndex, Name, this);
627 NUILog.Debug("VisualIndex was not set");
632 /// Compose the out visual map.
634 /// <since_tizen> 3 </since_tizen>
635 protected virtual void ComposingPropertyMap()
637 _outputVisualMap = new PropertyMap();
640 private void ComposingTransformMap()
642 _visualTransformMap = new PropertyMap();
643 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
644 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
645 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
646 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
647 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
648 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
654 /// A class encapsulating the property map of the image visual.
656 /// <since_tizen> 3 </since_tizen>
657 public class ImageVisual : VisualMap
659 private string _url = null;
660 private string _alphaMaskUrl = null;
661 private string _auxiliaryImageUrl = null;
662 private FittingModeType? _fittingMode = null;
663 private SamplingModeType? _samplingMode = null;
664 private int? _desiredWidth = null;
665 private int? _desiredHeight = null;
666 private bool? _synchronousLoading = false;
667 private bool? _borderOnly = null;
668 private Vector4 _pixelArea = null;
669 private WrapModeType? _wrapModeU = null;
670 private WrapModeType? _wrapModeV = null;
671 private float? _auxiliaryImageAlpha = null;
672 private float? _maskContentScale = null;
673 private bool? _cropToMask = null;
674 private ReleasePolicyType? _releasePolicy = null;
675 private LoadPolicyType? _loadPolicy = null;
676 private bool? _orientationCorrection = true;
677 private bool? _atlasing = false;
682 /// <since_tizen> 3 </since_tizen>
683 public ImageVisual() : base()
688 /// Gets or sets the URL of the image.<br />
691 /// <since_tizen> 3 </since_tizen>
700 _url = (value == null ? "" : value);
707 /// Gets or sets the URL of the alpha mask.<br />
710 /// <since_tizen> 3 </since_tizen>
711 public string AlphaMaskURL
715 return _alphaMaskUrl;
719 _alphaMaskUrl = value;
725 /// Overlays the auxiliary image on top of an NPatch image.
726 /// The resulting visual image will be at least as large as the smallest possible n-patch or the auxiliary image, whichever is larger.
728 /// <since_tizen> 5 </since_tizen>
729 public string AuxiliaryImageURL
733 return _auxiliaryImageUrl;
737 _auxiliaryImageUrl = value;
743 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
744 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
745 /// For normal quad images only.<br />
748 /// <since_tizen> 3 </since_tizen>
749 public FittingModeType FittingMode
753 return _fittingMode ?? (FittingModeType.ShrinkToFit);
757 _fittingMode = value;
763 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
764 /// If not supplied, the default is SamplingModeType.Box.<br />
765 /// For normal quad images only.<br />
768 /// <since_tizen> 3 </since_tizen>
769 public SamplingModeType SamplingMode
773 return _samplingMode ?? (SamplingModeType.Box);
777 _samplingMode = value;
783 /// Gets or sets the desired image width.<br />
784 /// If not specified, the actual image width is used.<br />
785 /// For normal quad images only.<br />
788 /// <since_tizen> 3 </since_tizen>
789 public int DesiredWidth
793 return _desiredWidth ?? (-1);
797 _desiredWidth = value;
803 /// Gets or sets the desired image height.<br />
804 /// If not specified, the actual image height is used.<br />
805 /// For normal quad images only.<br />
808 /// <since_tizen> 3 </since_tizen>
809 public int DesiredHeight
813 return _desiredHeight ?? (-1);
817 _desiredHeight = value;
823 /// Gets or sets whether to load the image synchronously.<br />
824 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
825 /// For normal quad images only.<br />
828 /// <since_tizen> 3 </since_tizen>
829 public bool SynchronousLoading
833 return _synchronousLoading ?? (false);
837 _synchronousLoading = value;
843 /// Gets or sets whether to draw the borders only (If true).<br />
844 /// If not specified, the default is false.<br />
845 /// For n-patch images only.<br />
848 /// <since_tizen> 3 </since_tizen>
849 public bool BorderOnly
853 return _borderOnly ?? (false);
863 /// Gets or sets the image area to be displayed.<br />
864 /// It is a rectangular area.<br />
865 /// 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 />
866 /// 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 />
867 /// For normal quad images only.<br />
870 /// <since_tizen> 3 </since_tizen>
871 public Vector4 PixelArea
875 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
885 /// Gets or sets the wrap mode for the u coordinate.<br />
886 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
887 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
888 /// For normal quad images only.<br />
891 /// <since_tizen> 3 </since_tizen>
892 public WrapModeType WrapModeU
896 return _wrapModeU ?? (WrapModeType.Default);
906 /// Gets or sets the wrap mode for the v coordinate.<br />
907 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
908 /// 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 />
909 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
910 /// For normal quad images only.
913 /// <since_tizen> 3 </since_tizen>
914 public WrapModeType WrapModeV
918 return _wrapModeV ?? (WrapModeType.Default);
928 /// Gets or sets scale factor to apply to the content image before masking.
930 /// <since_tizen> 4 </since_tizen>
931 public float MaskContentScale
935 return _maskContentScale ?? 1.0f;
939 _maskContentScale = value;
945 /// Whether to crop image to mask or scale mask to fit image.
947 /// <since_tizen> 4 </since_tizen>
948 public bool CropToMask
952 return _cropToMask ?? false;
962 /// An alpha value for mixing between the masked main NPatch image and the auxiliary image.
964 /// <since_tizen> 5 </since_tizen>
965 public float AuxiliaryImageAlpha
969 return _auxiliaryImageAlpha ?? 1.0f;
973 _auxiliaryImageAlpha = value;
979 /// Gets or sets the Image Visual release policy.<br/>
980 /// It decides if a texture should be released from the cache or kept to reduce the loading time.<br/>
982 /// <since_tizen> 5 </since_tizen>
983 public ReleasePolicyType ReleasePolicy
987 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
991 _releasePolicy = value;
998 /// Gets or sets the Image Visual image loading policy.<br />
999 /// It decides if a texture should be loaded immediately after source set or only after the visual is added to the window.<br />
1001 /// <since_tizen> 5 </since_tizen>
1002 public LoadPolicyType LoadPolicy
1006 return _loadPolicy ?? (LoadPolicyType.Attached);
1010 _loadPolicy = value;
1016 /// Gets or sets whether to automatically correct the orientation based on the Exchangeable Image File (EXIF) data.<br />
1017 /// If not specified, the default is true.<br />
1018 /// For JPEG images only.<br />
1021 /// <since_tizen> 5 </since_tizen>
1022 public bool OrientationCorrection
1026 return _orientationCorrection ?? (true);
1030 _orientationCorrection = value;
1036 /// Whether to use the texture atlas or not.
1037 /// Optional. By default atlasing is off.
1039 /// <since_tizen> 5 </since_tizen>
1040 public bool Atlasing
1044 return _atlasing ?? (false);
1054 /// Compose the out visual map.
1056 /// <since_tizen> 3 </since_tizen>
1057 protected override void ComposingPropertyMap()
1061 _outputVisualMap = new PropertyMap();
1062 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
1063 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1064 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
1065 if (_auxiliaryImageUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(_auxiliaryImageUrl)); }
1066 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
1067 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
1068 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
1069 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
1070 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
1071 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1072 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
1073 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
1074 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
1075 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1076 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1077 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1078 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1079 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
1080 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
1081 if (_auxiliaryImageAlpha != null) { _outputVisualMap.Add((int)ImageVisualProperty.AuxiliaryImageAlpha, new PropertyValue((float)_auxiliaryImageAlpha)); }
1082 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
1083 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
1084 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
1085 if (_atlasing != null) { _outputVisualMap.Add( ImageVisualProperty.Atlasing, new PropertyValue((bool)_atlasing)); }
1086 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1092 /// A class encapsulating the property map of the text visual.
1094 /// <since_tizen> 3 </since_tizen>
1095 public class TextVisual : VisualMap
1097 private string _text = null;
1098 private string _fontFamily = null;
1099 private PropertyMap _fontStyle = null;
1100 private float? _pointSize = null;
1101 private bool? _multiLine = null;
1102 private string _horizontalAlignment = null;
1103 private string _verticalAlignment = null;
1104 private Color _textColor = null;
1105 private bool? _enableMarkup = null;
1106 private PropertyMap _shadow = null;
1107 private PropertyMap _underline = null;
1108 private PropertyMap _outline = null;
1109 private PropertyMap _background = null;
1114 /// <since_tizen> 3 </since_tizen>
1115 public TextVisual() : base()
1120 /// Gets or sets the text to display in the UTF-8 format.<br />
1123 /// <since_tizen> 3 </since_tizen>
1138 /// Gets or sets the requested font family to use.<br />
1141 /// <since_tizen> 3 </since_tizen>
1142 public string FontFamily
1150 _fontFamily = value;
1156 /// Gets or sets the requested font style to use.<br />
1159 /// <since_tizen> 3 </since_tizen>
1160 public PropertyMap FontStyle
1174 /// Gets or sets the size of font in points.<br />
1177 /// <since_tizen> 3 </since_tizen>
1178 public float PointSize
1182 return _pointSize ?? (0.0f);
1192 /// Gets or sets the single-line or multi-line layout option.<br />
1193 /// If not specified, the default is false.<br />
1196 /// <since_tizen> 3 </since_tizen>
1197 public bool MultiLine
1201 return _multiLine ?? (false);
1211 /// Gets or sets the line horizontal alignment.<br />
1212 /// If not specified, the default is begin.<br />
1215 /// <since_tizen> 3 </since_tizen>
1216 public HorizontalAlignment HorizontalAlignment
1220 switch (_horizontalAlignment)
1223 return HorizontalAlignment.Begin;
1225 return HorizontalAlignment.Center;
1227 return HorizontalAlignment.End;
1229 return HorizontalAlignment.Begin;
1236 case HorizontalAlignment.Begin:
1238 _horizontalAlignment = "BEGIN";
1241 case HorizontalAlignment.Center:
1243 _horizontalAlignment = "CENTER";
1246 case HorizontalAlignment.End:
1248 _horizontalAlignment = "END";
1253 _horizontalAlignment = "BEGIN";
1262 /// Gets or sets the line vertical alignment.<br />
1263 /// If not specified, the default is top.<br />
1266 /// <since_tizen> 3 </since_tizen>
1267 public VerticalAlignment VerticalAlignment
1271 switch (_verticalAlignment)
1274 return VerticalAlignment.Top;
1276 return VerticalAlignment.Center;
1278 return VerticalAlignment.Bottom;
1280 return VerticalAlignment.Top;
1287 case VerticalAlignment.Top:
1289 _verticalAlignment = "TOP";
1292 case VerticalAlignment.Center:
1294 _verticalAlignment = "CENTER";
1297 case VerticalAlignment.Bottom:
1299 _verticalAlignment = "BOTTOM";
1304 _verticalAlignment = "TOP";
1313 /// Gets or sets the color of the text.<br />
1316 /// <since_tizen> 3 </since_tizen>
1317 public Color TextColor
1331 /// Gets or sets whether the mark-up processing is enabled.<br />
1334 /// <since_tizen> 3 </since_tizen>
1335 public bool EnableMarkup
1339 return _enableMarkup ?? (false);
1343 _enableMarkup = value;
1349 /// Gets or sets the shadow parameters.
1351 /// <since_tizen> 5 </since_tizen>
1352 public PropertyMap Shadow
1366 /// Gets or sets the underline parameters.
1368 /// <since_tizen> 5 </since_tizen>
1369 public PropertyMap Underline
1383 /// Gets or sets the outline parameters.
1385 /// <since_tizen> 5 </since_tizen>
1386 public PropertyMap Outline
1400 /// Gets or sets the background parameters.
1402 /// <since_tizen> 5 </since_tizen>
1403 public PropertyMap Background
1411 _background = value;
1417 /// Compose the out visual map.
1419 /// <since_tizen> 3 </since_tizen>
1420 protected override void ComposingPropertyMap()
1422 if (_text != null && _pointSize != null)
1424 _outputVisualMap = new PropertyMap();
1425 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1426 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1427 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1428 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1429 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1430 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1431 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1432 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1433 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1434 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1435 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1436 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1437 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1438 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1439 if (_shadow != null) { _outputVisualMap.Add(TextVisualProperty.Shadow, new PropertyValue(_shadow)); }
1440 if (_underline != null) { _outputVisualMap.Add(TextVisualProperty.Underline, new PropertyValue(_underline)); }
1441 if (_outline != null) { _outputVisualMap.Add(TextVisualProperty.Outline, new PropertyValue(_outline)); }
1442 if (_background != null) { _outputVisualMap.Add(TextVisualProperty.Background, new PropertyValue(_background)); }
1443 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1449 /// A class encapsulating the property map of the border visual.
1451 /// <since_tizen> 3 </since_tizen>
1452 public class BorderVisual : VisualMap
1454 private Color _color = null;
1455 private float? _size = null;
1456 private bool? _antiAliasing = null;
1461 /// <since_tizen> 3 </since_tizen>
1462 public BorderVisual() : base()
1467 /// Gets or sets the color of the border.<br />
1470 /// <since_tizen> 3 </since_tizen>
1485 /// Gets or sets the width of the border (in pixels).<br />
1488 /// <since_tizen> 3 </since_tizen>
1489 public float BorderSize
1493 return _size ?? (-1.0f);
1503 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1504 /// If not supplied, the default is false.<br />
1507 /// <since_tizen> 3 </since_tizen>
1508 public bool AntiAliasing
1512 return _antiAliasing ?? (false);
1516 _antiAliasing = value;
1522 /// Compose the out visual map.
1524 /// <since_tizen> 3 </since_tizen>
1525 protected override void ComposingPropertyMap()
1527 if (_color != null && _size != null)
1529 _outputVisualMap = new PropertyMap();
1530 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1531 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1532 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1533 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1534 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1535 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1536 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1537 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1538 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1544 /// A class encapsulating the property map of the color visual.
1546 /// <since_tizen> 3 </since_tizen>
1547 public class ColorVisual : VisualMap
1549 private Color _mixColorForColorVisual = null;
1550 private bool? _renderIfTransparent = false;
1555 /// <since_tizen> 3 </since_tizen>
1556 public ColorVisual() : base()
1561 /// Gets or sets the solid color required.<br />
1564 /// <since_tizen> 3 </since_tizen>
1569 return _mixColorForColorVisual;
1573 _mixColorForColorVisual = value;
1579 /// Gets or sets whether to render if the MixColor is transparent.
1580 /// By default it is false, which means that the ColorVisual will not render if the MIX_COLOR is transparent.
1582 /// <since_tizen> 5 </since_tizen>
1583 public bool RenderIfTransparent
1587 return _renderIfTransparent ?? (false);
1591 _renderIfTransparent = value;
1597 /// Compose the out visual map.
1599 /// <since_tizen> 3 </since_tizen>
1600 protected override void ComposingPropertyMap()
1602 if (_mixColorForColorVisual != null)
1604 _outputVisualMap = new PropertyMap();
1605 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1606 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1607 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1608 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1609 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1610 if (_renderIfTransparent != null) { _outputVisualMap.Add(ColorVisualProperty.RenderIfTransparent, new PropertyValue((bool)_renderIfTransparent)); }
1611 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1617 /// A class encapsulating the property map of the gradient visual.
1619 /// <since_tizen> 3 </since_tizen>
1620 public class GradientVisual : VisualMap
1622 private Vector2 _startPosition = null;
1623 private Vector2 _endPosition = null;
1624 private Vector2 _center = null;
1625 private float? _radius = null;
1626 private PropertyArray _stopOffset = null;
1627 private PropertyArray _stopColor = null;
1628 private GradientVisualUnitsType? _units = null;
1629 private GradientVisualSpreadMethodType? _spreadMethod = null;
1634 /// <since_tizen> 3 </since_tizen>
1635 public GradientVisual() : base()
1640 /// Gets or sets the start position of a linear gradient.<br />
1641 /// Mandatory for linear.<br />
1643 /// <since_tizen> 3 </since_tizen>
1644 public Vector2 StartPosition
1648 return _startPosition;
1652 _startPosition = value;
1658 /// Gets or sets the end position of a linear gradient.<br />
1659 /// Mandatory for linear.<br />
1661 /// <since_tizen> 3 </since_tizen>
1662 public Vector2 EndPosition
1666 return _endPosition;
1670 _endPosition = value;
1676 /// Gets or sets the center point of a radial gradient.<br />
1677 /// Mandatory for radial.<br />
1679 /// <since_tizen> 3 </since_tizen>
1680 public Vector2 Center
1694 /// Gets or sets the size of the radius of a radial gradient.<br />
1695 /// Mandatory for radial.<br />
1697 /// <since_tizen> 3 </since_tizen>
1702 return _radius ?? (-1.0f);
1712 /// Gets or sets all the stop offsets.<br />
1713 /// A PropertyArray of float.<br />
1714 /// If not supplied, the default is 0.0f and 1.0f.<br />
1717 /// <since_tizen> 3 </since_tizen>
1718 public PropertyArray StopOffset
1726 _stopOffset = value;
1732 /// Gets or sets the color at the stop offsets.<br />
1733 /// A PropertyArray of color.<br />
1734 /// At least 2 values are required to show a gradient.<br />
1737 /// <since_tizen> 3 </since_tizen>
1738 public PropertyArray StopColor
1752 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1753 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1756 /// <since_tizen> 3 </since_tizen>
1757 public GradientVisualUnitsType Units
1761 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1771 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1772 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public GradientVisualSpreadMethodType SpreadMethod
1780 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1784 _spreadMethod = value;
1790 /// Compose the out visual map.
1792 /// <since_tizen> 3 </since_tizen>
1793 protected override void ComposingPropertyMap()
1795 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1797 _outputVisualMap = new PropertyMap();
1798 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1799 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1800 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1801 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1802 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1803 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1804 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1805 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1806 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1807 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1808 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1809 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1810 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1811 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1817 /// A class encapsulating the property map of the mesh visual.
1819 /// <since_tizen> 3 </since_tizen>
1820 public class MeshVisual : VisualMap
1822 private string _objectURL = null;
1823 private string _materialtURL = null;
1824 private string _texturesPath = null;
1825 private MeshVisualShadingModeValue? _shadingMode = null;
1826 private bool? _useMipmapping = null;
1827 private bool? _useSoftNormals = null;
1828 private Vector3 _lightPosition = null;
1833 /// <since_tizen> 3 </since_tizen>
1834 public MeshVisual() : base()
1839 /// Gets or sets the location of the ".obj" file.<br />
1842 /// <since_tizen> 3 </since_tizen>
1843 public string ObjectURL
1857 /// Gets or sets the location of the ".mtl" file.<br />
1858 /// If not specified, then a textureless object is assumed.<br />
1861 /// <since_tizen> 3 </since_tizen>
1862 public string MaterialtURL
1866 return _materialtURL;
1870 _materialtURL = value;
1876 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1877 /// Mandatory if using material.<br />
1879 /// <since_tizen> 3 </since_tizen>
1880 public string TexturesPath
1884 return _texturesPath;
1888 _texturesPath = value;
1894 /// Gets or sets the type of shading mode that the mesh will use.<br />
1895 /// 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 />
1896 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1899 /// <since_tizen> 3 </since_tizen>
1900 public MeshVisualShadingModeValue ShadingMode
1904 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1908 _shadingMode = value;
1914 /// Gets or sets whether to use mipmaps for textures or not.<br />
1915 /// If not specified, the default is true.<br />
1918 /// <since_tizen> 3 </since_tizen>
1919 public bool UseMipmapping
1923 return _useMipmapping ?? (true);
1927 _useMipmapping = value;
1933 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1934 /// If not specified, the default is true.<br />
1937 /// <since_tizen> 3 </since_tizen>
1938 public bool UseSoftNormals
1942 return _useSoftNormals ?? (true);
1946 _useSoftNormals = value;
1952 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1953 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1954 /// and using all zeroes will place the light at the top-left corner.<br />
1955 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1958 /// <since_tizen> 3 </since_tizen>
1959 public Vector3 LightPosition
1963 return _lightPosition;
1967 _lightPosition = value;
1973 /// Compose the out visual map.
1975 /// <since_tizen> 3 </since_tizen>
1976 protected override void ComposingPropertyMap()
1978 if (_objectURL != null)
1980 _outputVisualMap = new PropertyMap();
1981 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1982 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1983 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1984 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1985 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1986 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1987 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1988 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1989 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1990 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1991 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1992 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1998 /// A class encapsulating the property map of the primetive visual.
2000 /// <since_tizen> 3 </since_tizen>
2001 public class PrimitiveVisual : VisualMap
2003 private PrimitiveVisualShapeType? _shape = null;
2004 private Color _mixColorForPrimitiveVisual = null;
2005 private int? _slices = null;
2006 private int? _stacks = null;
2007 private float? _scaleTopRadius = null;
2008 private float? _scaleBottomRadius = null;
2009 private float? _scaleHeight = null;
2010 private float? _scaleRadius = null;
2011 private Vector3 _scaleDimensions = null;
2012 private float? _bevelPercentage = null;
2013 private float? _bevelSmoothness = null;
2014 private Vector3 _lightPosition = null;
2019 /// <since_tizen> 3 </since_tizen>
2020 public PrimitiveVisual() : base()
2025 /// Gets or sets the specific shape to render.<br />
2026 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
2029 /// <since_tizen> 3 </since_tizen>
2030 public PrimitiveVisualShapeType Shape
2034 return _shape ?? (PrimitiveVisualShapeType.Sphere);
2044 /// Gets or sets the color of the shape.<br />
2045 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
2046 /// Applies to all shapes.<br />
2049 /// <since_tizen> 3 </since_tizen>
2050 public new Color MixColor
2054 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
2058 _mixColorForPrimitiveVisual = value;
2064 /// Gets or sets the number of slices as you go around the shape.<br />
2065 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
2066 /// If not specified, the default is 128.<br />
2067 /// The range is from 1 to 255.<br />
2070 /// <since_tizen> 3 </since_tizen>
2075 return _slices ?? (128);
2085 /// Gets or sets the number of stacks as you go down the shape.<br />
2086 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
2087 /// If not specified, the default is 128.<br />
2088 /// The range is from 1 to 255.<br />
2091 /// <since_tizen> 3 </since_tizen>
2096 return _stacks ?? (128);
2106 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
2107 /// If not specified, the default is 1.0f.<br />
2108 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2109 /// Only values greater than or equal to 0.0f are accepted.<br />
2112 /// <since_tizen> 3 </since_tizen>
2113 public float ScaleTopRadius
2117 return _scaleTopRadius ?? (1.0f);
2121 _scaleTopRadius = value;
2127 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
2128 /// If not specified, the default is 1.5f.<br />
2129 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2130 /// - PrimitiveVisualShapeType.Cone<br />
2131 /// Only values greater than or equal to 0.0f are accepted.<br />
2134 /// <since_tizen> 3 </since_tizen>
2135 public float ScaleBottomRadius
2139 return _scaleBottomRadius ?? (1.5f);
2143 _scaleBottomRadius = value;
2149 /// Gets or sets the scale of the height of a conic.<br />
2150 /// If not specified, the default is 3.0f.<br />
2151 /// Applies to:<br />
2152 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
2153 /// - PrimitiveVisualShapeType.Cone<br />
2154 /// - PrimitiveVisualShapeType.Cylinder<br />
2155 /// Only values greater than or equal to 0.0f are accepted.<br />
2158 /// <since_tizen> 3 </since_tizen>
2159 public float ScaleHeight
2163 return _scaleHeight ?? (3.0f);
2167 _scaleHeight = value;
2173 /// Gets or sets the scale of the radius of a cylinder.<br />
2174 /// If not specified, the default is 1.0f.<br />
2175 /// Applies to:<br />
2176 /// - PrimitiveVisualShapeType.Cylinder<br />
2177 /// Only values greater than or equal to 0.0f are accepted.<br />
2180 /// <since_tizen> 3 </since_tizen>
2181 public float ScaleRadius
2185 return _scaleRadius ?? (1.0f);
2189 _scaleRadius = value;
2195 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
2196 /// If not specified, the default is Vector3.One.<br />
2197 /// Applies to:<br />
2198 /// - PrimitiveVisualShapeType.Cube<br />
2199 /// - PrimitiveVisualShapeType.Octahedron<br />
2200 /// - PrimitiveVisualShapeType.BevelledCube<br />
2201 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2204 /// <since_tizen> 3 </since_tizen>
2205 public Vector3 ScaleDimensions
2209 return _scaleDimensions ?? (Vector3.One);
2213 _scaleDimensions = value;
2219 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2220 /// 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 />
2221 /// If not specified, the default is 0.0f (no bevel).<br />
2222 /// Applies to:<br />
2223 /// - PrimitiveVisualShapeType.BevelledCube<br />
2224 /// The range is from 0.0f to 1.0f.<br />
2227 /// <since_tizen> 3 </since_tizen>
2228 public float BevelPercentage
2232 return _bevelPercentage ?? (0.0f);
2236 _bevelPercentage = value;
2242 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2243 /// If not specified, the default is 0.0f (sharp edges).<br />
2244 /// Applies to:<br />
2245 /// - PrimitiveVisualShapeType.BevelledCube<br />
2246 /// The range is from 0.0f to 1.0f.<br />
2249 /// <since_tizen> 3 </since_tizen>
2250 public float BevelSmoothness
2254 return _bevelSmoothness ?? (0.0f);
2258 _bevelSmoothness = value;
2264 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2265 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2266 /// and using all zeroes will place the light at the top-left corner.<br />
2267 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2268 /// Applies to all shapes.<br />
2271 /// <since_tizen> 3 </since_tizen>
2272 public Vector3 LightPosition
2276 return _lightPosition;
2280 _lightPosition = value;
2286 /// Compose the out visual map.
2288 /// <since_tizen> 3 </since_tizen>
2289 protected override void ComposingPropertyMap()
2291 _outputVisualMap = new PropertyMap(); ;
2292 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2293 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2294 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2295 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2296 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2297 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2298 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2299 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2300 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2301 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2302 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2303 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2304 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2305 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2306 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2307 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2308 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2313 /// A class encapsulating the property map of the n-patch image visual.
2315 /// <since_tizen> 3 </since_tizen>
2316 public class NPatchVisual : VisualMap
2318 private string _url = null;
2319 private bool? _borderOnly = null;
2320 private Rectangle _border = null;
2325 /// <since_tizen> 3 </since_tizen>
2326 public NPatchVisual() : base()
2331 /// Gets or sets the URL of the image.<br />
2334 /// <since_tizen> 3 </since_tizen>
2349 /// Gets or sets whether to draw the borders only (If true).<br />
2350 /// If not specified, the default is false.<br />
2351 /// For n-patch images only.<br />
2354 /// <since_tizen> 3 </since_tizen>
2355 public bool BorderOnly
2359 return _borderOnly ?? false;
2363 _borderOnly = value;
2369 /// The border of the image is in the order: left, right, bottom, top.<br />
2370 /// For n-patch images only.<br />
2373 /// <since_tizen> 3 </since_tizen>
2374 public Rectangle Border
2388 /// Compose the out visual map.
2390 /// <since_tizen> 3 </since_tizen>
2391 protected override void ComposingPropertyMap()
2395 _outputVisualMap = new PropertyMap();
2396 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2397 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2398 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2399 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2400 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2401 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2402 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2403 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2404 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2410 /// A class encapsulating the property map of the SVG visual.
2412 /// <since_tizen> 3 </since_tizen>
2413 public class SVGVisual : VisualMap
2415 private string _url = null;
2420 /// <since_tizen> 3 </since_tizen>
2421 public SVGVisual() : base()
2426 /// The url of the svg resource.
2428 /// <since_tizen> 3 </since_tizen>
2443 /// Compose the out visual map.
2445 /// <since_tizen> 3 </since_tizen>
2446 protected override void ComposingPropertyMap()
2450 _outputVisualMap = new PropertyMap();
2451 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2452 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2453 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2454 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2455 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2456 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2457 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2463 /// A class encapsulating the property map of the animated image (AGIF) visual.
2465 /// <since_tizen> 3 </since_tizen>
2466 public class AnimatedImageVisual : VisualMap
2468 private List<string> _urls = null;
2469 private int? _batchSize = null;
2470 private int? _cacheSize = null;
2471 private float? _frameDelay = null;
2472 private float? _loopCount = null;
2477 /// <since_tizen> 3 </since_tizen>
2478 public AnimatedImageVisual() : base()
2483 /// Gets and Sets the url in the AnimatedImageVisual.
2485 /// <since_tizen> 3 </since_tizen>
2503 _urls = new List<string>();
2515 /// Gets and Sets the url list in the AnimatedImageVisual.
2517 /// <since_tizen> 4 </since_tizen>
2518 public List<string> URLS
2532 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2534 /// <since_tizen> 4 </since_tizen>
2535 public int BatchSize
2539 return _batchSize ?? 1;
2549 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2551 /// <since_tizen> 4 </since_tizen>
2552 public int CacheSize
2556 return _cacheSize ?? 1;
2566 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2568 /// <since_tizen> 4 </since_tizen>
2569 public float FrameDelay
2573 return _frameDelay ?? 0.1f;
2577 _frameDelay = value;
2583 /// Gets and sets the number of times the AnimatedImageVisual will be looped.
2584 /// The default is -1. If the number is less than 0 then it loops unlimited,otherwise loop loopCount times.
2586 /// <since_tizen> 5 </since_tizen>
2587 public float LoopCount
2591 return _loopCount ?? -1;
2601 /// Compose the out visual map.
2603 /// <since_tizen> 3 </since_tizen>
2604 protected override void ComposingPropertyMap()
2608 _outputVisualMap = new PropertyMap();
2609 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2610 if( _urls.Count == 1 )
2612 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2616 var urlArray = new PropertyArray();
2617 foreach( var url in _urls)
2619 urlArray.Add(new PropertyValue(url));
2621 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2623 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2624 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2625 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2626 if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
2627 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2628 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2629 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2630 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2631 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
2637 //temporary fix for TCT
2639 /// A class encapsulating the property map of the transition data.
2641 /// <since_tizen> 3 </since_tizen>
2642 public class VisualAnimator : VisualMap
2644 private string _alphaFunction = null;
2645 private int _startTime = 0;
2646 private int _endTime = 0;
2647 private string _target = null;
2648 private string _propertyIndex = null;
2649 private object _destinationValue = null;
2652 /// Create VisualAnimator object.
2654 /// <since_tizen> 3 </since_tizen>
2655 public VisualAnimator() : base()
2660 /// Sets and Gets the AlphaFunction of this transition.
2662 /// <since_tizen> 3 </since_tizen>
2663 public AlphaFunction.BuiltinFunctions AlphaFunction
2667 switch (_alphaFunction)
2670 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2672 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2673 case "EASE_IN_SQUARE":
2674 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2675 case "EASE_OUT_SQUARE":
2676 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2678 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2680 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2682 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2683 case "EASE_IN_SINE":
2684 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2685 case "EASE_OUT_SINE":
2686 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2687 case "EASE_IN_OUT_SINE":
2688 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2690 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2692 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2693 case "EASE_OUT_BACK":
2694 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2696 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2703 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2705 _alphaFunction = "LINEAR";
2708 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2710 _alphaFunction = "REVERSE";
2713 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2715 _alphaFunction = "EASE_IN_SQUARE";
2718 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2720 _alphaFunction = "EASE_OUT_SQUARE";
2723 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2725 _alphaFunction = "EASE_IN";
2728 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2730 _alphaFunction = "EASE_OUT";
2733 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2735 _alphaFunction = "EASE_IN_OUT";
2738 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2740 _alphaFunction = "EASE_IN_SINE";
2743 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2745 _alphaFunction = "EASE_OUT_SINE";
2748 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2750 _alphaFunction = "EASE_IN_OUT_SINE";
2753 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2755 _alphaFunction = "BOUNCE";
2758 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2760 _alphaFunction = "SIN";
2763 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2765 _alphaFunction = "EASE_OUT_BACK";
2770 _alphaFunction = "DEFAULT";
2778 /// Sets and Gets the StartTime of this transition.
2780 /// <since_tizen> 3 </since_tizen>
2781 public int StartTime
2794 /// Sets and Gets the EndTime of this transition.
2796 /// <since_tizen> 3 </since_tizen>
2810 /// Sets and Gets the Target of this transition.
2812 /// <since_tizen> 3 </since_tizen>
2813 public string Target
2826 /// Sets and Gets the PropertyIndex of this transition.
2828 /// <since_tizen> 3 </since_tizen>
2829 public string PropertyIndex
2833 return _propertyIndex;
2837 _propertyIndex = value;
2842 /// Sets and Gets the DestinationValue of this transition.
2844 /// <since_tizen> 3 </since_tizen>
2845 public object DestinationValue
2849 return _destinationValue;
2853 _destinationValue = value;
2858 /// Compose the out visual map.
2860 /// <since_tizen> 3 </since_tizen>
2861 protected override void ComposingPropertyMap()
2863 PropertyMap _animator = new PropertyMap();
2864 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2866 PropertyMap _timePeriod = new PropertyMap();
2867 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2868 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2869 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2871 StringBuilder sb = new StringBuilder(_propertyIndex);
2872 sb[0] = (char)(sb[0] | 0x20);
2873 string _str = sb.ToString();
2875 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2877 PropertyMap _transition = new PropertyMap();
2878 _transition.Add("target", new PropertyValue(_target));
2879 _transition.Add("property", new PropertyValue(_str));
2880 _transition.Add("targetValue", val);
2881 _transition.Add("animator", new PropertyValue(_animator));
2883 _outputVisualMap = _transition;
2886 //temporary fix for TCT