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 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
621 [EditorBrowsable(EditorBrowsableState.Never)]
622 public VisualFittingModeType VisualFittingMode
626 _visualFittingMode = value;
633 /// A class encapsulating the property map of the image visual.
635 /// <since_tizen> 3 </since_tizen>
636 public class ImageVisual : VisualMap
641 /// <since_tizen> 3 </since_tizen>
642 public ImageVisual() : base()
646 private string _url = null;
647 private string _alphaMaskUrl = null;
648 private string _auxiliaryImageUrl = null;
649 private FittingModeType? _fittingMode = null;
650 private SamplingModeType? _samplingMode = null;
651 private int? _desiredWidth = null;
652 private int? _desiredHeight = null;
653 private bool? _synchronousLoading = false;
654 private bool? _borderOnly = null;
655 private Vector4 _pixelArea = null;
656 private WrapModeType? _wrapModeU = null;
657 private WrapModeType? _wrapModeV = null;
658 private float? _auxiliaryImageAlpha = null;
659 private float? _maskContentScale = null;
660 private bool? _cropToMask = null;
661 private ReleasePolicyType? _releasePolicy = null;
662 private LoadPolicyType? _loadPolicy = null;
663 private bool? _orientationCorrection = true;
664 private bool? _atlasing = false;
667 /// Gets or sets the URL of the image.<br />
670 /// <since_tizen> 3 </since_tizen>
686 /// Gets or sets the URL of the alpha mask.<br />
689 /// <since_tizen> 3 </since_tizen>
690 public string AlphaMaskURL
694 return _alphaMaskUrl;
698 _alphaMaskUrl = value;
704 /// Overlays the auxiliary image on top of an NPatch image.
705 /// The resulting visual image will be at least as large as the smallest possible n-patch or the auxiliary image, whichever is larger.
707 /// <since_tizen> 5 </since_tizen>
708 public string AuxiliaryImageURL
712 return _auxiliaryImageUrl;
716 _auxiliaryImageUrl = value;
722 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
723 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
724 /// For normal quad images only.<br />
727 /// <since_tizen> 3 </since_tizen>
728 public FittingModeType FittingMode
732 return _fittingMode ?? (FittingModeType.ShrinkToFit);
736 _fittingMode = value;
742 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
743 /// If not supplied, the default is SamplingModeType.Box.<br />
744 /// For normal quad images only.<br />
747 /// <since_tizen> 3 </since_tizen>
748 public SamplingModeType SamplingMode
752 return _samplingMode ?? (SamplingModeType.Box);
756 _samplingMode = value;
762 /// Gets or sets the desired image width.<br />
763 /// If not specified, the actual image width is used.<br />
764 /// For normal quad images only.<br />
767 /// <since_tizen> 3 </since_tizen>
768 public int DesiredWidth
772 return _desiredWidth ?? (-1);
776 _desiredWidth = value;
782 /// Gets or sets the desired image height.<br />
783 /// If not specified, the actual image height is used.<br />
784 /// For normal quad images only.<br />
787 /// <since_tizen> 3 </since_tizen>
788 public int DesiredHeight
792 return _desiredHeight ?? (-1);
796 _desiredHeight = value;
802 /// Gets or sets whether to load the image synchronously.<br />
803 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
804 /// For normal quad images only.<br />
807 /// <since_tizen> 3 </since_tizen>
808 public bool SynchronousLoading
812 return _synchronousLoading ?? (false);
816 _synchronousLoading = value;
822 /// Gets or sets whether to draw the borders only (If true).<br />
823 /// If not specified, the default is false.<br />
824 /// For n-patch images only.<br />
827 /// <since_tizen> 3 </since_tizen>
828 public bool BorderOnly
832 return _borderOnly ?? (false);
842 /// Gets or sets the image area to be displayed.<br />
843 /// It is a rectangular area.<br />
844 /// 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 />
845 /// 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 />
846 /// For normal quad images only.<br />
849 /// <since_tizen> 3 </since_tizen>
850 public Vector4 PixelArea
854 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
864 /// Gets or sets the wrap mode for the u coordinate.<br />
865 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
866 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
867 /// For normal quad images only.<br />
870 /// <since_tizen> 3 </since_tizen>
871 public WrapModeType WrapModeU
875 return _wrapModeU ?? (WrapModeType.Default);
885 /// Gets or sets the wrap mode for the v coordinate.<br />
886 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
887 /// 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 />
888 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
889 /// For normal quad images only.
892 /// <since_tizen> 3 </since_tizen>
893 public WrapModeType WrapModeV
897 return _wrapModeV ?? (WrapModeType.Default);
907 /// Gets or sets scale factor to apply to the content image before masking.
909 /// <since_tizen> 4 </since_tizen>
910 public float MaskContentScale
914 return _maskContentScale ?? 1.0f;
918 _maskContentScale = value;
924 /// Whether to crop image to mask or scale mask to fit image.
926 /// <since_tizen> 4 </since_tizen>
927 public bool CropToMask
931 return _cropToMask ?? false;
941 /// An alpha value for mixing between the masked main NPatch image and the auxiliary image.
943 /// <since_tizen> 5 </since_tizen>
944 public float AuxiliaryImageAlpha
948 return _auxiliaryImageAlpha ?? 1.0f;
952 _auxiliaryImageAlpha = value;
958 /// Gets or sets the Image Visual release policy.<br/>
959 /// It decides if a texture should be released from the cache or kept to reduce the loading time.<br/>
961 /// <since_tizen> 5 </since_tizen>
962 public ReleasePolicyType ReleasePolicy
966 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
970 _releasePolicy = value;
977 /// Gets or sets the Image Visual image loading policy.<br />
978 /// It decides if a texture should be loaded immediately after source set or only after the visual is added to the window.<br />
980 /// <since_tizen> 5 </since_tizen>
981 public LoadPolicyType LoadPolicy
985 return _loadPolicy ?? (LoadPolicyType.Attached);
995 /// Gets or sets whether to automatically correct the orientation based on the Exchangeable Image File (EXIF) data.<br />
996 /// If not specified, the default is true.<br />
997 /// For JPEG images only.<br />
1000 /// <since_tizen> 5 </since_tizen>
1001 public bool OrientationCorrection
1005 return _orientationCorrection ?? (true);
1009 _orientationCorrection = value;
1015 /// Whether to use the texture atlas or not.
1016 /// Optional. By default atlasing is off.
1018 /// <since_tizen> 5 </since_tizen>
1019 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1020 [EditorBrowsable(EditorBrowsableState.Never)]
1021 public bool Atlasing
1025 return _atlasing ?? (false);
1035 /// Compose the out visual map.
1037 /// <since_tizen> 3 </since_tizen>
1038 protected override void ComposingPropertyMap()
1042 _outputVisualMap = new PropertyMap();
1043 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
1044 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1045 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
1046 if (_auxiliaryImageUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(_auxiliaryImageUrl)); }
1047 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
1048 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
1049 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
1050 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
1051 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
1052 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1053 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
1054 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
1055 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
1056 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1057 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1058 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1059 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1060 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
1061 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
1062 if (_auxiliaryImageAlpha != null) { _outputVisualMap.Add((int)ImageVisualProperty.AuxiliaryImageAlpha, new PropertyValue((float)_auxiliaryImageAlpha)); }
1063 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
1064 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
1065 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
1066 if (_atlasing != null) { _outputVisualMap.Add( ImageVisualProperty.Atlasing, new PropertyValue((bool)_atlasing)); }
1067 if (_visualFittingMode != null) { _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
1073 /// A class encapsulating the property map of the text visual.
1075 /// <since_tizen> 3 </since_tizen>
1076 public class TextVisual : VisualMap
1081 /// <since_tizen> 3 </since_tizen>
1082 public TextVisual() : base()
1086 private string _text = null;
1087 private string _fontFamily = null;
1088 private PropertyMap _fontStyle = null;
1089 private float? _pointSize = null;
1090 private bool? _multiLine = null;
1091 private string _horizontalAlignment = null;
1092 private string _verticalAlignment = null;
1093 private Color _textColor = null;
1094 private bool? _enableMarkup = null;
1095 private PropertyMap _shadow = null;
1096 private PropertyMap _underline = null;
1097 private PropertyMap _outline = null;
1098 private PropertyMap _background = null;
1101 /// Gets or sets the text to display in the UTF-8 format.<br />
1104 /// <since_tizen> 3 </since_tizen>
1119 /// Gets or sets the requested font family to use.<br />
1122 /// <since_tizen> 3 </since_tizen>
1123 public string FontFamily
1131 _fontFamily = value;
1137 /// Gets or sets the requested font style to use.<br />
1140 /// <since_tizen> 3 </since_tizen>
1141 public PropertyMap FontStyle
1155 /// Gets or sets the size of font in points.<br />
1158 /// <since_tizen> 3 </since_tizen>
1159 public float PointSize
1163 return _pointSize ?? (0.0f);
1173 /// Gets or sets the single-line or multi-line layout option.<br />
1174 /// If not specified, the default is false.<br />
1177 /// <since_tizen> 3 </since_tizen>
1178 public bool MultiLine
1182 return _multiLine ?? (false);
1192 /// Gets or sets the line horizontal alignment.<br />
1193 /// If not specified, the default is begin.<br />
1196 /// <since_tizen> 3 </since_tizen>
1197 public HorizontalAlignment HorizontalAlignment
1201 switch (_horizontalAlignment)
1204 return HorizontalAlignment.Begin;
1206 return HorizontalAlignment.Center;
1208 return HorizontalAlignment.End;
1210 return HorizontalAlignment.Begin;
1217 case HorizontalAlignment.Begin:
1219 _horizontalAlignment = "BEGIN";
1222 case HorizontalAlignment.Center:
1224 _horizontalAlignment = "CENTER";
1227 case HorizontalAlignment.End:
1229 _horizontalAlignment = "END";
1234 _horizontalAlignment = "BEGIN";
1243 /// Gets or sets the line vertical alignment.<br />
1244 /// If not specified, the default is top.<br />
1247 /// <since_tizen> 3 </since_tizen>
1248 public VerticalAlignment VerticalAlignment
1252 switch (_verticalAlignment)
1255 return VerticalAlignment.Top;
1257 return VerticalAlignment.Center;
1259 return VerticalAlignment.Bottom;
1261 return VerticalAlignment.Top;
1268 case VerticalAlignment.Top:
1270 _verticalAlignment = "TOP";
1273 case VerticalAlignment.Center:
1275 _verticalAlignment = "CENTER";
1278 case VerticalAlignment.Bottom:
1280 _verticalAlignment = "BOTTOM";
1285 _verticalAlignment = "TOP";
1294 /// Gets or sets the color of the text.<br />
1297 /// <since_tizen> 3 </since_tizen>
1298 public Color TextColor
1312 /// Gets or sets whether the mark-up processing is enabled.<br />
1315 /// <since_tizen> 3 </since_tizen>
1316 public bool EnableMarkup
1320 return _enableMarkup ?? (false);
1324 _enableMarkup = value;
1330 /// Gets or sets the shadow parameters.
1332 /// <since_tizen> 5 </since_tizen>
1333 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1334 [EditorBrowsable(EditorBrowsableState.Never)]
1335 public PropertyMap Shadow
1349 /// Gets or sets the underline parameters.
1351 /// <since_tizen> 5 </since_tizen>
1352 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1353 [EditorBrowsable(EditorBrowsableState.Never)]
1354 public PropertyMap Underline
1368 /// Gets or sets the outline parameters.
1370 /// <since_tizen> 5 </since_tizen>
1371 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1372 [EditorBrowsable(EditorBrowsableState.Never)]
1373 public PropertyMap Outline
1387 /// Gets or sets the background parameters.
1389 /// <since_tizen> 5 </since_tizen>
1390 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1391 [EditorBrowsable(EditorBrowsableState.Never)]
1392 public PropertyMap Background
1400 _background = value;
1406 /// Compose the out visual map.
1408 /// <since_tizen> 3 </since_tizen>
1409 protected override void ComposingPropertyMap()
1411 if (_text != null && _pointSize != null)
1413 _outputVisualMap = new PropertyMap();
1414 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1415 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1416 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1417 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1418 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1419 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1420 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1421 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1422 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1423 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1424 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1425 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1426 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1427 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1428 if (_shadow != null) { _outputVisualMap.Add(TextVisualProperty.Shadow, new PropertyValue(_shadow)); }
1429 if (_underline != null) { _outputVisualMap.Add(TextVisualProperty.Underline, new PropertyValue(_underline)); }
1430 if (_outline != null) { _outputVisualMap.Add(TextVisualProperty.Outline, new PropertyValue(_outline)); }
1431 if (_background != null) { _outputVisualMap.Add(TextVisualProperty.Background, new PropertyValue(_background)); }
1437 /// A class encapsulating the property map of the border visual.
1439 /// <since_tizen> 3 </since_tizen>
1440 public class BorderVisual : VisualMap
1445 /// <since_tizen> 3 </since_tizen>
1446 public BorderVisual() : base()
1450 private Color _color = null;
1451 private float? _size = null;
1452 private bool? _antiAliasing = null;
1455 /// Gets or sets the color of the border.<br />
1458 /// <since_tizen> 3 </since_tizen>
1473 /// Gets or sets the width of the border (in pixels).<br />
1476 /// <since_tizen> 3 </since_tizen>
1477 public float BorderSize
1481 return _size ?? (-1.0f);
1491 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1492 /// If not supplied, the default is false.<br />
1495 /// <since_tizen> 3 </since_tizen>
1496 public bool AntiAliasing
1500 return _antiAliasing ?? (false);
1504 _antiAliasing = value;
1510 /// Compose the out visual map.
1512 /// <since_tizen> 3 </since_tizen>
1513 protected override void ComposingPropertyMap()
1515 if (_color != null && _size != null)
1517 _outputVisualMap = new PropertyMap();
1518 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1519 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1520 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1521 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1522 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1523 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1524 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1525 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1531 /// A class encapsulating the property map of the color visual.
1533 /// <since_tizen> 3 </since_tizen>
1534 public class ColorVisual : VisualMap
1539 /// <since_tizen> 3 </since_tizen>
1540 public ColorVisual() : base()
1544 private Color _mixColorForColorVisual = null;
1545 private bool? _renderIfTransparent = false;
1548 /// Gets or sets the solid color required.<br />
1551 /// <since_tizen> 3 </since_tizen>
1556 return _mixColorForColorVisual;
1560 _mixColorForColorVisual = value;
1566 /// Gets or sets whether to render if the MixColor is transparent.
1567 /// By default it is false, which means that the ColorVisual will not render if the MIX_COLOR is transparent.
1569 /// <since_tizen> 5 </since_tizen>
1570 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1571 [EditorBrowsable(EditorBrowsableState.Never)]
1572 public bool RenderIfTransparent
1576 return _renderIfTransparent ?? (false);
1580 _renderIfTransparent = value;
1586 /// Compose the out visual map.
1588 /// <since_tizen> 3 </since_tizen>
1589 protected override void ComposingPropertyMap()
1591 if (_mixColorForColorVisual != null)
1593 _outputVisualMap = new PropertyMap();
1594 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1595 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1596 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1597 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1598 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1599 if (_renderIfTransparent != null) { _outputVisualMap.Add(ColorVisualProperty.RenderIfTransparent, new PropertyValue((bool)_renderIfTransparent)); }
1605 /// A class encapsulating the property map of the gradient visual.
1607 /// <since_tizen> 3 </since_tizen>
1608 public class GradientVisual : VisualMap
1613 /// <since_tizen> 3 </since_tizen>
1614 public GradientVisual() : base()
1618 private Vector2 _startPosition = null;
1619 private Vector2 _endPosition = null;
1620 private Vector2 _center = null;
1621 private float? _radius = null;
1622 private PropertyArray _stopOffset = null;
1623 private PropertyArray _stopColor = null;
1624 private GradientVisualUnitsType? _units = null;
1625 private GradientVisualSpreadMethodType? _spreadMethod = null;
1628 /// Gets or sets the start position of a linear gradient.<br />
1629 /// Mandatory for linear.<br />
1631 /// <since_tizen> 3 </since_tizen>
1632 public Vector2 StartPosition
1636 return _startPosition;
1640 _startPosition = value;
1646 /// Gets or sets the end position of a linear gradient.<br />
1647 /// Mandatory for linear.<br />
1649 /// <since_tizen> 3 </since_tizen>
1650 public Vector2 EndPosition
1654 return _endPosition;
1658 _endPosition = value;
1664 /// Gets or sets the center point of a radial gradient.<br />
1665 /// Mandatory for radial.<br />
1667 /// <since_tizen> 3 </since_tizen>
1668 public Vector2 Center
1682 /// Gets or sets the size of the radius of a radial gradient.<br />
1683 /// Mandatory for radial.<br />
1685 /// <since_tizen> 3 </since_tizen>
1690 return _radius ?? (-1.0f);
1700 /// Gets or sets all the stop offsets.<br />
1701 /// A PropertyArray of float.<br />
1702 /// If not supplied, the default is 0.0f and 1.0f.<br />
1705 /// <since_tizen> 3 </since_tizen>
1706 public PropertyArray StopOffset
1714 _stopOffset = value;
1720 /// Gets or sets the color at the stop offsets.<br />
1721 /// A PropertyArray of color.<br />
1722 /// At least 2 values are required to show a gradient.<br />
1725 /// <since_tizen> 3 </since_tizen>
1726 public PropertyArray StopColor
1740 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1741 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1744 /// <since_tizen> 3 </since_tizen>
1745 public GradientVisualUnitsType Units
1749 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1759 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1760 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1763 /// <since_tizen> 3 </since_tizen>
1764 public GradientVisualSpreadMethodType SpreadMethod
1768 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1772 _spreadMethod = value;
1778 /// Compose the out visual map.
1780 /// <since_tizen> 3 </since_tizen>
1781 protected override void ComposingPropertyMap()
1783 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1785 _outputVisualMap = new PropertyMap();
1786 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1787 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1788 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1789 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1790 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1791 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1792 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1793 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1794 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1795 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1796 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1797 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1798 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1804 /// A class encapsulating the property map of the mesh visual.
1806 /// <since_tizen> 3 </since_tizen>
1807 public class MeshVisual : VisualMap
1812 /// <since_tizen> 3 </since_tizen>
1813 public MeshVisual() : base()
1817 private string _objectURL = null;
1818 private string _materialtURL = null;
1819 private string _texturesPath = null;
1820 private MeshVisualShadingModeValue? _shadingMode = null;
1821 private bool? _useMipmapping = null;
1822 private bool? _useSoftNormals = null;
1823 private Vector3 _lightPosition = null;
1826 /// Gets or sets the location of the ".obj" file.<br />
1829 /// <since_tizen> 3 </since_tizen>
1830 public string ObjectURL
1844 /// Gets or sets the location of the ".mtl" file.<br />
1845 /// If not specified, then a textureless object is assumed.<br />
1848 /// <since_tizen> 3 </since_tizen>
1849 public string MaterialtURL
1853 return _materialtURL;
1857 _materialtURL = value;
1863 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1864 /// Mandatory if using material.<br />
1866 /// <since_tizen> 3 </since_tizen>
1867 public string TexturesPath
1871 return _texturesPath;
1875 _texturesPath = value;
1881 /// Gets or sets the type of shading mode that the mesh will use.<br />
1882 /// 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 />
1883 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1886 /// <since_tizen> 3 </since_tizen>
1887 public MeshVisualShadingModeValue ShadingMode
1891 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1895 _shadingMode = value;
1901 /// Gets or sets whether to use mipmaps for textures or not.<br />
1902 /// If not specified, the default is true.<br />
1905 /// <since_tizen> 3 </since_tizen>
1906 public bool UseMipmapping
1910 return _useMipmapping ?? (true);
1914 _useMipmapping = value;
1920 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1921 /// If not specified, the default is true.<br />
1924 /// <since_tizen> 3 </since_tizen>
1925 public bool UseSoftNormals
1929 return _useSoftNormals ?? (true);
1933 _useSoftNormals = value;
1939 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1940 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1941 /// and using all zeroes will place the light at the top-left corner.<br />
1942 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1945 /// <since_tizen> 3 </since_tizen>
1946 public Vector3 LightPosition
1950 return _lightPosition;
1954 _lightPosition = value;
1960 /// Compose the out visual map.
1962 /// <since_tizen> 3 </since_tizen>
1963 protected override void ComposingPropertyMap()
1965 if (_objectURL != null)
1967 _outputVisualMap = new PropertyMap();
1968 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1969 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1970 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1971 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1972 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1973 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1974 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1975 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1976 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1977 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1978 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1984 /// A class encapsulating the property map of the primetive visual.
1986 /// <since_tizen> 3 </since_tizen>
1987 public class PrimitiveVisual : VisualMap
1992 /// <since_tizen> 3 </since_tizen>
1993 public PrimitiveVisual() : base()
1997 private PrimitiveVisualShapeType? _shape = null;
1998 private Color _mixColorForPrimitiveVisual = null;
1999 private int? _slices = null;
2000 private int? _stacks = null;
2001 private float? _scaleTopRadius = null;
2002 private float? _scaleBottomRadius = null;
2003 private float? _scaleHeight = null;
2004 private float? _scaleRadius = null;
2005 private Vector3 _scaleDimensions = null;
2006 private float? _bevelPercentage = null;
2007 private float? _bevelSmoothness = null;
2008 private Vector3 _lightPosition = null;
2011 /// Gets or sets the specific shape to render.<br />
2012 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
2015 /// <since_tizen> 3 </since_tizen>
2016 public PrimitiveVisualShapeType Shape
2020 return _shape ?? (PrimitiveVisualShapeType.Sphere);
2030 /// Gets or sets the color of the shape.<br />
2031 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
2032 /// Applies to all shapes.<br />
2035 /// <since_tizen> 3 </since_tizen>
2036 public new Color MixColor
2040 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
2044 _mixColorForPrimitiveVisual = value;
2050 /// Gets or sets the number of slices as you go around the shape.<br />
2051 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
2052 /// If not specified, the default is 128.<br />
2053 /// The range is from 1 to 255.<br />
2056 /// <since_tizen> 3 </since_tizen>
2061 return _slices ?? (128);
2071 /// Gets or sets the number of stacks as you go down the shape.<br />
2072 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
2073 /// If not specified, the default is 128.<br />
2074 /// The range is from 1 to 255.<br />
2077 /// <since_tizen> 3 </since_tizen>
2082 return _stacks ?? (128);
2092 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
2093 /// If not specified, the default is 1.0f.<br />
2094 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2095 /// Only values greater than or equal to 0.0f are accepted.<br />
2098 /// <since_tizen> 3 </since_tizen>
2099 public float ScaleTopRadius
2103 return _scaleTopRadius ?? (1.0f);
2107 _scaleTopRadius = value;
2113 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
2114 /// If not specified, the default is 1.5f.<br />
2115 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
2116 /// - PrimitiveVisualShapeType.Cone<br />
2117 /// Only values greater than or equal to 0.0f are accepted.<br />
2120 /// <since_tizen> 3 </since_tizen>
2121 public float ScaleBottomRadius
2125 return _scaleBottomRadius ?? (1.5f);
2129 _scaleBottomRadius = value;
2135 /// Gets or sets the scale of the height of a conic.<br />
2136 /// If not specified, the default is 3.0f.<br />
2137 /// Applies to:<br />
2138 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
2139 /// - PrimitiveVisualShapeType.Cone<br />
2140 /// - PrimitiveVisualShapeType.Cylinder<br />
2141 /// Only values greater than or equal to 0.0f are accepted.<br />
2144 /// <since_tizen> 3 </since_tizen>
2145 public float ScaleHeight
2149 return _scaleHeight ?? (3.0f);
2153 _scaleHeight = value;
2159 /// Gets or sets the scale of the radius of a cylinder.<br />
2160 /// If not specified, the default is 1.0f.<br />
2161 /// Applies to:<br />
2162 /// - PrimitiveVisualShapeType.Cylinder<br />
2163 /// Only values greater than or equal to 0.0f are accepted.<br />
2166 /// <since_tizen> 3 </since_tizen>
2167 public float ScaleRadius
2171 return _scaleRadius ?? (1.0f);
2175 _scaleRadius = value;
2181 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
2182 /// If not specified, the default is Vector3.One.<br />
2183 /// Applies to:<br />
2184 /// - PrimitiveVisualShapeType.Cube<br />
2185 /// - PrimitiveVisualShapeType.Octahedron<br />
2186 /// - PrimitiveVisualShapeType.BevelledCube<br />
2187 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2190 /// <since_tizen> 3 </since_tizen>
2191 public Vector3 ScaleDimensions
2195 return _scaleDimensions ?? (Vector3.One);
2199 _scaleDimensions = value;
2205 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2206 /// 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 />
2207 /// If not specified, the default is 0.0f (no bevel).<br />
2208 /// Applies to:<br />
2209 /// - PrimitiveVisualShapeType.BevelledCube<br />
2210 /// The range is from 0.0f to 1.0f.<br />
2213 /// <since_tizen> 3 </since_tizen>
2214 public float BevelPercentage
2218 return _bevelPercentage ?? (0.0f);
2222 _bevelPercentage = value;
2228 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2229 /// If not specified, the default is 0.0f (sharp edges).<br />
2230 /// Applies to:<br />
2231 /// - PrimitiveVisualShapeType.BevelledCube<br />
2232 /// The range is from 0.0f to 1.0f.<br />
2235 /// <since_tizen> 3 </since_tizen>
2236 public float BevelSmoothness
2240 return _bevelSmoothness ?? (0.0f);
2244 _bevelSmoothness = value;
2250 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2251 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2252 /// and using all zeroes will place the light at the top-left corner.<br />
2253 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2254 /// Applies to all shapes.<br />
2257 /// <since_tizen> 3 </since_tizen>
2258 public Vector3 LightPosition
2262 return _lightPosition;
2266 _lightPosition = value;
2272 /// Compose the out visual map.
2274 /// <since_tizen> 3 </since_tizen>
2275 protected override void ComposingPropertyMap()
2277 _outputVisualMap = new PropertyMap(); ;
2278 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2279 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2280 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2281 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2282 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2283 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2284 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2285 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2286 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2287 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2288 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2289 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2290 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2291 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2292 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2293 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2298 /// A class encapsulating the property map of the n-patch image visual.
2300 /// <since_tizen> 3 </since_tizen>
2301 public class NPatchVisual : VisualMap
2306 /// <since_tizen> 3 </since_tizen>
2307 public NPatchVisual() : base()
2311 private string _url = null;
2312 private bool? _borderOnly = null;
2313 private Rectangle _border = null;
2316 /// Gets or sets the URL of the image.<br />
2319 /// <since_tizen> 3 </since_tizen>
2334 /// Gets or sets whether to draw the borders only (If true).<br />
2335 /// If not specified, the default is false.<br />
2336 /// For n-patch images only.<br />
2339 /// <since_tizen> 3 </since_tizen>
2340 public bool BorderOnly
2344 return _borderOnly ?? false;
2348 _borderOnly = value;
2354 /// The border of the image is in the order: left, right, bottom, top.<br />
2355 /// For n-patch images only.<br />
2358 /// <since_tizen> 3 </since_tizen>
2359 public Rectangle Border
2373 /// Compose the out visual map.
2375 /// <since_tizen> 3 </since_tizen>
2376 protected override void ComposingPropertyMap()
2380 _outputVisualMap = new PropertyMap();
2381 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2382 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2383 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2384 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2385 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2386 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2387 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2388 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2394 /// A class encapsulating the property map of the SVG visual.
2396 /// <since_tizen> 3 </since_tizen>
2397 public class SVGVisual : VisualMap
2402 /// <since_tizen> 3 </since_tizen>
2403 public SVGVisual() : base()
2407 private string _url = null;
2410 /// The url of the svg resource.
2412 /// <since_tizen> 3 </since_tizen>
2427 /// Compose the out visual map.
2429 /// <since_tizen> 3 </since_tizen>
2430 protected override void ComposingPropertyMap()
2434 _outputVisualMap = new PropertyMap();
2435 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2436 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2437 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2438 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2439 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2440 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2446 /// A class encapsulating the property map of the animated image (AGIF) visual.
2448 /// <since_tizen> 3 </since_tizen>
2449 public class AnimatedImageVisual : VisualMap
2454 /// <since_tizen> 3 </since_tizen>
2455 public AnimatedImageVisual() : base()
2459 private List<string> _urls = null;
2460 private int? _batchSize = null;
2461 private int? _cacheSize = null;
2462 private float? _frameDelay = null;
2463 private float? _loopCount = null;
2466 /// Gets and Sets the url in the AnimatedImageVisual.
2468 /// <since_tizen> 3 </since_tizen>
2486 _urls = new List<string>();
2498 /// Gets and Sets the url list in the AnimatedImageVisual.
2500 /// <since_tizen> 4 </since_tizen>
2501 public List<string> URLS
2515 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2517 /// <since_tizen> 4 </since_tizen>
2518 public int BatchSize
2522 return _batchSize ?? 1;
2532 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2534 /// <since_tizen> 4 </since_tizen>
2535 public int CacheSize
2539 return _cacheSize ?? 1;
2549 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2551 /// <since_tizen> 4 </since_tizen>
2552 public float FrameDelay
2556 return _frameDelay ?? 0.1f;
2560 _frameDelay = value;
2566 /// Gets and sets the number of times the AnimatedImageVisual will be looped.
2567 /// The default is -1. If the number is less than 0 then it loops unlimited,otherwise loop loopCount times.
2569 /// <since_tizen> 5 </since_tizen>
2570 public float LoopCount
2574 return _loopCount ?? -1;
2584 /// Compose the out visual map.
2586 /// <since_tizen> 3 </since_tizen>
2587 protected override void ComposingPropertyMap()
2591 _outputVisualMap = new PropertyMap();
2592 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2593 if( _urls.Count == 1 )
2595 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2599 var urlArray = new PropertyArray();
2600 foreach( var url in _urls)
2602 urlArray.Add(new PropertyValue(url));
2604 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2606 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2607 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2608 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2609 if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
2610 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2611 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2612 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2613 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2619 //temporary fix for TCT
2621 /// A class encapsulating the property map of the transition data.
2623 /// <since_tizen> 3 </since_tizen>
2624 public class VisualAnimator : VisualMap
2627 /// Create VisualAnimator object.
2629 /// <since_tizen> 3 </since_tizen>
2630 public VisualAnimator() : base()
2634 private string _alphaFunction = null;
2635 private int _startTime = 0;
2636 private int _endTime = 0;
2637 private string _target = null;
2638 private string _propertyIndex = null;
2639 private object _destinationValue = null;
2642 /// Sets and Gets the AlphaFunction of this transition.
2644 /// <since_tizen> 3 </since_tizen>
2645 public AlphaFunction.BuiltinFunctions AlphaFunction
2649 switch (_alphaFunction)
2652 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2654 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2655 case "EASE_IN_SQUARE":
2656 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2657 case "EASE_OUT_SQUARE":
2658 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2660 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2662 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2664 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2665 case "EASE_IN_SINE":
2666 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2667 case "EASE_OUT_SINE":
2668 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2669 case "EASE_IN_OUT_SINE":
2670 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2672 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2674 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2675 case "EASE_OUT_BACK":
2676 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2678 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2685 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2687 _alphaFunction = "LINEAR";
2690 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2692 _alphaFunction = "REVERSE";
2695 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2697 _alphaFunction = "EASE_IN_SQUARE";
2700 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2702 _alphaFunction = "EASE_OUT_SQUARE";
2705 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2707 _alphaFunction = "EASE_IN";
2710 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2712 _alphaFunction = "EASE_OUT";
2715 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2717 _alphaFunction = "EASE_IN_OUT";
2720 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2722 _alphaFunction = "EASE_IN_SINE";
2725 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2727 _alphaFunction = "EASE_OUT_SINE";
2730 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2732 _alphaFunction = "EASE_IN_OUT_SINE";
2735 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2737 _alphaFunction = "BOUNCE";
2740 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2742 _alphaFunction = "SIN";
2745 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2747 _alphaFunction = "EASE_OUT_BACK";
2752 _alphaFunction = "DEFAULT";
2760 /// Sets and Gets the StartTime of this transition.
2762 /// <since_tizen> 3 </since_tizen>
2763 public int StartTime
2776 /// Sets and Gets the EndTime of this transition.
2778 /// <since_tizen> 3 </since_tizen>
2792 /// Sets and Gets the Target of this transition.
2794 /// <since_tizen> 3 </since_tizen>
2795 public string Target
2808 /// Sets and Gets the PropertyIndex of this transition.
2810 /// <since_tizen> 3 </since_tizen>
2811 public string PropertyIndex
2815 return _propertyIndex;
2819 _propertyIndex = value;
2824 /// Sets and Gets the DestinationValue of this transition.
2826 /// <since_tizen> 3 </since_tizen>
2827 public object DestinationValue
2831 return _destinationValue;
2835 _destinationValue = value;
2840 /// Compose the out visual map.
2842 /// <since_tizen> 3 </since_tizen>
2843 protected override void ComposingPropertyMap()
2845 PropertyMap _animator = new PropertyMap();
2846 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2848 PropertyMap _timePeriod = new PropertyMap();
2849 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2850 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2851 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2853 StringBuilder sb = new StringBuilder(_propertyIndex);
2854 sb[0] = (char)(sb[0] | 0x20);
2855 string _str = sb.ToString();
2857 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2859 PropertyMap _transition = new PropertyMap();
2860 _transition.Add("target", new PropertyValue(_target));
2861 _transition.Add("property", new PropertyValue(_str));
2862 _transition.Add("targetValue", val);
2863 _transition.Add("animator", new PropertyValue(_animator));
2865 _outputVisualMap = _transition;
2868 //temporary fix for TCT