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 map for visual.
537 /// <since_tizen> 3 </since_tizen>
538 protected PropertyMap _commonlyUsedMap = null;
541 /// The shader to use in the visual.
543 /// <since_tizen> 3 </since_tizen>
544 public PropertyMap Shader
558 /// Enables or disables the premultiplied alpha. <br />
559 /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
561 /// <since_tizen> 3 </since_tizen>
562 public bool PremultipliedAlpha
566 return _premultipliedAlpha ?? (false);
570 _premultipliedAlpha = value;
576 /// Mix color is a blend color for any visual.
578 /// <since_tizen> 3 </since_tizen>
579 public Color MixColor
593 /// Opacity is the alpha component of the mix color discussed above.
595 /// <since_tizen> 3 </since_tizen>
600 return _opacity ?? (1.0f);
612 /// A class encapsulating the property map of the image visual.
614 /// <since_tizen> 3 </since_tizen>
615 public class ImageVisual : VisualMap
620 /// <since_tizen> 3 </since_tizen>
621 public ImageVisual() : base()
625 private string _url = null;
626 private string _alphaMaskUrl = null;
627 private string _auxiliaryImageUrl = null;
628 private FittingModeType? _fittingMode = null;
629 private SamplingModeType? _samplingMode = null;
630 private int? _desiredWidth = null;
631 private int? _desiredHeight = null;
632 private bool? _synchronousLoading = false;
633 private bool? _borderOnly = null;
634 private Vector4 _pixelArea = null;
635 private WrapModeType? _wrapModeU = null;
636 private WrapModeType? _wrapModeV = null;
637 private float? _auxiliaryImageAlpha = null;
638 private float? _maskContentScale = null;
639 private bool? _cropToMask = null;
640 private ReleasePolicyType? _releasePolicy = null;
641 private LoadPolicyType? _loadPolicy = null;
642 private bool? _orientationCorrection = true;
645 /// Gets or sets the URL of the image.<br />
648 /// <since_tizen> 3 </since_tizen>
664 /// Gets or sets the URL of the alpha mask.<br />
667 /// <since_tizen> 3 </since_tizen>
668 public string AlphaMaskURL
672 return _alphaMaskUrl;
676 _alphaMaskUrl = value;
682 /// Overlays the auxiliary iamge on top of an NPatch image.
683 /// The resulting visual image will be at least as large as the smallest possible n-patch or the auxiliary image, whichever is larger.
685 /// <since_tizen> 5 </since_tizen>
686 public string AuxiliaryImageURL
690 return _auxiliaryImageUrl;
694 _auxiliaryImageUrl = value;
700 /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
701 /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
702 /// For normal quad images only.<br />
705 /// <since_tizen> 3 </since_tizen>
706 public FittingModeType FittingMode
710 return _fittingMode ?? (FittingModeType.ShrinkToFit);
714 _fittingMode = value;
720 /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
721 /// If not supplied, the default is SamplingModeType.Box.<br />
722 /// For normal quad images only.<br />
725 /// <since_tizen> 3 </since_tizen>
726 public SamplingModeType SamplingMode
730 return _samplingMode ?? (SamplingModeType.Box);
734 _samplingMode = value;
740 /// Gets or sets the desired image width.<br />
741 /// If not specified, the actual image width is used.<br />
742 /// For normal quad images only.<br />
745 /// <since_tizen> 3 </since_tizen>
746 public int DesiredWidth
750 return _desiredWidth ?? (-1);
754 _desiredWidth = value;
760 /// Gets or sets the desired image height.<br />
761 /// If not specified, the actual image height is used.<br />
762 /// For normal quad images only.<br />
765 /// <since_tizen> 3 </since_tizen>
766 public int DesiredHeight
770 return _desiredHeight ?? (-1);
774 _desiredHeight = value;
780 /// Gets or sets whether to load the image synchronously.<br />
781 /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
782 /// For normal quad images only.<br />
785 /// <since_tizen> 3 </since_tizen>
786 public bool SynchronousLoading
790 return _synchronousLoading ?? (false);
794 _synchronousLoading = value;
800 /// Gets or sets whether to draw the borders only (If true).<br />
801 /// If not specified, the default is false.<br />
802 /// For n-patch images only.<br />
805 /// <since_tizen> 3 </since_tizen>
806 public bool BorderOnly
810 return _borderOnly ?? (false);
820 /// Gets or sets the image area to be displayed.<br />
821 /// It is a rectangular area.<br />
822 /// 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 />
823 /// 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 />
824 /// For normal quad images only.<br />
827 /// <since_tizen> 3 </since_tizen>
828 public Vector4 PixelArea
832 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
842 /// Gets or sets the wrap mode for the u coordinate.<br />
843 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
844 /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
845 /// For normal quad images only.<br />
848 /// <since_tizen> 3 </since_tizen>
849 public WrapModeType WrapModeU
853 return _wrapModeU ?? (WrapModeType.Default);
863 /// Gets or sets the wrap mode for the v coordinate.<br />
864 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<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 is WrapModeType.Default(CLAMP).<br />
867 /// For normal quad images only.
870 /// <since_tizen> 3 </since_tizen>
871 public WrapModeType WrapModeV
875 return _wrapModeV ?? (WrapModeType.Default);
885 /// Gets or sets scale factor to apply to the content image before masking.
887 /// <since_tizen> 4 </since_tizen>
888 public float MaskContentScale
892 return _maskContentScale ?? 1.0f;
896 _maskContentScale = value;
902 /// Whether to crop image to mask or scale mask to fit image.
904 /// <since_tizen> 4 </since_tizen>
905 public bool CropToMask
909 return _cropToMask ?? false;
919 /// An alpha value for mixing between the masked main NPatch image and the auxiliary image.
921 /// <since_tizen> 5 </since_tizen>
922 public float AuxiliaryImageAlpha
926 return _auxiliaryImageAlpha ?? 1.0f;
930 _auxiliaryImageAlpha = value;
936 /// Get or set the Image Visual release policy<br />
937 /// It decides if a texture should be released from the cache or kept to reduce loading time <br />
939 /// <since_tizen> 5 </since_tizen>
940 public ReleasePolicyType ReleasePolicy
944 return _releasePolicy ?? (ReleasePolicyType.Destroyed );
948 _releasePolicy = value;
955 /// Get or set the Image Visual image loading policy<br />
956 /// It decides if a texture should be loaded immediately after source set or only after visual is added to window <br />
958 /// <since_tizen> 5 </since_tizen>
959 public LoadPolicyType LoadPolicy
963 return _loadPolicy ?? (LoadPolicyType.Attached);
973 /// Get or set whether to automatically correct the orientation based on exif data.<br />
974 /// If not specified, the default is true.<br />
975 /// For JPEG images only.<br />
978 /// <since_tizen> 5 </since_tizen>
979 public bool OrientationCorrection
983 return _orientationCorrection ?? (true);
987 _orientationCorrection = value;
994 /// Compose the out visual map.
996 /// <since_tizen> 3 </since_tizen>
997 protected override void ComposingPropertyMap()
1001 _outputVisualMap = new PropertyMap();
1002 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
1003 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
1004 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
1005 if (_auxiliaryImageUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(_auxiliaryImageUrl)); }
1006 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
1007 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
1008 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
1009 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
1010 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
1011 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1012 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
1013 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
1014 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
1015 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1016 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1017 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1018 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1019 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
1020 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
1021 if (_auxiliaryImageAlpha != null) { _outputVisualMap.Add((int)ImageVisualProperty.AuxiliaryImageAlpha, new PropertyValue((float)_auxiliaryImageAlpha)); }
1022 if (_releasePolicy != null) { _outputVisualMap.Add( ImageVisualProperty.ReleasePolicy , new PropertyValue((int)_releasePolicy)); }
1023 if (_loadPolicy != null) { _outputVisualMap.Add( ImageVisualProperty.LoadPolicy, new PropertyValue((int)_loadPolicy)); }
1024 if (_orientationCorrection != null) { _outputVisualMap.Add( ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
1030 /// A class encapsulating the property map of the text visual.
1032 /// <since_tizen> 3 </since_tizen>
1033 public class TextVisual : VisualMap
1038 /// <since_tizen> 3 </since_tizen>
1039 public TextVisual() : base()
1043 private string _text = null;
1044 private string _fontFamily = null;
1045 private PropertyMap _fontStyle = null;
1046 private float? _pointSize = null;
1047 private bool? _multiLine = null;
1048 private string _horizontalAlignment = null;
1049 private string _verticalAlignment = null;
1050 private Color _textColor = null;
1051 private bool? _enableMarkup = null;
1054 /// Gets or sets the text to display in the UTF-8 format.<br />
1057 /// <since_tizen> 3 </since_tizen>
1072 /// Gets or sets the requested font family to use.<br />
1075 /// <since_tizen> 3 </since_tizen>
1076 public string FontFamily
1084 _fontFamily = value;
1090 /// Gets or sets the requested font style to use.<br />
1093 /// <since_tizen> 3 </since_tizen>
1094 public PropertyMap FontStyle
1108 /// Gets or sets the size of font in points.<br />
1111 /// <since_tizen> 3 </since_tizen>
1112 public float PointSize
1116 return _pointSize ?? (0.0f);
1126 /// Gets or sets the single-line or multi-line layout option.<br />
1127 /// If not specified, the default is false.<br />
1130 /// <since_tizen> 3 </since_tizen>
1131 public bool MultiLine
1135 return _multiLine ?? (false);
1145 /// Gets or sets the line horizontal alignment.<br />
1146 /// If not specified, the default is begin.<br />
1149 /// <since_tizen> 3 </since_tizen>
1150 public HorizontalAlignment HorizontalAlignment
1154 switch (_horizontalAlignment)
1157 return HorizontalAlignment.Begin;
1159 return HorizontalAlignment.Center;
1161 return HorizontalAlignment.End;
1163 return HorizontalAlignment.Begin;
1170 case HorizontalAlignment.Begin:
1172 _horizontalAlignment = "BEGIN";
1175 case HorizontalAlignment.Center:
1177 _horizontalAlignment = "CENTER";
1180 case HorizontalAlignment.End:
1182 _horizontalAlignment = "END";
1187 _horizontalAlignment = "BEGIN";
1196 /// Gets or sets the line vertical alignment.<br />
1197 /// If not specified, the default is top.<br />
1200 /// <since_tizen> 3 </since_tizen>
1201 public VerticalAlignment VerticalAlignment
1205 switch (_verticalAlignment)
1208 return VerticalAlignment.Top;
1210 return VerticalAlignment.Center;
1212 return VerticalAlignment.Bottom;
1214 return VerticalAlignment.Top;
1221 case VerticalAlignment.Top:
1223 _verticalAlignment = "TOP";
1226 case VerticalAlignment.Center:
1228 _verticalAlignment = "CENTER";
1231 case VerticalAlignment.Bottom:
1233 _verticalAlignment = "BOTTOM";
1238 _verticalAlignment = "TOP";
1247 /// Gets or sets the color of the text.<br />
1250 /// <since_tizen> 3 </since_tizen>
1251 public Color TextColor
1265 /// Gets or sets whether the mark-up processing is enabled.<br />
1268 /// <since_tizen> 3 </since_tizen>
1269 public bool EnableMarkup
1273 return _enableMarkup ?? (false);
1277 _enableMarkup = value;
1283 /// Compose the out visual map.
1285 /// <since_tizen> 3 </since_tizen>
1286 protected override void ComposingPropertyMap()
1288 if (_text != null && _pointSize != null)
1290 _outputVisualMap = new PropertyMap();
1291 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1292 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1293 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1294 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1295 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1296 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1297 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1298 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1299 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1300 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1301 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1302 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1303 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1304 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1310 /// A class encapsulating the property map of the border visual.
1312 /// <since_tizen> 3 </since_tizen>
1313 public class BorderVisual : VisualMap
1318 /// <since_tizen> 3 </since_tizen>
1319 public BorderVisual() : base()
1323 private Color _color = null;
1324 private float? _size = null;
1325 private bool? _antiAliasing = null;
1328 /// Gets or sets the color of the border.<br />
1331 /// <since_tizen> 3 </since_tizen>
1346 /// Gets or sets the width of the border (in pixels).<br />
1349 /// <since_tizen> 3 </since_tizen>
1350 public float BorderSize
1354 return _size ?? (-1.0f);
1364 /// Gets or sets whether the anti-aliasing of the border is required.<br />
1365 /// If not supplied, the default is false.<br />
1368 /// <since_tizen> 3 </since_tizen>
1369 public bool AntiAliasing
1373 return _antiAliasing ?? (false);
1377 _antiAliasing = value;
1383 /// Compose the out visual map.
1385 /// <since_tizen> 3 </since_tizen>
1386 protected override void ComposingPropertyMap()
1388 if (_color != null && _size != null)
1390 _outputVisualMap = new PropertyMap();
1391 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1392 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1393 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1394 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1395 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1396 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1397 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1398 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1404 /// A class encapsulating the property map of the color visual.
1406 /// <since_tizen> 3 </since_tizen>
1407 public class ColorVisual : VisualMap
1412 /// <since_tizen> 3 </since_tizen>
1413 public ColorVisual() : base()
1417 private Color _mixColorForColorVisual = null;
1420 /// Gets or sets the solid color required.<br />
1423 /// <since_tizen> 3 </since_tizen>
1428 return _mixColorForColorVisual;
1432 _mixColorForColorVisual = value;
1438 /// Compose the out visual map.
1440 /// <since_tizen> 3 </since_tizen>
1441 protected override void ComposingPropertyMap()
1443 if (_mixColorForColorVisual != null)
1445 _outputVisualMap = new PropertyMap();
1446 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1447 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1448 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1449 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1450 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1456 /// A class encapsulating the property map of the gradient visual.
1458 /// <since_tizen> 3 </since_tizen>
1459 public class GradientVisual : VisualMap
1464 /// <since_tizen> 3 </since_tizen>
1465 public GradientVisual() : base()
1469 private Vector2 _startPosition = null;
1470 private Vector2 _endPosition = null;
1471 private Vector2 _center = null;
1472 private float? _radius = null;
1473 private PropertyArray _stopOffset = null;
1474 private PropertyArray _stopColor = null;
1475 private GradientVisualUnitsType? _units = null;
1476 private GradientVisualSpreadMethodType? _spreadMethod = null;
1479 /// Gets or sets the start position of a linear gradient.<br />
1480 /// Mandatory for linear.<br />
1482 /// <since_tizen> 3 </since_tizen>
1483 public Vector2 StartPosition
1487 return _startPosition;
1491 _startPosition = value;
1497 /// Gets or sets the end position of a linear gradient.<br />
1498 /// Mandatory for linear.<br />
1500 /// <since_tizen> 3 </since_tizen>
1501 public Vector2 EndPosition
1505 return _endPosition;
1509 _endPosition = value;
1515 /// Gets or sets the center point of a radial gradient.<br />
1516 /// Mandatory for radial.<br />
1518 /// <since_tizen> 3 </since_tizen>
1519 public Vector2 Center
1533 /// Gets or sets the size of the radius of a radial gradient.<br />
1534 /// Mandatory for radial.<br />
1536 /// <since_tizen> 3 </since_tizen>
1541 return _radius ?? (-1.0f);
1551 /// Gets or sets all the stop offsets.<br />
1552 /// A PropertyArray of float.<br />
1553 /// If not supplied, the default is 0.0f and 1.0f.<br />
1556 /// <since_tizen> 3 </since_tizen>
1557 public PropertyArray StopOffset
1565 _stopOffset = value;
1571 /// Gets or sets the color at the stop offsets.<br />
1572 /// A PropertyArray of color.<br />
1573 /// At least 2 values are required to show a gradient.<br />
1576 /// <since_tizen> 3 </since_tizen>
1577 public PropertyArray StopColor
1591 /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1592 /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1595 /// <since_tizen> 3 </since_tizen>
1596 public GradientVisualUnitsType Units
1600 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1610 /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1611 /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1614 /// <since_tizen> 3 </since_tizen>
1615 public GradientVisualSpreadMethodType SpreadMethod
1619 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1623 _spreadMethod = value;
1629 /// Compose the out visual map.
1631 /// <since_tizen> 3 </since_tizen>
1632 protected override void ComposingPropertyMap()
1634 if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1636 _outputVisualMap = new PropertyMap();
1637 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1638 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1639 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1640 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1641 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1642 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1643 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1644 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1645 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1646 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1647 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1648 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1649 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1655 /// A class encapsulating the property map of the mesh visual.
1657 /// <since_tizen> 3 </since_tizen>
1658 public class MeshVisual : VisualMap
1663 /// <since_tizen> 3 </since_tizen>
1664 public MeshVisual() : base()
1668 private string _objectURL = null;
1669 private string _materialtURL = null;
1670 private string _texturesPath = null;
1671 private MeshVisualShadingModeValue? _shadingMode = null;
1672 private bool? _useMipmapping = null;
1673 private bool? _useSoftNormals = null;
1674 private Vector3 _lightPosition = null;
1677 /// Gets or sets the location of the ".obj" file.<br />
1680 /// <since_tizen> 3 </since_tizen>
1681 public string ObjectURL
1695 /// Gets or sets the location of the ".mtl" file.<br />
1696 /// If not specified, then a textureless object is assumed.<br />
1699 /// <since_tizen> 3 </since_tizen>
1700 public string MaterialtURL
1704 return _materialtURL;
1708 _materialtURL = value;
1714 /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1715 /// Mandatory if using material.<br />
1717 /// <since_tizen> 3 </since_tizen>
1718 public string TexturesPath
1722 return _texturesPath;
1726 _texturesPath = value;
1732 /// Gets or sets the type of shading mode that the mesh will use.<br />
1733 /// 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 />
1734 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1737 /// <since_tizen> 3 </since_tizen>
1738 public MeshVisualShadingModeValue ShadingMode
1742 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1746 _shadingMode = value;
1752 /// Gets or sets whether to use mipmaps for textures or not.<br />
1753 /// If not specified, the default is true.<br />
1756 /// <since_tizen> 3 </since_tizen>
1757 public bool UseMipmapping
1761 return _useMipmapping ?? (true);
1765 _useMipmapping = value;
1771 /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1772 /// If not specified, the default is true.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public bool UseSoftNormals
1780 return _useSoftNormals ?? (true);
1784 _useSoftNormals = value;
1790 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1791 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1792 /// and using all zeroes will place the light at the top-left corner.<br />
1793 /// If not specified, the default is an offset outwards from the center of the screen.<br />
1796 /// <since_tizen> 3 </since_tizen>
1797 public Vector3 LightPosition
1801 return _lightPosition;
1805 _lightPosition = value;
1811 /// Compose the out visual map.
1813 /// <since_tizen> 3 </since_tizen>
1814 protected override void ComposingPropertyMap()
1816 if (_objectURL != null)
1818 _outputVisualMap = new PropertyMap();
1819 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1820 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1821 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1822 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1823 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1824 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1825 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1826 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1827 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1828 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1829 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1835 /// A class encapsulating the property map of the primetive visual.
1837 /// <since_tizen> 3 </since_tizen>
1838 public class PrimitiveVisual : VisualMap
1843 /// <since_tizen> 3 </since_tizen>
1844 public PrimitiveVisual() : base()
1848 private PrimitiveVisualShapeType? _shape = null;
1849 private Color _mixColorForPrimitiveVisual = null;
1850 private int? _slices = null;
1851 private int? _stacks = null;
1852 private float? _scaleTopRadius = null;
1853 private float? _scaleBottomRadius = null;
1854 private float? _scaleHeight = null;
1855 private float? _scaleRadius = null;
1856 private Vector3 _scaleDimensions = null;
1857 private float? _bevelPercentage = null;
1858 private float? _bevelSmoothness = null;
1859 private Vector3 _lightPosition = null;
1862 /// Gets or sets the specific shape to render.<br />
1863 /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
1866 /// <since_tizen> 3 </since_tizen>
1867 public PrimitiveVisualShapeType Shape
1871 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1881 /// Gets or sets the color of the shape.<br />
1882 /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
1883 /// Applies to all shapes.<br />
1886 /// <since_tizen> 3 </since_tizen>
1887 public new Color MixColor
1891 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1895 _mixColorForPrimitiveVisual = value;
1901 /// Gets or sets the number of slices as you go around the shape.<br />
1902 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
1903 /// If not specified, the default is 128.<br />
1904 /// The range is from 1 to 255.<br />
1907 /// <since_tizen> 3 </since_tizen>
1912 return _slices ?? (128);
1922 /// Gets or sets the number of stacks as you go down the shape.<br />
1923 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
1924 /// If not specified, the default is 128.<br />
1925 /// The range is from 1 to 255.<br />
1928 /// <since_tizen> 3 </since_tizen>
1933 return _stacks ?? (128);
1943 /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
1944 /// If not specified, the default is 1.0f.<br />
1945 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1946 /// Only values greater than or equal to 0.0f are accepted.<br />
1949 /// <since_tizen> 3 </since_tizen>
1950 public float ScaleTopRadius
1954 return _scaleTopRadius ?? (1.0f);
1958 _scaleTopRadius = value;
1964 /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
1965 /// If not specified, the default is 1.5f.<br />
1966 /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1967 /// - PrimitiveVisualShapeType.Cone<br />
1968 /// Only values greater than or equal to 0.0f are accepted.<br />
1971 /// <since_tizen> 3 </since_tizen>
1972 public float ScaleBottomRadius
1976 return _scaleBottomRadius ?? (1.5f);
1980 _scaleBottomRadius = value;
1986 /// Gets or sets the scale of the height of a conic.<br />
1987 /// If not specified, the default is 3.0f.<br />
1988 /// Applies to:<br />
1989 /// - PrimitiveVisualShapeType.ConicalFrustrum<br />
1990 /// - PrimitiveVisualShapeType.Cone<br />
1991 /// - PrimitiveVisualShapeType.Cylinder<br />
1992 /// Only values greater than or equal to 0.0f are accepted.<br />
1995 /// <since_tizen> 3 </since_tizen>
1996 public float ScaleHeight
2000 return _scaleHeight ?? (3.0f);
2004 _scaleHeight = value;
2010 /// Gets or sets the scale of the radius of a cylinder.<br />
2011 /// If not specified, the default is 1.0f.<br />
2012 /// Applies to:<br />
2013 /// - PrimitiveVisualShapeType.Cylinder<br />
2014 /// Only values greater than or equal to 0.0f are accepted.<br />
2017 /// <since_tizen> 3 </since_tizen>
2018 public float ScaleRadius
2022 return _scaleRadius ?? (1.0f);
2026 _scaleRadius = value;
2032 /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
2033 /// If not specified, the default is Vector3.One.<br />
2034 /// Applies to:<br />
2035 /// - PrimitiveVisualShapeType.Cube<br />
2036 /// - PrimitiveVisualShapeType.Octahedron<br />
2037 /// - PrimitiveVisualShapeType.BevelledCube<br />
2038 /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
2041 /// <since_tizen> 3 </since_tizen>
2042 public Vector3 ScaleDimensions
2046 return _scaleDimensions ?? (Vector3.One);
2050 _scaleDimensions = value;
2056 /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
2057 /// 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 />
2058 /// If not specified, the default is 0.0f (no bevel).<br />
2059 /// Applies to:<br />
2060 /// - PrimitiveVisualShapeType.BevelledCube<br />
2061 /// The range is from 0.0f to 1.0f.<br />
2064 /// <since_tizen> 3 </since_tizen>
2065 public float BevelPercentage
2069 return _bevelPercentage ?? (0.0f);
2073 _bevelPercentage = value;
2079 /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
2080 /// If not specified, the default is 0.0f (sharp edges).<br />
2081 /// Applies to:<br />
2082 /// - PrimitiveVisualShapeType.BevelledCube<br />
2083 /// The range is from 0.0f to 1.0f.<br />
2086 /// <since_tizen> 3 </since_tizen>
2087 public float BevelSmoothness
2091 return _bevelSmoothness ?? (0.0f);
2095 _bevelSmoothness = value;
2101 /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2102 /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2103 /// and using all zeroes will place the light at the top-left corner.<br />
2104 /// If not specified, the default is an offset outwards from the center of the screen.<br />
2105 /// Applies to all shapes.<br />
2108 /// <since_tizen> 3 </since_tizen>
2109 public Vector3 LightPosition
2113 return _lightPosition;
2117 _lightPosition = value;
2123 /// Compose the out visual map.
2125 /// <since_tizen> 3 </since_tizen>
2126 protected override void ComposingPropertyMap()
2128 _outputVisualMap = new PropertyMap(); ;
2129 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2130 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2131 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2132 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2133 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2134 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2135 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2136 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2137 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2138 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2139 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2140 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2141 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2142 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2143 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2144 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2149 /// A class encapsulating the property map of the n-patch image visual.
2151 /// <since_tizen> 3 </since_tizen>
2152 public class NPatchVisual : VisualMap
2157 /// <since_tizen> 3 </since_tizen>
2158 public NPatchVisual() : base()
2162 private string _url = null;
2163 private bool? _borderOnly = null;
2164 private Rectangle _border = null;
2167 /// Gets or sets the URL of the image.<br />
2170 /// <since_tizen> 3 </since_tizen>
2185 /// Gets or sets whether to draw the borders only (If true).<br />
2186 /// If not specified, the default is false.<br />
2187 /// For n-patch images only.<br />
2190 /// <since_tizen> 3 </since_tizen>
2191 public bool BorderOnly
2195 return _borderOnly ?? false;
2199 _borderOnly = value;
2205 /// The border of the image is in the order: left, right, bottom, top.<br />
2206 /// For n-patch images only.<br />
2209 /// <since_tizen> 3 </since_tizen>
2210 public Rectangle Border
2224 /// Compose the out visual map.
2226 /// <since_tizen> 3 </since_tizen>
2227 protected override void ComposingPropertyMap()
2231 _outputVisualMap = new PropertyMap();
2232 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2233 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2234 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2235 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2236 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2237 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2238 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2239 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2245 /// A class encapsulating the property map of the SVG visual.
2247 /// <since_tizen> 3 </since_tizen>
2248 public class SVGVisual : VisualMap
2253 /// <since_tizen> 3 </since_tizen>
2254 public SVGVisual() : base()
2258 private string _url = null;
2261 /// The url of the svg resource.
2263 /// <since_tizen> 3 </since_tizen>
2278 /// Compose the out visual map.
2280 /// <since_tizen> 3 </since_tizen>
2281 protected override void ComposingPropertyMap()
2285 _outputVisualMap = new PropertyMap();
2286 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2287 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2288 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2289 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2290 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2291 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2297 /// A class encapsulating the property map of the animated image (AGIF) visual.
2299 /// <since_tizen> 3 </since_tizen>
2300 public class AnimatedImageVisual : VisualMap
2305 /// <since_tizen> 3 </since_tizen>
2306 public AnimatedImageVisual() : base()
2310 private List<string> _urls = null;
2311 private int? _batchSize = null;
2312 private int? _cacheSize = null;
2313 private float? _frameDelay = null;
2314 private float? _loopCount = null;
2317 /// Gets and Sets the url in the AnimatedImageVisual.
2319 /// <since_tizen> 3 </since_tizen>
2337 _urls = new List<string>();
2349 /// Gets and Sets the url list in the AnimatedImageVisual.
2351 /// <since_tizen> 4 </since_tizen>
2352 public List<string> URLS
2366 /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2368 /// <since_tizen> 4 </since_tizen>
2369 public int BatchSize
2373 return _batchSize ?? 1;
2383 /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2385 /// <since_tizen> 4 </since_tizen>
2386 public int CacheSize
2390 return _cacheSize ?? 1;
2400 /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2402 /// <since_tizen> 4 </since_tizen>
2403 public float FrameDelay
2407 return _frameDelay ?? 0.1f;
2411 _frameDelay = value;
2417 /// Gets and Sets the number of times the AnimatedImageVisual will be looped.
2418 /// Default -1. if less than 0, loop unlimited. else, loop loopCount times.
2420 /// <since_tizen> 5 </since_tizen>
2421 public float LoopCount
2425 return _loopCount ?? -1;
2435 /// Compose the out visual map.
2437 /// <since_tizen> 3 </since_tizen>
2438 protected override void ComposingPropertyMap()
2442 _outputVisualMap = new PropertyMap();
2443 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2444 if( _urls.Count == 1 )
2446 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2450 var urlArray = new PropertyArray();
2451 foreach( var url in _urls)
2453 urlArray.Add(new PropertyValue(url));
2455 _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2457 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2458 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2459 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2460 if (_loopCount != null ) {_outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
2461 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2462 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2463 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2464 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2470 //temporary fix for TCT
2472 /// A class encapsulating the property map of the transition data.
2474 /// <since_tizen> 3 </since_tizen>
2475 public class VisualAnimator : VisualMap
2478 /// Create VisualAnimator object.
2480 /// <since_tizen> 3 </since_tizen>
2481 public VisualAnimator() : base()
2485 private string _alphaFunction = null;
2486 private int _startTime = 0;
2487 private int _endTime = 0;
2488 private string _target = null;
2489 private string _propertyIndex = null;
2490 private object _destinationValue = null;
2493 /// Sets and Gets the AlphaFunction of this transition.
2495 /// <since_tizen> 3 </since_tizen>
2496 public AlphaFunction.BuiltinFunctions AlphaFunction
2500 switch (_alphaFunction)
2503 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2505 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2506 case "EASE_IN_SQUARE":
2507 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2508 case "EASE_OUT_SQUARE":
2509 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2511 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2513 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2515 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2516 case "EASE_IN_SINE":
2517 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2518 case "EASE_OUT_SINE":
2519 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2520 case "EASE_IN_OUT_SINE":
2521 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2523 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2525 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2526 case "EASE_OUT_BACK":
2527 return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2529 return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2536 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2538 _alphaFunction = "LINEAR";
2541 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2543 _alphaFunction = "REVERSE";
2546 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2548 _alphaFunction = "EASE_IN_SQUARE";
2551 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2553 _alphaFunction = "EASE_OUT_SQUARE";
2556 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2558 _alphaFunction = "EASE_IN";
2561 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2563 _alphaFunction = "EASE_OUT";
2566 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2568 _alphaFunction = "EASE_IN_OUT";
2571 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2573 _alphaFunction = "EASE_IN_SINE";
2576 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2578 _alphaFunction = "EASE_OUT_SINE";
2581 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2583 _alphaFunction = "EASE_IN_OUT_SINE";
2586 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2588 _alphaFunction = "BOUNCE";
2591 case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2593 _alphaFunction = "SIN";
2596 case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2598 _alphaFunction = "EASE_OUT_BACK";
2603 _alphaFunction = "DEFAULT";
2611 /// Sets and Gets the StartTime of this transition.
2613 /// <since_tizen> 3 </since_tizen>
2614 public int StartTime
2627 /// Sets and Gets the EndTime of this transition.
2629 /// <since_tizen> 3 </since_tizen>
2643 /// Sets and Gets the Target of this transition.
2645 /// <since_tizen> 3 </since_tizen>
2646 public string Target
2659 /// Sets and Gets the PropertyIndex of this transition.
2661 /// <since_tizen> 3 </since_tizen>
2662 public string PropertyIndex
2666 return _propertyIndex;
2670 _propertyIndex = value;
2675 /// Sets and Gets the DestinationValue of this transition.
2677 /// <since_tizen> 3 </since_tizen>
2678 public object DestinationValue
2682 return _destinationValue;
2686 _destinationValue = value;
2691 /// Compose the out visual map.
2693 /// <since_tizen> 3 </since_tizen>
2694 protected override void ComposingPropertyMap()
2696 PropertyMap _animator = new PropertyMap();
2697 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2699 PropertyMap _timePeriod = new PropertyMap();
2700 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2701 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2702 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2704 StringBuilder sb = new StringBuilder(_propertyIndex);
2705 sb[0] = (char)(sb[0] | 0x20);
2706 string _str = sb.ToString();
2708 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2710 PropertyMap _transition = new PropertyMap();
2711 _transition.Add("target", new PropertyValue(_target));
2712 _transition.Add("property", new PropertyValue(_str));
2713 _transition.Add("targetValue", val);
2714 _transition.Add("animator", new PropertyValue(_animator));
2716 _outputVisualMap = _transition;
2719 //temporary fix for TCT