[NUI] Setting since_tizen 3/4 on Tizen.NUI API
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / VisualMaps.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18
19 namespace Tizen.NUI
20 {
21     using System.Text;
22     using System.Collections.Generic;
23     using Tizen.NUI.BaseComponents;
24
25     /// <summary>
26     /// A class encapsulating the transform map of the visual.
27     /// </summary>
28     /// <since_tizen> 3 </since_tizen>
29     public class VisualMap
30     {
31         private Vector2 _visualSize = null;
32         private Vector2 _visualOffset = null;
33         private Vector2 _visualOffsetPolicy = null;
34         private Vector2 _visualSizePolicy = null;
35         private Visual.AlignType? _visualOrigin = null;
36         private Visual.AlignType? _visualAnchorPoint = null;
37
38         private PropertyMap _visualTransformMap = null;
39
40         private int? _depthIndex = null;
41
42         /// <summary>
43         /// outputVisualMap.
44         /// </summary>
45         /// <since_tizen> 3 </since_tizen>
46         protected PropertyMap _outputVisualMap = null;
47
48         internal string Name
49         {
50             set;
51             get;
52         }
53
54         internal int VisualIndex
55         {
56             set;
57             get;
58         }
59
60         internal VisualView Parent
61         {
62             set;
63             get;
64         }
65
66         /// <summary>
67         /// Constructor.
68         /// </summary>
69         /// <since_tizen> 3 </since_tizen>
70         public VisualMap()
71         {
72         }
73
74         /// <summary>
75         /// Gets or sets the size of the visual.<br />
76         /// It can be either relative (percentage of the parent)
77         /// or absolute (in world units).<br />
78         /// Optional.
79         /// </summary>
80         /// <since_tizen> 3 </since_tizen>
81         public Size2D Size
82         {
83             get
84             {
85                 return _visualSize ?? (new Size2D(1, 1));
86             }
87             set
88             {
89                 _visualSize = value;
90                 if (_visualSizePolicy == null)
91                 {
92                     _visualSizePolicy = new Vector2(1.0f, 1.0f);
93                 }
94                 UpdateVisual();
95             }
96         }
97
98         /// <summary>
99         /// Gets or sets the offset of the visual.<br />
100         /// It can be either relative (percentage of the parent)
101         /// or absolute (in world units).<br />
102         /// Optional.
103         /// </summary>
104         /// <since_tizen> 3 </since_tizen>
105         public Vector2 Position
106         {
107             get
108             {
109                 return _visualOffset ?? (new Vector2(0.0f, 0.0f));
110             }
111             set
112             {
113                 _visualOffset = value;
114                 if (_visualOffsetPolicy == null)
115                 {
116                     _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
117                 }
118                 UpdateVisual();
119             }
120         }
121
122         /// <summary>
123         /// Gets or sets the relative size of the visual<br />
124         /// (percentage [0.0f to 1.0f] of the control).<br />
125         /// Optional.
126         /// </summary>
127         /// <since_tizen> 3 </since_tizen>
128         public RelativeVector2 RelativeSize
129         {
130             get
131             {
132                 return _visualSize ?? (new RelativeVector2(1.0f, 1.0f));
133             }
134             set
135             {
136                 _visualSize = value;
137                 _visualSizePolicy = new Vector2(0.0f, 0.0f);
138                 UpdateVisual();
139             }
140         }
141
142         /// <summary>
143         /// Gets or sets the relative offset of the visual<br />
144         /// (percentage [0.0f to 1.0f] of the control).<br />
145         /// Optional.
146         /// </summary>
147         /// <since_tizen> 3 </since_tizen>
148         public RelativeVector2 RelativePosition
149         {
150             get
151             {
152                 return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f));
153             }
154             set
155             {
156                 _visualOffset = value;
157                 _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
158                 UpdateVisual();
159             }
160         }
161
162         /// <summary>
163         /// Gets or sets whether the x and y offset values are relative<br />
164         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
165         /// By default, both the x and the y offset are relative.<br />
166         /// Optional.
167         /// </summary>
168         /// <since_tizen> 3 </since_tizen>
169         public VisualTransformPolicyType PositionPolicy
170         {
171             get
172             {
173                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f
174                     && _visualOffsetPolicy.Y == 1.0f)
175                 {
176                     return VisualTransformPolicyType.Absolute;
177                 }
178                 return VisualTransformPolicyType.Relative;
179             }
180             set
181             {
182                 switch (value)
183                 {
184                     case VisualTransformPolicyType.Relative:
185                         _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
186                         break;
187                     case VisualTransformPolicyType.Absolute:
188                         _visualOffsetPolicy = new Vector2(1.0f, 1.0f);
189                         break;
190                     default:
191                         _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
192                         break;
193                 }
194                 UpdateVisual();
195             }
196         }
197
198         /// <summary>
199         /// Gets or sets whether the x offset values are relative<br />
200         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
201         /// By default, the x offset is relative.<br />
202         /// Optional.
203         /// </summary>
204         /// <since_tizen> 3 </since_tizen>
205         public VisualTransformPolicyType PositionPolicyX
206         {
207             get
208             {
209                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f)
210                 {
211                     return VisualTransformPolicyType.Absolute;
212                 }
213                 return VisualTransformPolicyType.Relative;
214             }
215             set
216             {
217                 if (_visualOffsetPolicy == null)
218                 {
219                     _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
220                 }
221
222                 switch (value)
223                 {
224                     case VisualTransformPolicyType.Relative:
225                         _visualOffsetPolicy.X = 0.0f;
226                         break;
227                     case VisualTransformPolicyType.Absolute:
228                         _visualOffsetPolicy.X = 1.0f;
229                         break;
230                     default:
231                         _visualOffsetPolicy.X = 0.0f;
232                         break;
233                 }
234
235                 UpdateVisual();
236             }
237         }
238
239         /// <summary>
240         /// Gets or sets whether the y offset values are relative<br />
241         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
242         /// By default, the y offset is relative.<br />
243         /// Optional.
244         /// </summary>
245         /// <since_tizen> 3 </since_tizen>
246         public VisualTransformPolicyType PositionPolicyY
247         {
248             get
249             {
250                 if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f)
251                 {
252                     return VisualTransformPolicyType.Absolute;
253                 }
254                 return VisualTransformPolicyType.Relative;
255             }
256             set
257             {
258                 if (_visualOffsetPolicy == null)
259                 {
260                     _visualOffsetPolicy = new Vector2(0.0f, 0.0f);
261                 }
262
263                 switch (value)
264                 {
265                     case VisualTransformPolicyType.Relative:
266                         _visualOffsetPolicy.Y = 0.0f;
267                         break;
268                     case VisualTransformPolicyType.Absolute:
269                         _visualOffsetPolicy.Y = 1.0f;
270                         break;
271                     default:
272                         _visualOffsetPolicy.Y = 0.0f;
273                         break;
274                 }
275                 UpdateVisual();
276             }
277         }
278
279         /// <summary>
280         /// Gets or sets whether the size values of the width or the height are relative<br />
281         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
282         /// By default, offsets of both the width and the height are relative to the control's size.<br />
283         /// Optional.
284         /// </summary>
285         /// <since_tizen> 3 </since_tizen>
286         public VisualTransformPolicyType SizePolicy
287         {
288             get
289             {
290                 if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f
291                     && _visualSizePolicy.Y == 1.0f)
292                 {
293                     return VisualTransformPolicyType.Absolute;
294                 }
295                 return VisualTransformPolicyType.Relative;
296             }
297             set
298             {
299                 switch (value)
300                 {
301                     case VisualTransformPolicyType.Relative:
302                         _visualSizePolicy = new Vector2(0.0f, 0.0f);
303                         break;
304                     case VisualTransformPolicyType.Absolute:
305                         _visualSizePolicy = new Vector2(1.0f, 1.0f);
306                         break;
307                     default:
308                         _visualSizePolicy = new Vector2(0.0f, 0.0f);
309                         break;
310                 }
311                 UpdateVisual();
312             }
313         }
314
315         /// <summary>
316         /// Gets or sets whether size values of the width are relative.<br />
317         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
318         /// By default, the value of the width is relative to the control's width.<br />
319         /// Optional.
320         /// </summary>
321         /// <since_tizen> 3 </since_tizen>
322         public VisualTransformPolicyType SizePolicyWidth
323         {
324             get
325             {
326                 if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f)
327                 {
328                     return VisualTransformPolicyType.Absolute;
329                 }
330                 return VisualTransformPolicyType.Relative;
331             }
332             set
333             {
334                 if (_visualSizePolicy == null)
335                 {
336                     _visualSizePolicy = new Vector2(0.0f, 0.0f);
337                 }
338
339                 switch (value)
340                 {
341                     case VisualTransformPolicyType.Relative:
342                         _visualSizePolicy.Width = 0.0f;
343                         break;
344                     case VisualTransformPolicyType.Absolute:
345                         _visualSizePolicy.Width = 1.0f;
346                         break;
347                     default:
348                         _visualSizePolicy.Width = 0.0f;
349                         break;
350                 }
351                 UpdateVisual();
352             }
353         }
354
355         /// <summary>
356         /// Gets or sets whether size values of the height are relative<br />
357         /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).<br />
358         /// By default, the height value is relative to the control's height.<br />
359         /// Optional.
360         /// </summary>
361         /// <since_tizen> 3 </since_tizen>
362         public VisualTransformPolicyType SizePolicyHeight
363         {
364             get
365             {
366                 if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f)
367                 {
368                     return VisualTransformPolicyType.Absolute;
369                 }
370                 return VisualTransformPolicyType.Relative;
371             }
372             set
373             {
374                 if (_visualSizePolicy == null)
375                 {
376                     _visualSizePolicy = new Vector2(0.0f, 0.0f);
377                 }
378
379                 switch (value)
380                 {
381                     case VisualTransformPolicyType.Relative:
382                         _visualSizePolicy.Height = 0.0f;
383                         break;
384                     case VisualTransformPolicyType.Absolute:
385                         _visualSizePolicy.Height = 1.0f;
386                         break;
387                     default:
388                         _visualSizePolicy.Height = 0.0f;
389                         break;
390                 }
391                 UpdateVisual();
392             }
393         }
394
395         /// <summary>
396         /// Gets or sets the origin of the visual within its control area.<br />
397         /// By default, the origin is center.<br />
398         /// Optional.
399         /// </summary>
400         /// <since_tizen> 3 </since_tizen>
401         public Visual.AlignType Origin
402         {
403             get
404             {
405                 return _visualOrigin ?? (Visual.AlignType.Center);
406             }
407             set
408             {
409                 _visualOrigin = value;
410                 UpdateVisual();
411             }
412         }
413
414         /// <summary>
415         /// Gets or sets the anchor point of the visual.<br />
416         /// By default, the anchor point is center.<br />
417         /// Optional.
418         /// </summary>
419         /// <since_tizen> 3 </since_tizen>
420         public Visual.AlignType AnchorPoint
421         {
422             get
423             {
424                 return _visualAnchorPoint ?? (Visual.AlignType.Center);
425             }
426             set
427             {
428                 _visualAnchorPoint = value;
429                 UpdateVisual();
430             }
431         }
432
433         /// <summary>
434         /// Gets or sets the depth index of the visual.<br />
435         /// By default, the depth index is 0.<br />
436         /// Optional.
437         /// </summary>
438         /// <since_tizen> 3 </since_tizen>
439         public int DepthIndex
440         {
441             get
442             {
443                 return _depthIndex ?? (0);
444             }
445             set
446             {
447                 _depthIndex = value;
448             }
449         }
450
451         private void ComposingTransformMap()
452         {
453             _visualTransformMap = new PropertyMap();
454             if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
455             if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
456             if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
457             if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
458             if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
459             if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
460         }
461
462         /// <summary>
463         /// Gets the transform map used by the visual.
464         /// </summary>
465         /// <since_tizen> 3 </since_tizen>
466         public PropertyMap OutputTransformMap
467         {
468             get
469             {
470                 ComposingTransformMap();
471                 return _visualTransformMap;
472             }
473         }
474
475         /// <summary>
476         /// Compose the out visual map.
477         /// </summary>
478         /// <since_tizen> 3 </since_tizen>
479         protected virtual void ComposingPropertyMap()
480         {
481             _outputVisualMap = new PropertyMap();
482         }
483
484         /// <summary>
485         /// Gets the property map to create the visual.
486         /// </summary>
487         /// <since_tizen> 3 </since_tizen>
488         public PropertyMap OutputVisualMap
489         {
490             get
491             {
492                 ComposingPropertyMap();
493                 return _outputVisualMap;
494             }
495         }
496
497         internal void UpdateVisual()
498         {
499             if (VisualIndex > 0)
500             {
501                 NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex);
502                 Parent.UpdateVisual(VisualIndex, Name, this);
503             }
504             else
505             {
506                 NUILog.Debug("VisualIndex was not set");
507             }
508         }
509
510         /// <summary>
511         /// The shader of the visual.
512         /// </summary>
513         /// <since_tizen> 3 </since_tizen>
514         protected PropertyMap _shader = null;
515         //private PropertyMap _transform = null;
516
517         /// <summary>
518         /// The premultipliedAlpha of the visual.
519         /// </summary>
520         /// <since_tizen> 3 </since_tizen>
521         protected bool? _premultipliedAlpha = null;
522
523         /// <summary>
524         /// The mixColor of the Visual.
525         /// </summary>
526         /// <since_tizen> 3 </since_tizen>
527         protected Color _mixColor = null;
528
529         /// <summary>
530         /// The opacity of the visual.
531         /// </summary>
532         /// <since_tizen> 3 </since_tizen>
533         protected float? _opacity = null;
534
535         /// <summary>
536         /// The map for visual.
537         /// </summary>
538         /// <since_tizen> 3 </since_tizen>
539         protected PropertyMap _commonlyUsedMap = null;
540
541         /// <summary>
542         /// The shader to use in the visual.
543         /// </summary>
544         /// <since_tizen> 3 </since_tizen>
545         public PropertyMap Shader
546         {
547             get
548             {
549                 return _shader;
550             }
551             set
552             {
553                 _shader = value;
554                 UpdateVisual();
555             }
556         }
557
558         /// <summary>
559         /// Enables or disables the premultiplied alpha. <br />
560         /// The premultiplied alpha is false by default unless this behavior is modified by the derived visual type.
561         /// </summary>
562         /// <since_tizen> 3 </since_tizen>
563         public bool PremultipliedAlpha
564         {
565             get
566             {
567                 return _premultipliedAlpha ?? (false);
568             }
569             set
570             {
571                 _premultipliedAlpha = value;
572                 UpdateVisual();
573             }
574         }
575
576         /// <summary>
577         /// Mix color is a blend color for any visual.
578         /// </summary>
579         /// <since_tizen> 3 </since_tizen>
580         public Color MixColor
581         {
582             get
583             {
584                 return _mixColor;
585             }
586             set
587             {
588                 _mixColor = value;
589                 UpdateVisual();
590             }
591         }
592
593         /// <summary>
594         /// Opacity is the alpha component of the mix color discussed above.
595         /// </summary>
596         /// <since_tizen> 3 </since_tizen>
597         public float Opacity
598         {
599             get
600             {
601                 return _opacity ?? (1.0f);
602             }
603             set
604             {
605                 _opacity = value;
606                 UpdateVisual();
607             }
608         }
609
610     }
611
612     /// <summary>
613     /// A class encapsulating the property map of the image visual.
614     /// </summary>
615     /// <since_tizen> 3 </since_tizen>
616     public class ImageVisual : VisualMap
617     {
618         /// <summary>
619         /// Constructor.
620         /// </summary>
621         /// <since_tizen> 3 </since_tizen>
622         public ImageVisual() : base()
623         {
624         }
625
626         private string _url = null;
627         private string _alphaMaskUrl = 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? _maskContentScale = null;
638         private bool? _cropToMask = null;
639
640         /// <summary>
641         /// Gets or sets the URL of the image.<br />
642         /// Mandatory.
643         /// </summary>
644         /// <since_tizen> 3 </since_tizen>
645         public string URL
646         {
647             get
648             {
649                 return _url;
650             }
651             set
652             {
653                 _url = value;
654                 UpdateVisual();
655             }
656         }
657
658
659         /// <summary>
660         /// Gets or sets the URL of the alpha mask.<br />
661         /// Optional.
662         /// </summary>
663         /// <since_tizen> 3 </since_tizen>
664         public string AlphaMaskURL
665         {
666             get
667             {
668                 return _alphaMaskUrl;
669             }
670             set
671             {
672                 _alphaMaskUrl = value;
673                 UpdateVisual();
674             }
675         }
676
677         /// <summary>
678         /// Gets or sets fitting options used when resizing images to fit the desired dimensions.<br />
679         /// If not supplied, the default is FittingModeType.ShrinkToFit.<br />
680         /// For normal quad images only.<br />
681         /// Optional.
682         /// </summary>
683         /// <since_tizen> 3 </since_tizen>
684         public FittingModeType FittingMode
685         {
686             get
687             {
688                 return _fittingMode ?? (FittingModeType.ShrinkToFit);
689             }
690             set
691             {
692                 _fittingMode = value;
693                 UpdateVisual();
694             }
695         }
696
697         /// <summary>
698         /// Gets or sets filtering options used when resizing images to the sample original pixels.<br />
699         /// If not supplied, the default is SamplingModeType.Box.<br />
700         /// For normal quad images only.<br />
701         /// Optional.
702         /// </summary>
703         /// <since_tizen> 3 </since_tizen>
704         public SamplingModeType SamplingMode
705         {
706             get
707             {
708                 return _samplingMode ?? (SamplingModeType.Box);
709             }
710             set
711             {
712                 _samplingMode = value;
713                 UpdateVisual();
714             }
715         }
716
717         /// <summary>
718         /// Gets or sets the desired image width.<br />
719         /// If not specified, the actual image width is used.<br />
720         /// For normal quad images only.<br />
721         /// Optional.
722         /// </summary>
723         /// <since_tizen> 3 </since_tizen>
724         public int DesiredWidth
725         {
726             get
727             {
728                 return _desiredWidth ?? (-1);
729             }
730             set
731             {
732                 _desiredWidth = value;
733                 UpdateVisual();
734             }
735         }
736
737         /// <summary>
738         /// Gets or sets the desired image height.<br />
739         /// If not specified, the actual image height is used.<br />
740         /// For normal quad images only.<br />
741         /// Optional.
742         /// </summary>
743         /// <since_tizen> 3 </since_tizen>
744         public int DesiredHeight
745         {
746             get
747             {
748                 return _desiredHeight ?? (-1);
749             }
750             set
751             {
752                 _desiredHeight = value;
753                 UpdateVisual();
754             }
755         }
756
757         /// <summary>
758         /// Gets or sets whether to load the image synchronously.<br />
759         /// If not specified, the default is false, i.e., the image is loaded asynchronously.<br />
760         /// For normal quad images only.<br />
761         /// Optional.
762         /// </summary>
763         /// <since_tizen> 3 </since_tizen>
764         public bool SynchronousLoading
765         {
766             get
767             {
768                 return _synchronousLoading ?? (false);
769             }
770             set
771             {
772                 _synchronousLoading = value;
773                 UpdateVisual();
774             }
775         }
776
777         /// <summary>
778         /// Gets or sets whether to draw the borders only (If true).<br />
779         /// If not specified, the default is false.<br />
780         /// For n-patch images only.<br />
781         /// Optional.
782         /// </summary>
783         /// <since_tizen> 3 </since_tizen>
784         public bool BorderOnly
785         {
786             get
787             {
788                 return _borderOnly ?? (false);
789             }
790             set
791             {
792                 _borderOnly = value;
793                 UpdateVisual();
794             }
795         }
796
797         /// <summary>
798         /// Gets or sets the image area to be displayed.<br />
799         /// It is a rectangular area.<br />
800         /// 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 />
801         /// 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 />
802         /// For normal quad images only.<br />
803         /// Optional.
804         /// </summary>
805         /// <since_tizen> 3 </since_tizen>
806         public Vector4 PixelArea
807         {
808             get
809             {
810                 return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f));
811             }
812             set
813             {
814                 _pixelArea = value;
815                 UpdateVisual();
816             }
817         }
818
819         /// <summary>
820         /// Gets or sets the wrap mode for the u coordinate.<br />
821         /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br />
822         /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
823         /// For normal quad images only.<br />
824         /// Optional.
825         /// </summary>
826         /// <since_tizen> 3 </since_tizen>
827         public WrapModeType WrapModeU
828         {
829             get
830             {
831                 return _wrapModeU ?? (WrapModeType.Default);
832             }
833             set
834             {
835                 _wrapModeU = value;
836                 UpdateVisual();
837             }
838         }
839
840         /// <summary>
841         /// Gets or sets the wrap mode for the v coordinate.<br />
842         /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br />
843         /// 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 />
844         /// If not specified, the default is WrapModeType.Default(CLAMP).<br />
845         /// For normal quad images only.
846         /// Optional.
847         /// </summary>
848         /// <since_tizen> 3 </since_tizen>
849         public WrapModeType WrapModeV
850         {
851             get
852             {
853                 return _wrapModeV ?? (WrapModeType.Default);
854             }
855             set
856             {
857                 _wrapModeV = value;
858                 UpdateVisual();
859             }
860         }
861
862         /// <summary>
863         /// Gets or sets scale factor to apply to the content image before masking.
864         /// </summary>
865         /// <since_tizen> 4 </since_tizen>
866         public float MaskContentScale
867         {
868             get
869             {
870                 return _maskContentScale ?? 1.0f;
871             }
872             set
873             {
874                 _maskContentScale = value;
875                 UpdateVisual();
876             }
877         }
878
879         /// <summary>
880         ///  Whether to crop image to mask or scale mask to fit image.
881         /// </summary>
882         /// <since_tizen> 4 </since_tizen>
883         public bool CropToMask
884         {
885             get
886             {
887                 return _cropToMask ?? false;
888             }
889             set
890             {
891                 _cropToMask = value;
892                 UpdateVisual();
893             }
894         }
895
896         /// <summary>
897         /// Compose the out visual map.
898         /// </summary>
899         /// <since_tizen> 3 </since_tizen>
900         protected override void ComposingPropertyMap()
901         {
902             if (_url != null)
903             {
904                 _outputVisualMap = new PropertyMap();
905                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
906                 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
907                 if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); }
908                 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
909                 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
910                 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
911                 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
912                 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
913                 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
914                 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
915                 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
916                 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
917                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
918                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
919                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
920                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
921                 if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); }
922                 if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); }
923             }
924         }
925     }
926
927     /// <summary>
928     /// A class encapsulating the property map of the text visual.
929     /// </summary>
930     /// <since_tizen> 3 </since_tizen>
931     public class TextVisual : VisualMap
932     {
933         /// <summary>
934         /// Constructor.
935         /// </summary>
936         /// <since_tizen> 3 </since_tizen>
937         public TextVisual() : base()
938         {
939         }
940
941         private string _text = null;
942         private string _fontFamily = null;
943         private PropertyMap _fontStyle = null;
944         private float? _pointSize = null;
945         private bool? _multiLine = null;
946         private string _horizontalAlignment = null;
947         private string _verticalAlignment = null;
948         private Color _textColor = null;
949         private bool? _enableMarkup = null;
950
951         /// <summary>
952         /// Gets or sets the text to display in the UTF-8 format.<br />
953         /// Mandatory.
954         /// </summary>
955         /// <since_tizen> 3 </since_tizen>
956         public string Text
957         {
958             get
959             {
960                 return _text;
961             }
962             set
963             {
964                 _text = value;
965                 UpdateVisual();
966             }
967         }
968
969         /// <summary>
970         /// Gets or sets the requested font family to use.<br />
971         /// Optional.
972         /// </summary>
973         /// <since_tizen> 3 </since_tizen>
974         public string FontFamily
975         {
976             get
977             {
978                 return _fontFamily;
979             }
980             set
981             {
982                 _fontFamily = value;
983                 UpdateVisual();
984             }
985         }
986
987         /// <summary>
988         /// Gets or sets the requested font style to use.<br />
989         /// Optional.
990         /// </summary>
991         /// <since_tizen> 3 </since_tizen>
992         public PropertyMap FontStyle
993         {
994             get
995             {
996                 return _fontStyle;
997             }
998             set
999             {
1000                 _fontStyle = value;
1001                 UpdateVisual();
1002             }
1003         }
1004
1005         /// <summary>
1006         /// Gets or sets the size of font in points.<br />
1007         /// Mandatory.
1008         /// </summary>
1009         /// <since_tizen> 3 </since_tizen>
1010         public float PointSize
1011         {
1012             get
1013             {
1014                 return _pointSize ?? (0.0f);
1015             }
1016             set
1017             {
1018                 _pointSize = value;
1019                 UpdateVisual();
1020             }
1021         }
1022
1023         /// <summary>
1024         /// Gets or sets the single-line or multi-line layout option.<br />
1025         /// If not specified, the default is false.<br />
1026         /// Optional.
1027         /// </summary>
1028         /// <since_tizen> 3 </since_tizen>
1029         public bool MultiLine
1030         {
1031             get
1032             {
1033                 return _multiLine ?? (false);
1034             }
1035             set
1036             {
1037                 _multiLine = value;
1038                 UpdateVisual();
1039             }
1040         }
1041
1042         /// <summary>
1043         /// Gets or sets the line horizontal alignment.<br />
1044         /// If not specified, the default is begin.<br />
1045         /// Optional.
1046         /// </summary>
1047         /// <since_tizen> 3 </since_tizen>
1048         public HorizontalAlignment HorizontalAlignment
1049         {
1050             get
1051             {
1052                 switch (_horizontalAlignment)
1053                 {
1054                     case "BEGIN":
1055                         return HorizontalAlignment.Begin;
1056                     case "CENTER":
1057                         return HorizontalAlignment.Center;
1058                     case "END":
1059                         return HorizontalAlignment.End;
1060                     default:
1061                         return HorizontalAlignment.Begin;
1062                 }
1063             }
1064             set
1065             {
1066                 switch (value)
1067                 {
1068                     case HorizontalAlignment.Begin:
1069                     {
1070                         _horizontalAlignment = "BEGIN";
1071                         break;
1072                     }
1073                     case HorizontalAlignment.Center:
1074                     {
1075                         _horizontalAlignment = "CENTER";
1076                         break;
1077                     }
1078                     case HorizontalAlignment.End:
1079                     {
1080                         _horizontalAlignment = "END";
1081                         break;
1082                     }
1083                     default:
1084                     {
1085                         _horizontalAlignment = "BEGIN";
1086                         break;
1087                     }
1088                 }
1089                 UpdateVisual();
1090             }
1091         }
1092
1093         /// <summary>
1094         /// Gets or sets the line vertical alignment.<br />
1095         /// If not specified, the default is top.<br />
1096         /// Optional.
1097         /// </summary>
1098         /// <since_tizen> 3 </since_tizen>
1099         public VerticalAlignment VerticalAlignment
1100         {
1101             get
1102             {
1103                 switch (_verticalAlignment)
1104                 {
1105                     case "TOP":
1106                         return VerticalAlignment.Top;
1107                     case "CENTER":
1108                         return VerticalAlignment.Center;
1109                     case "BOTTOM":
1110                         return VerticalAlignment.Bottom;
1111                     default:
1112                         return VerticalAlignment.Top;
1113                 }
1114             }
1115             set
1116             {
1117                 switch (value)
1118                 {
1119                     case VerticalAlignment.Top:
1120                     {
1121                         _verticalAlignment = "TOP";
1122                         break;
1123                     }
1124                     case VerticalAlignment.Center:
1125                     {
1126                         _verticalAlignment = "CENTER";
1127                         break;
1128                     }
1129                     case VerticalAlignment.Bottom:
1130                     {
1131                         _verticalAlignment = "BOTTOM";
1132                         break;
1133                     }
1134                     default:
1135                     {
1136                         _verticalAlignment = "TOP";
1137                         break;
1138                     }
1139                 }
1140                 UpdateVisual();
1141             }
1142         }
1143
1144         /// <summary>
1145         /// Gets or sets the color of the text.<br />
1146         /// Optional.
1147         /// </summary>
1148         /// <since_tizen> 3 </since_tizen>
1149         public Color TextColor
1150         {
1151             get
1152             {
1153                 return _textColor;
1154             }
1155             set
1156             {
1157                 _textColor = value;
1158                 UpdateVisual();
1159             }
1160         }
1161
1162         /// <summary>
1163         /// Gets or sets whether the mark-up processing is enabled.<br />
1164         /// Optional.
1165         /// </summary>
1166         /// <since_tizen> 3 </since_tizen>
1167         public bool EnableMarkup
1168         {
1169             get
1170             {
1171                 return _enableMarkup ?? (false);
1172             }
1173             set
1174             {
1175                 _enableMarkup = value;
1176                 UpdateVisual();
1177             }
1178         }
1179
1180         /// <summary>
1181         /// Compose the out visual map.
1182         /// </summary>
1183         /// <since_tizen> 3 </since_tizen>
1184         protected override void ComposingPropertyMap()
1185         {
1186             if (_text != null && _pointSize != null)
1187             {
1188                 _outputVisualMap = new PropertyMap();
1189                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
1190                 _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text));
1191                 _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize));
1192                 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
1193                 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
1194                 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
1195                 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
1196                 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
1197                 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
1198                 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
1199                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1200                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1201                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1202                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1203             }
1204         }
1205     }
1206
1207     /// <summary>
1208     /// A class encapsulating the property map of the border visual.
1209     /// </summary>
1210     /// <since_tizen> 3 </since_tizen>
1211     public class BorderVisual : VisualMap
1212     {
1213         /// <summary>
1214         /// Constructor.
1215         /// </summary>
1216         /// <since_tizen> 3 </since_tizen>
1217         public BorderVisual() : base()
1218         {
1219         }
1220
1221         private Color _color = null;
1222         private float? _size = null;
1223         private bool? _antiAliasing = null;
1224
1225         /// <summary>
1226         /// Gets or sets the color of the border.<br />
1227         /// Mandatory.
1228         /// </summary>
1229         /// <since_tizen> 3 </since_tizen>
1230         public Color Color
1231         {
1232             get
1233             {
1234                 return _color;
1235             }
1236             set
1237             {
1238                 _color = value;
1239                 UpdateVisual();
1240             }
1241         }
1242
1243         /// <summary>
1244         /// Gets or sets the width of the border (in pixels).<br />
1245         /// Mandatory.
1246         /// </summary>
1247         /// <since_tizen> 3 </since_tizen>
1248         public float BorderSize
1249         {
1250             get
1251             {
1252                 return _size ?? (-1.0f);
1253             }
1254             set
1255             {
1256                 _size = value;
1257                 UpdateVisual();
1258             }
1259         }
1260
1261         /// <summary>
1262         /// Gets or sets whether the anti-aliasing of the border is required.<br />
1263         /// If not supplied, the default is false.<br />
1264         /// Optional.
1265         /// </summary>
1266         /// <since_tizen> 3 </since_tizen>
1267         public bool AntiAliasing
1268         {
1269             get
1270             {
1271                 return _antiAliasing ?? (false);
1272             }
1273             set
1274             {
1275                 _antiAliasing = value;
1276                 UpdateVisual();
1277             }
1278         }
1279
1280         /// <summary>
1281         /// Compose the out visual map.
1282         /// </summary>
1283         /// <since_tizen> 3 </since_tizen>
1284         protected override void ComposingPropertyMap()
1285         {
1286             if (_color != null && _size != null)
1287             {
1288                 _outputVisualMap = new PropertyMap();
1289                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
1290                 _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
1291                 _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
1292                 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
1293                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1294                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1295                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1296                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1297             }
1298         }
1299     }
1300
1301     /// <summary>
1302     /// A class encapsulating the property map of the color visual.
1303     /// </summary>
1304     /// <since_tizen> 3 </since_tizen>
1305     public class ColorVisual : VisualMap
1306     {
1307         /// <summary>
1308         /// Constructor.
1309         /// </summary>
1310         /// <since_tizen> 3 </since_tizen>
1311         public ColorVisual() : base()
1312         {
1313         }
1314
1315         private Color _mixColorForColorVisual = null;
1316
1317         /// <summary>
1318         /// Gets or sets the solid color required.<br />
1319         /// Mandatory.
1320         /// </summary>
1321         /// <since_tizen> 3 </since_tizen>
1322         public Color Color
1323         {
1324             get
1325             {
1326                 return _mixColorForColorVisual;
1327             }
1328             set
1329             {
1330                 _mixColorForColorVisual = value;
1331                 UpdateVisual();
1332             }
1333         }
1334
1335         /// <summary>
1336         /// Compose the out visual map.
1337         /// </summary>
1338         /// <since_tizen> 3 </since_tizen>
1339         protected override void ComposingPropertyMap()
1340         {
1341             if (_mixColorForColorVisual != null)
1342             {
1343                 _outputVisualMap = new PropertyMap();
1344                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
1345                 _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual));
1346                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1347                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1348                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1349             }
1350         }
1351     }
1352
1353     /// <summary>
1354     /// A class encapsulating the property map of the gradient visual.
1355     /// </summary>
1356     /// <since_tizen> 3 </since_tizen>
1357     public class GradientVisual : VisualMap
1358     {
1359         /// <summary>
1360         /// Constructor.
1361         /// </summary>
1362         /// <since_tizen> 3 </since_tizen>
1363         public GradientVisual() : base()
1364         {
1365         }
1366
1367         private Vector2 _startPosition = null;
1368         private Vector2 _endPosition = null;
1369         private Vector2 _center = null;
1370         private float? _radius = null;
1371         private PropertyArray _stopOffset = null;
1372         private PropertyArray _stopColor = null;
1373         private GradientVisualUnitsType? _units = null;
1374         private GradientVisualSpreadMethodType? _spreadMethod = null;
1375
1376         /// <summary>
1377         /// Gets or sets the start position of a linear gradient.<br />
1378         /// Mandatory for linear.<br />
1379         /// </summary>
1380         /// <since_tizen> 3 </since_tizen>
1381         public Vector2 StartPosition
1382         {
1383             get
1384             {
1385                 return _startPosition;
1386             }
1387             set
1388             {
1389                 _startPosition = value;
1390                 UpdateVisual();
1391             }
1392         }
1393
1394         /// <summary>
1395         /// Gets or sets the end position of a linear gradient.<br />
1396         /// Mandatory for linear.<br />
1397         /// </summary>
1398         /// <since_tizen> 3 </since_tizen>
1399         public Vector2 EndPosition
1400         {
1401             get
1402             {
1403                 return _endPosition;
1404             }
1405             set
1406             {
1407                 _endPosition = value;
1408                 UpdateVisual();
1409             }
1410         }
1411
1412         /// <summary>
1413         /// Gets or sets the center point of a radial gradient.<br />
1414         /// Mandatory for radial.<br />
1415         /// </summary>
1416         /// <since_tizen> 3 </since_tizen>
1417         public Vector2 Center
1418         {
1419             get
1420             {
1421                 return _center;
1422             }
1423             set
1424             {
1425                 _center = value;
1426                 UpdateVisual();
1427             }
1428         }
1429
1430         /// <summary>
1431         /// Gets or sets the size of the radius of a radial gradient.<br />
1432         /// Mandatory for radial.<br />
1433         /// </summary>
1434         /// <since_tizen> 3 </since_tizen>
1435         public float Radius
1436         {
1437             get
1438             {
1439                 return _radius ?? (-1.0f);
1440             }
1441             set
1442             {
1443                 _radius = value;
1444                 UpdateVisual();
1445             }
1446         }
1447
1448         /// <summary>
1449         /// Gets or sets all the stop offsets.<br />
1450         /// A PropertyArray of float.<br />
1451         /// If not supplied, the default is 0.0f and 1.0f.<br />
1452         /// Optional.
1453         /// </summary>
1454         /// <since_tizen> 3 </since_tizen>
1455         public PropertyArray StopOffset
1456         {
1457             get
1458             {
1459                 return _stopOffset;
1460             }
1461             set
1462             {
1463                 _stopOffset = value;
1464                 UpdateVisual();
1465             }
1466         }
1467
1468         /// <summary>
1469         /// Gets or sets the color at the stop offsets.<br />
1470         /// A PropertyArray of color.<br />
1471         /// At least 2 values are required to show a gradient.<br />
1472         /// Mandatory.
1473         /// </summary>
1474         /// <since_tizen> 3 </since_tizen>
1475         public PropertyArray StopColor
1476         {
1477             get
1478             {
1479                 return _stopColor;
1480             }
1481             set
1482             {
1483                 _stopColor = value;
1484                 UpdateVisual();
1485             }
1486         }
1487
1488         /// <summary>
1489         /// Gets or sets descriptions of the coordinate system for certain attributes of the points in a gradient.<br />
1490         /// If not supplied, the default is GradientVisualUnitsType.ObjectBoundingBox.<br />
1491         /// Optional.
1492         /// </summary>
1493         /// <since_tizen> 3 </since_tizen>
1494         public GradientVisualUnitsType Units
1495         {
1496             get
1497             {
1498                 return _units ?? (GradientVisualUnitsType.ObjectBoundingBox);
1499             }
1500             set
1501             {
1502                 _units = value;
1503                 UpdateVisual();
1504             }
1505         }
1506
1507         /// <summary>
1508         /// Gets or sets indications of what happens if the gradient starts or ends inside the bounds of the target rectangle.<br />
1509         /// If not supplied, the default is GradientVisualSpreadMethodType.Pad.<br />
1510         /// Optional.
1511         /// </summary>
1512         /// <since_tizen> 3 </since_tizen>
1513         public GradientVisualSpreadMethodType SpreadMethod
1514         {
1515             get
1516             {
1517                 return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad);
1518             }
1519             set
1520             {
1521                 _spreadMethod = value;
1522                 UpdateVisual();
1523             }
1524         }
1525
1526         /// <summary>
1527         /// Compose the out visual map.
1528         /// </summary>
1529         /// <since_tizen> 3 </since_tizen>
1530         protected override void ComposingPropertyMap()
1531         {
1532             if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
1533             {
1534                 _outputVisualMap = new PropertyMap();
1535                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1536                 _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
1537                 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1538                 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1539                 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1540                 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1541                 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1542                 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1543                 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1544                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1545                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1546                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1547                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1548             }
1549         }
1550     }
1551
1552     /// <summary>
1553     /// A class encapsulating the property map of the mesh visual.
1554     /// </summary>
1555     /// <since_tizen> 3 </since_tizen>
1556     public class MeshVisual : VisualMap
1557     {
1558         /// <summary>
1559         /// Constructor.
1560         /// </summary>
1561         /// <since_tizen> 3 </since_tizen>
1562         public MeshVisual() : base()
1563         {
1564         }
1565
1566         private string _objectURL = null;
1567         private string _materialtURL = null;
1568         private string _texturesPath = null;
1569         private MeshVisualShadingModeValue? _shadingMode = null;
1570         private bool? _useMipmapping = null;
1571         private bool? _useSoftNormals = null;
1572         private Vector3 _lightPosition = null;
1573
1574         /// <summary>
1575         /// Gets or sets the location of the ".obj" file.<br />
1576         /// Mandatory.
1577         /// </summary>
1578         /// <since_tizen> 3 </since_tizen>
1579         public string ObjectURL
1580         {
1581             get
1582             {
1583                 return _objectURL;
1584             }
1585             set
1586             {
1587                 _objectURL = value;
1588                 UpdateVisual();
1589             }
1590         }
1591
1592         /// <summary>
1593         /// Gets or sets the location of the ".mtl" file.<br />
1594         /// If not specified, then a textureless object is assumed.<br />
1595         /// Optional.
1596         /// </summary>
1597         /// <since_tizen> 3 </since_tizen>
1598         public string MaterialtURL
1599         {
1600             get
1601             {
1602                 return _materialtURL;
1603             }
1604             set
1605             {
1606                 _materialtURL = value;
1607                 UpdateVisual();
1608             }
1609         }
1610
1611         /// <summary>
1612         /// Gets or sets the path to the directory the textures (including gloss and normal) are stored in.<br />
1613         /// Mandatory if using material.<br />
1614         /// </summary>
1615         /// <since_tizen> 3 </since_tizen>
1616         public string TexturesPath
1617         {
1618             get
1619             {
1620                 return _texturesPath;
1621             }
1622             set
1623             {
1624                 _texturesPath = value;
1625                 UpdateVisual();
1626             }
1627         }
1628
1629         /// <summary>
1630         /// Gets or sets the type of shading mode that the mesh will use.<br />
1631         /// 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 />
1632         /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).<br />
1633         /// Optional.
1634         /// </summary>
1635         /// <since_tizen> 3 </since_tizen>
1636         public MeshVisualShadingModeValue ShadingMode
1637         {
1638             get
1639             {
1640                 return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting);
1641             }
1642             set
1643             {
1644                 _shadingMode = value;
1645                 UpdateVisual();
1646             }
1647         }
1648
1649         /// <summary>
1650         /// Gets or sets whether to use mipmaps for textures or not.<br />
1651         /// If not specified, the default is true.<br />
1652         /// Optional.
1653         /// </summary>
1654         /// <since_tizen> 3 </since_tizen>
1655         public bool UseMipmapping
1656         {
1657             get
1658             {
1659                 return _useMipmapping ?? (true);
1660             }
1661             set
1662             {
1663                 _useMipmapping = value;
1664                 UpdateVisual();
1665             }
1666         }
1667
1668         /// <summary>
1669         /// Gets or sets whether to average normals at each point to smooth textures or not.<br />
1670         /// If not specified, the default is true.<br />
1671         /// Optional.
1672         /// </summary>
1673         /// <since_tizen> 3 </since_tizen>
1674         public bool UseSoftNormals
1675         {
1676             get
1677             {
1678                 return _useSoftNormals ?? (true);
1679             }
1680             set
1681             {
1682                 _useSoftNormals = value;
1683                 UpdateVisual();
1684             }
1685         }
1686
1687         /// <summary>
1688         /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
1689         /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
1690         /// and using all zeroes will place the light at the top-left corner.<br />
1691         /// If not specified, the default is an offset outwards from the center of the screen.<br />
1692         /// Optional.
1693         /// </summary>
1694         /// <since_tizen> 3 </since_tizen>
1695         public Vector3 LightPosition
1696         {
1697             get
1698             {
1699                 return _lightPosition;
1700             }
1701             set
1702             {
1703                 _lightPosition = value;
1704                 UpdateVisual();
1705             }
1706         }
1707
1708         /// <summary>
1709         /// Compose the out visual map.
1710         /// </summary>
1711         /// <since_tizen> 3 </since_tizen>
1712         protected override void ComposingPropertyMap()
1713         {
1714             if (_objectURL != null)
1715             {
1716                 _outputVisualMap = new PropertyMap();
1717                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1718                 _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1719                 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1720                 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1721                 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1722                 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1723                 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1724                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1725                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1726                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1727                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1728             }
1729         }
1730     }
1731
1732     /// <summary>
1733     /// A class encapsulating the property map of the primetive visual.
1734     /// </summary>
1735     /// <since_tizen> 3 </since_tizen>
1736     public class PrimitiveVisual : VisualMap
1737     {
1738         /// <summary>
1739         /// Constructor.
1740         /// </summary>
1741         /// <since_tizen> 3 </since_tizen>
1742         public PrimitiveVisual() : base()
1743         {
1744         }
1745
1746         private PrimitiveVisualShapeType? _shape = null;
1747         private Color _mixColorForPrimitiveVisual = null;
1748         private int? _slices = null;
1749         private int? _stacks = null;
1750         private float? _scaleTopRadius = null;
1751         private float? _scaleBottomRadius = null;
1752         private float? _scaleHeight = null;
1753         private float? _scaleRadius = null;
1754         private Vector3 _scaleDimensions = null;
1755         private float? _bevelPercentage = null;
1756         private float? _bevelSmoothness = null;
1757         private Vector3 _lightPosition = null;
1758
1759         /// <summary>
1760         /// Gets or sets the specific shape to render.<br />
1761         /// If not specified, the default is PrimitiveVisualShapeType.Sphere.<br />
1762         /// Optional.
1763         /// </summary>
1764         /// <since_tizen> 3 </since_tizen>
1765         public PrimitiveVisualShapeType Shape
1766         {
1767             get
1768             {
1769                 return _shape ?? (PrimitiveVisualShapeType.Sphere);
1770             }
1771             set
1772             {
1773                 _shape = value;
1774                 UpdateVisual();
1775             }
1776         }
1777
1778         /// <summary>
1779         /// Gets or sets the color of the shape.<br />
1780         /// If not specified, the default is Color (0.5, 0.5, 0.5, 1.0).<br />
1781         /// Applies to all shapes.<br />
1782         /// Optional.
1783         /// </summary>
1784         /// <since_tizen> 3 </since_tizen>
1785         public new Color MixColor
1786         {
1787             get
1788             {
1789                 return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f));
1790             }
1791             set
1792             {
1793                 _mixColorForPrimitiveVisual = value;
1794                 UpdateVisual();
1795             }
1796         }
1797
1798         /// <summary>
1799         /// Gets or sets the number of slices as you go around the shape.<br />
1800         /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br />
1801         /// If not specified, the default is 128.<br />
1802         /// The range is from 1 to 255.<br />
1803         /// Optional.
1804         /// </summary>
1805         /// <since_tizen> 3 </since_tizen>
1806         public int Slices
1807         {
1808             get
1809             {
1810                 return _slices ?? (128);
1811             }
1812             set
1813             {
1814                 _slices = value;
1815                 UpdateVisual();
1816             }
1817         }
1818
1819         /// <summary>
1820         /// Gets or sets the number of stacks as you go down the shape.<br />
1821         /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br />
1822         /// If not specified, the default is 128.<br />
1823         /// The range is from 1 to 255.<br />
1824         /// Optional.
1825         /// </summary>
1826         /// <since_tizen> 3 </since_tizen>
1827         public int Stacks
1828         {
1829             get
1830             {
1831                 return _stacks ?? (128);
1832             }
1833             set
1834             {
1835                 _stacks = value;
1836                 UpdateVisual();
1837             }
1838         }
1839
1840         /// <summary>
1841         /// Gets or sets the scale of the radius of the top circle of a conical frustrum.<br />
1842         /// If not specified, the default is 1.0f.<br />
1843         /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum<br />
1844         /// Only values greater than or equal to 0.0f are accepted.<br />
1845         /// Optional.
1846         /// </summary>
1847         /// <since_tizen> 3 </since_tizen>
1848         public float ScaleTopRadius
1849         {
1850             get
1851             {
1852                 return _scaleTopRadius ?? (1.0f);
1853             }
1854             set
1855             {
1856                 _scaleTopRadius = value;
1857                 UpdateVisual();
1858             }
1859         }
1860
1861         /// <summary>
1862         /// Gets or sets the scale of the radius of the bottom circle of a conical frustrum.<br />
1863         /// If not specified, the default is 1.5f.<br />
1864         /// Applies to:  - PrimitiveVisualShapeType.ConicalFrustrum<br />
1865         ///              - PrimitiveVisualShapeType.Cone<br />
1866         /// Only values greater than or equal to 0.0f are accepted.<br />
1867         /// Optional.
1868         /// </summary>
1869         /// <since_tizen> 3 </since_tizen>
1870         public float ScaleBottomRadius
1871         {
1872             get
1873             {
1874                 return _scaleBottomRadius ?? (1.5f);
1875             }
1876             set
1877             {
1878                 _scaleBottomRadius = value;
1879                 UpdateVisual();
1880             }
1881         }
1882
1883         /// <summary>
1884         /// Gets or sets the scale of the height of a conic.<br />
1885         /// If not specified, the default is 3.0f.<br />
1886         /// Applies to:<br />
1887         ///      - PrimitiveVisualShapeType.ConicalFrustrum<br />
1888         ///      - PrimitiveVisualShapeType.Cone<br />
1889         ///      - PrimitiveVisualShapeType.Cylinder<br />
1890         /// Only values greater than or equal to 0.0f are accepted.<br />
1891         /// Optional.
1892         /// </summary>
1893         /// <since_tizen> 3 </since_tizen>
1894         public float ScaleHeight
1895         {
1896             get
1897             {
1898                 return _scaleHeight ?? (3.0f);
1899             }
1900             set
1901             {
1902                 _scaleHeight = value;
1903                 UpdateVisual();
1904             }
1905         }
1906
1907         /// <summary>
1908         /// Gets or sets the scale of the radius of a cylinder.<br />
1909         /// If not specified, the default is 1.0f.<br />
1910         /// Applies to:<br />
1911         ///      - PrimitiveVisualShapeType.Cylinder<br />
1912         /// Only values greater than or equal to 0.0f are accepted.<br />
1913         /// Optional.
1914         /// </summary>
1915         /// <since_tizen> 3 </since_tizen>
1916         public float ScaleRadius
1917         {
1918             get
1919             {
1920                 return _scaleRadius ?? (1.0f);
1921             }
1922             set
1923             {
1924                 _scaleRadius = value;
1925                 UpdateVisual();
1926             }
1927         }
1928
1929         /// <summary>
1930         /// Gets or sets the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br />
1931         /// If not specified, the default is Vector3.One.<br />
1932         /// Applies to:<br />
1933         ///      - PrimitiveVisualShapeType.Cube<br />
1934         ///      - PrimitiveVisualShapeType.Octahedron<br />
1935         ///      - PrimitiveVisualShapeType.BevelledCube<br />
1936         /// Each Vector3 parameter should be greater than or equal to 0.0f.<br />
1937         /// Optional.
1938         /// </summary>
1939         /// <since_tizen> 3 </since_tizen>
1940         public Vector3 ScaleDimensions
1941         {
1942             get
1943             {
1944                 return _scaleDimensions ?? (Vector3.One);
1945             }
1946             set
1947             {
1948                 _scaleDimensions = value;
1949                 UpdateVisual();
1950             }
1951         }
1952
1953         /// <summary>
1954         /// Gets or sets determines how bevelled the cuboid should be, based off the smallest dimension.<br />
1955         /// 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 />
1956         /// If not specified, the default is 0.0f (no bevel).<br />
1957         /// Applies to:<br />
1958         ///      - PrimitiveVisualShapeType.BevelledCube<br />
1959         /// The range is from 0.0f to 1.0f.<br />
1960         /// Optional.
1961         /// </summary>
1962         /// <since_tizen> 3 </since_tizen>
1963         public float BevelPercentage
1964         {
1965             get
1966             {
1967                 return _bevelPercentage ?? (0.0f);
1968             }
1969             set
1970             {
1971                 _bevelPercentage = value;
1972                 UpdateVisual();
1973             }
1974         }
1975
1976         /// <summary>
1977         /// Gets or sets descriptions of how smooth the bevelled edges should be.<br />
1978         /// If not specified, the default is 0.0f (sharp edges).<br />
1979         /// Applies to:<br />
1980         ///      - PrimitiveVisualShapeType.BevelledCube<br />
1981         /// The range is from 0.0f to 1.0f.<br />
1982         /// Optional.
1983         /// </summary>
1984         /// <since_tizen> 3 </since_tizen>
1985         public float BevelSmoothness
1986         {
1987             get
1988             {
1989                 return _bevelSmoothness ?? (0.0f);
1990             }
1991             set
1992             {
1993                 _bevelSmoothness = value;
1994                 UpdateVisual();
1995             }
1996         }
1997
1998         /// <summary>
1999         /// Gets or sets the position, in the stage space, of the point light that applies lighting to the model.<br />
2000         /// This is based off the stage's dimensions, so using the width and the height of the stage halved will correspond to the center,
2001         /// and using all zeroes will place the light at the top-left corner.<br />
2002         /// If not specified, the default is an offset outwards from the center of the screen.<br />
2003         /// Applies to all shapes.<br />
2004         /// Optional.
2005         /// </summary>
2006         /// <since_tizen> 3 </since_tizen>
2007         public Vector3 LightPosition
2008         {
2009             get
2010             {
2011                 return _lightPosition;
2012             }
2013             set
2014             {
2015                 _lightPosition = value;
2016                 UpdateVisual();
2017             }
2018         }
2019
2020         /// <summary>
2021         /// Compose the out visual map.
2022         /// </summary>
2023         /// <since_tizen> 3 </since_tizen>
2024         protected override void ComposingPropertyMap()
2025         {
2026             _outputVisualMap = new PropertyMap(); ;
2027             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
2028             if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
2029             if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
2030             if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
2031             if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
2032             if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
2033             if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
2034             if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
2035             if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
2036             if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
2037             if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
2038             if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
2039             if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
2040             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2041             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2042             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2043         }
2044     }
2045
2046     /// <summary>
2047     /// A class encapsulating the property map of the n-patch image visual.
2048     /// </summary>
2049     /// <since_tizen> 3 </since_tizen>
2050     public class NPatchVisual : VisualMap
2051     {
2052         /// <summary>
2053         /// Constructor.
2054         /// </summary>
2055         /// <since_tizen> 3 </since_tizen>
2056         public NPatchVisual() : base()
2057         {
2058         }
2059
2060         private string _url = null;
2061         private bool? _borderOnly = null;
2062         private Rectangle _border = null;
2063
2064         /// <summary>
2065         /// Gets or sets the URL of the image.<br />
2066         /// Mandatory.
2067         /// </summary>
2068         /// <since_tizen> 3 </since_tizen>
2069         public string URL
2070         {
2071             get
2072             {
2073                 return _url;
2074             }
2075             set
2076             {
2077                 _url = value;
2078                 UpdateVisual();
2079             }
2080         }
2081
2082         /// <summary>
2083         /// Gets or sets whether to draw the borders only (If true).<br />
2084         /// If not specified, the default is false.<br />
2085         /// For n-patch images only.<br />
2086         /// Optional.
2087         /// </summary>
2088         /// <since_tizen> 3 </since_tizen>
2089         public bool BorderOnly
2090         {
2091             get
2092             {
2093                 return _borderOnly ?? false;
2094             }
2095             set
2096             {
2097                 _borderOnly = value;
2098                 UpdateVisual();
2099             }
2100         }
2101
2102         /// <summary>
2103         /// The border of the image is in the order: left, right, bottom, top.<br />
2104         /// For n-patch images only.<br />
2105         /// Optional.
2106         /// </summary>
2107         /// <since_tizen> 3 </since_tizen>
2108         public Rectangle Border
2109         {
2110             get
2111             {
2112                 return _border;
2113             }
2114             set
2115             {
2116                 _border = value;
2117                 UpdateVisual();
2118             }
2119         }
2120
2121         /// <summary>
2122         /// Compose the out visual map.
2123         /// </summary>
2124         /// <since_tizen> 3 </since_tizen>
2125         protected override void ComposingPropertyMap()
2126         {
2127             if (_url != null)
2128             {
2129                 _outputVisualMap = new PropertyMap();
2130                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
2131                 _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
2132                 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
2133                 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
2134                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2135                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2136                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2137                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2138             }
2139         }
2140     }
2141
2142     /// <summary>
2143     /// A class encapsulating the property map of the SVG visual.
2144     /// </summary>
2145     /// <since_tizen> 3 </since_tizen>
2146     public class SVGVisual : VisualMap
2147     {
2148         /// <summary>
2149         /// Constructor.
2150         /// </summary>
2151         /// <since_tizen> 3 </since_tizen>
2152         public SVGVisual() : base()
2153         {
2154         }
2155
2156         private string _url = null;
2157
2158         /// <summary>
2159         /// The url of the svg resource.
2160         /// </summary>
2161         /// <since_tizen> 3 </since_tizen>
2162         public string URL
2163         {
2164             get
2165             {
2166                 return _url;
2167             }
2168             set
2169             {
2170                 _url = value;
2171                 UpdateVisual();
2172             }
2173         }
2174
2175         /// <summary>
2176         /// Compose the out visual map.
2177         /// </summary>
2178         /// <since_tizen> 3 </since_tizen>
2179         protected override void ComposingPropertyMap()
2180         {
2181             if (_url != null)
2182             {
2183                 _outputVisualMap = new PropertyMap();
2184                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2185                 _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
2186                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2187                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2188                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2189                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2190             }
2191         }
2192     }
2193
2194     /// <summary>
2195     /// A class encapsulating the property map of the animated image (AGIF) visual.
2196     /// </summary>
2197     /// <since_tizen> 3 </since_tizen>
2198     public class AnimatedImageVisual : VisualMap
2199     {
2200         /// <summary>
2201         /// Constructor.
2202         /// </summary>
2203         /// <since_tizen> 3 </since_tizen>
2204         public AnimatedImageVisual() : base()
2205         {
2206         }
2207
2208         private List<string> _urls = null;
2209         private int? _batchSize = null;
2210         private int? _cacheSize = null;
2211         private float? _frameDelay = null;
2212
2213         /// <summary>
2214         /// Gets and Sets the url in the AnimatedImageVisual.
2215         /// </summary>
2216         /// <since_tizen> 3 </since_tizen>
2217         public string URL
2218         {
2219             get
2220             {
2221                 if( _urls != null )
2222                 {
2223                     return _urls[0];
2224                 }
2225                 else
2226                 {
2227                     return null;
2228                 }
2229             }
2230             set
2231             {
2232                 if( _urls == null )
2233                 {
2234                     _urls = new List<string>();
2235                     _urls.Add(value);
2236                 }
2237                 else
2238                 {
2239                     _urls[0] = value;
2240                 }
2241                 UpdateVisual();
2242             }
2243         }
2244
2245         /// <summary>
2246         /// Gets and Sets the url list in the AnimatedImageVisual.
2247         /// </summary>
2248         /// <since_tizen> 4 </since_tizen>
2249         public List<string> URLS
2250         {
2251             get
2252             {
2253                 return _urls;
2254             }
2255             set
2256             {
2257                 _urls = value;
2258                 UpdateVisual();
2259             }
2260         }
2261
2262         /// <summary>
2263         /// Gets and Sets the batch size for pre-loading images in the AnimatedImageVisual.
2264         /// </summary>
2265         /// <since_tizen> 4 </since_tizen>
2266         public int BatchSize
2267         {
2268             get
2269             {
2270                 return _batchSize ?? 1;
2271             }
2272             set
2273             {
2274                 _batchSize = value;
2275                 UpdateVisual();
2276             }
2277         }
2278
2279         /// <summary>
2280         /// Gets and Sets the cache size for loading images in the AnimatedImageVisual.
2281         /// </summary>
2282         /// <since_tizen> 4 </since_tizen>
2283         public int CacheSize
2284         {
2285             get
2286             {
2287                 return _cacheSize ?? 1;
2288             }
2289             set
2290             {
2291                 _cacheSize = value;
2292                 UpdateVisual();
2293             }
2294         }
2295
2296         /// <summary>
2297         /// Gets and Sets The number of milliseconds between each frame in the AnimatedImageVisual.
2298         /// </summary>
2299         /// <since_tizen> 4 </since_tizen>
2300         public float FrameDelay
2301         {
2302             get
2303             {
2304                 return _frameDelay ?? 0.1f;
2305             }
2306             set
2307             {
2308                 _frameDelay = value;
2309                 UpdateVisual();
2310             }
2311         }
2312
2313         /// <summary>
2314         /// Compose the out visual map.
2315         /// </summary>
2316         /// <since_tizen> 3 </since_tizen>
2317         protected override void ComposingPropertyMap()
2318         {
2319             if (_urls != null)
2320             {
2321                 _outputVisualMap = new PropertyMap();
2322                 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2323                 if( _urls.Count == 1 )
2324                 {
2325                     _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
2326                 }
2327                 else
2328                 {
2329                     var urlArray = new PropertyArray();
2330                     foreach( var url in _urls)
2331                     {
2332                         urlArray.Add(new PropertyValue(url));
2333                     }
2334                     _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) );
2335                 }
2336                 if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
2337                 if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
2338                 if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
2339                 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2340                 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2341                 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2342                 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2343             }
2344         }
2345     }
2346
2347
2348     //temporary fix for TCT
2349     /// <summary>
2350     /// A class encapsulating the property map of the transition data.
2351     /// </summary>
2352     /// <since_tizen> 3 </since_tizen>
2353     public class VisualAnimator : VisualMap
2354     {
2355         /// <summary>
2356         /// Create VisualAnimator object.
2357         /// </summary>
2358         /// <since_tizen> 3 </since_tizen>
2359         public VisualAnimator() : base()
2360         {
2361         }
2362
2363         private string _alphaFunction = null;
2364         private int _startTime = 0;
2365         private int _endTime = 0;
2366         private string _target = null;
2367         private string _propertyIndex = null;
2368         private object _destinationValue = null;
2369
2370         /// <summary>
2371         /// Sets and Gets the AlphaFunction of this transition.
2372         /// </summary>
2373         /// <since_tizen> 3 </since_tizen>
2374         public AlphaFunction.BuiltinFunctions AlphaFunction
2375         {
2376             get
2377             {
2378                 switch (_alphaFunction)
2379                 {
2380                     case "LINEAR":
2381                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear;
2382                     case "REVERSE":
2383                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse;
2384                     case "EASE_IN_SQUARE":
2385                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare;
2386                     case "EASE_OUT_SQUARE":
2387                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare;
2388                     case "EASE_IN":
2389                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn;
2390                     case "EASE_OUT":
2391                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut;
2392                     case "EASE_IN_OUT":
2393                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut;
2394                     case "EASE_IN_SINE":
2395                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine;
2396                     case "EASE_OUT_SINE":
2397                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine;
2398                     case "EASE_IN_OUT_SINE":
2399                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine;
2400                     case "BOUNCE":
2401                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce;
2402                     case "SIN":
2403                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin;
2404                     case "EASE_OUT_BACK":
2405                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack;
2406                     default:
2407                         return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default;
2408                 }
2409             }
2410             set
2411             {
2412                 switch (value)
2413                 {
2414                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
2415                         {
2416                             _alphaFunction = "LINEAR";
2417                             break;
2418                         }
2419                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
2420                         {
2421                             _alphaFunction = "REVERSE";
2422                             break;
2423                         }
2424                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
2425                         {
2426                             _alphaFunction = "EASE_IN_SQUARE";
2427                             break;
2428                         }
2429                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
2430                         {
2431                             _alphaFunction = "EASE_OUT_SQUARE";
2432                             break;
2433                         }
2434                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
2435                         {
2436                             _alphaFunction = "EASE_IN";
2437                             break;
2438                         }
2439                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
2440                         {
2441                             _alphaFunction = "EASE_OUT";
2442                             break;
2443                         }
2444                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
2445                         {
2446                             _alphaFunction = "EASE_IN_OUT";
2447                             break;
2448                         }
2449                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
2450                         {
2451                             _alphaFunction = "EASE_IN_SINE";
2452                             break;
2453                         }
2454                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
2455                         {
2456                             _alphaFunction = "EASE_OUT_SINE";
2457                             break;
2458                         }
2459                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
2460                         {
2461                             _alphaFunction = "EASE_IN_OUT_SINE";
2462                             break;
2463                         }
2464                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
2465                         {
2466                             _alphaFunction = "BOUNCE";
2467                             break;
2468                         }
2469                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
2470                         {
2471                             _alphaFunction = "SIN";
2472                             break;
2473                         }
2474                     case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
2475                         {
2476                             _alphaFunction = "EASE_OUT_BACK";
2477                             break;
2478                         }
2479                     default:
2480                         {
2481                             _alphaFunction = "DEFAULT";
2482                             break;
2483                         }
2484                 }
2485             }
2486         }
2487
2488         /// <summary>
2489         /// Sets and Gets the StartTime of this transition.
2490         /// </summary>
2491         /// <since_tizen> 3 </since_tizen>
2492         public int StartTime
2493         {
2494             get
2495             {
2496                 return _startTime;
2497             }
2498             set
2499             {
2500                 _startTime = value;
2501             }
2502         }
2503
2504         /// <summary>
2505         /// Sets and Gets the EndTime of this transition.
2506         /// </summary>
2507         /// <since_tizen> 3 </since_tizen>
2508         public int EndTime
2509         {
2510             get
2511             {
2512                 return _endTime;
2513             }
2514             set
2515             {
2516                 _endTime = value;
2517             }
2518         }
2519
2520         /// <summary>
2521         /// Sets and Gets the Target of this transition.
2522         /// </summary>
2523         /// <since_tizen> 3 </since_tizen>
2524         public string Target
2525         {
2526             get
2527             {
2528                 return _target;
2529             }
2530             set
2531             {
2532                 _target = value;
2533             }
2534         }
2535
2536         /// <summary>
2537         /// Sets and Gets the PropertyIndex of this transition.
2538         /// </summary>
2539         /// <since_tizen> 3 </since_tizen>
2540         public string PropertyIndex
2541         {
2542             get
2543             {
2544                 return _propertyIndex;
2545             }
2546             set
2547             {
2548                 _propertyIndex = value;
2549             }
2550         }
2551
2552         /// <summary>
2553         /// Sets and Gets the DestinationValue of this transition.
2554         /// </summary>
2555         /// <since_tizen> 3 </since_tizen>
2556         public object DestinationValue
2557         {
2558             get
2559             {
2560                 return _destinationValue;
2561             }
2562             set
2563             {
2564                 _destinationValue = value;
2565             }
2566         }
2567
2568         /// <summary>
2569         /// Compose the out visual map.
2570         /// </summary>
2571         /// <since_tizen> 3 </since_tizen>
2572         protected override void ComposingPropertyMap()
2573         {
2574             PropertyMap _animator = new PropertyMap();
2575             _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2576
2577             PropertyMap _timePeriod = new PropertyMap();
2578             _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2579             _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2580             _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2581
2582             StringBuilder sb = new StringBuilder(_propertyIndex);
2583             sb[0] = (char)(sb[0] | 0x20);
2584             string _str = sb.ToString();
2585
2586             PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2587
2588             PropertyMap _transition = new PropertyMap();
2589             _transition.Add("target", new PropertyValue(_target));
2590             _transition.Add("property", new PropertyValue(_str));
2591             _transition.Add("targetValue", val);
2592             _transition.Add("animator", new PropertyValue(_animator));
2593
2594             _outputVisualMap = _transition;
2595         }
2596     }
2597     //temporary fix for TCT
2598
2599
2600
2601 }