Merge "[NUI-252] change string type of property to enum type of property" into tizen
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / VisualMaps.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15
16 namespace Tizen.NUI
17 {
18     using System;
19     using System.Runtime.InteropServices;
20
21     /// <summary>
22     /// A class encapsulating the transform map of visual.
23     /// </summary>
24     public class VisualMap
25     {
26         private Vector2 _visualSize = null;
27         private Vector2 _visualOffset = null;
28         private Vector2 _visualOffsetPolicy = null;
29         private Vector2 _visualSizePolicy = null;
30         private Visual.AlignType? _visualOrigin = null;
31         private Visual.AlignType? _visualAnchorPoint = null;
32
33         private PropertyMap _visualTransformMap = null;
34
35         private float _depthIndex = 0.0f;
36         protected PropertyMap _outputVisualMap = null;
37
38
39         internal string Name
40         {
41             set;
42             get;
43         }
44         internal int VisualIndex
45         {
46             set;
47             get;
48         }
49         internal VisualView Parent
50         {
51             set;
52             get;
53         }
54
55         public VisualMap()
56         {
57         }
58
59         /// <summary>
60         /// Get or set size of the visual.<br>
61         /// It can be either relative (percentage of the parent)
62         /// or absolute (in world units).<br>
63         /// </summary>
64         public Vector2 Size
65         {
66             get
67             {
68                 return _visualSize;
69             }
70             set
71             {
72                 _visualSize = value;
73                 UpdateVisual();
74             }
75         }
76
77         /// <summary>
78         /// Get or set offset of the visual.<br>
79         /// It can be either relative (percentage of the parent)
80         /// or absolute (in world units).<br>
81         /// </summary>
82         public Vector2 Position
83         {
84             get
85             {
86                 return _visualOffset;
87             }
88             set
89             {
90                 _visualOffset = value;
91                 UpdateVisual();
92             }
93         }
94
95         /// <summary>
96         /// Get or set offset policy of the visual.<br>
97         /// Indicates which components of the offset are relative
98         /// (percentage of the parent) or absolute (in world units).<br>
99         /// 0 indicates the component is relative, and 1 absolute.<br>
100         /// </summary>
101         public Vector2 PositionPolicy
102         {
103             get
104             {
105                 return _visualOffsetPolicy;
106             }
107             set
108             {
109                 _visualOffsetPolicy = value;
110                 UpdateVisual();
111             }
112         }
113
114         /// <summary>
115         /// Get or set size policy of the visual.<br>
116         /// Indicates which components of the size are relative
117         /// (percentage of the parent) or absolute (in world units).<br>
118         /// 0 indicates the component is relative, and 1 absolute.<br>
119         /// </summary>
120         public Vector2 SizePolicy
121         {
122             get
123             {
124                 return _visualSizePolicy;
125             }
126             set
127             {
128                 _visualSizePolicy = value;
129                 UpdateVisual();
130             }
131         }
132
133         /// <summary>
134         /// Get or set the origin of the visual within its control area.
135         /// </summary>
136         public Visual.AlignType Origin
137         {
138             get
139             {
140                 return _visualOrigin ?? (Visual.AlignType)(-1);
141             }
142             set
143             {
144                 _visualOrigin = value;
145                 UpdateVisual();
146             }
147         }
148
149         /// <summary>
150         /// Get or set the anchor-point of the visual.
151         /// </summary>
152         public Visual.AlignType AnchorPoint
153         {
154             get
155             {
156                 return _visualAnchorPoint ?? (Visual.AlignType)(-1);
157             }
158             set
159             {
160                 _visualAnchorPoint = value;
161                 UpdateVisual();
162             }
163         }
164
165         /// <summary>
166         /// Get or set the depth index of the visual.
167         /// </summary>
168         public float DepthIndex
169         {
170             get
171             {
172                 return _depthIndex;
173             }
174             set
175             {
176                 _depthIndex = value;
177             }
178         }
179
180         private void ComposingTransformMap()
181         {
182             _visualTransformMap = new PropertyMap();
183             if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
184             if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
185             if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
186             if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
187             if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
188             if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
189         }
190
191         /// <summary>
192         /// Get the transform map used by the visual.
193         /// </summary>
194         public PropertyMap OutputTransformMap
195         {
196             get
197             {
198                 ComposingTransformMap();
199                 return _visualTransformMap;
200             }
201         }
202
203         protected virtual void ComposingPropertyMap()
204         {
205             _outputVisualMap = new PropertyMap();
206         }
207
208         /// <summary>
209         /// Get the property map to create the visual.
210         /// </summary>
211         public PropertyMap OutputVisualMap
212         {
213             get
214             {
215                 ComposingPropertyMap();
216                 return _outputVisualMap;
217             }
218         }
219
220         internal void UpdateVisual()
221         {
222             if (VisualIndex > 0)
223             {
224                 Tizen.Log.Debug("NUI", "UpdateVisual()! VisualIndex=" + VisualIndex);
225                 Parent.UpdateVisual(VisualIndex, Name, this);
226             }
227             else
228             {
229                 Tizen.Log.Debug("NUI", "VisualIndex was not set");
230             }
231         }
232
233         protected PropertyMap _shader = null;
234         //private PropertyMap _transform = null;
235         protected bool? _premultipliedAlpha = null;
236         protected Color _mixColor = null;
237         protected float? _opacity = null;
238         protected PropertyMap _commonlyUsedMap = null;
239
240         /// <summary>
241         /// The shader to use in the visual.
242         /// </summary>
243         public PropertyMap Shader
244         {
245             get
246             {
247                 return _shader;
248             }
249             set
250             {
251                 _shader = value;
252                 UpdateVisual();
253             }
254         }
255         /// <summary>
256         /// Enables/disables premultiplied alpha. <br>
257         /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type.
258         /// </summary>
259         public bool PremultipliedAlpha
260         {
261             get
262             {
263                 return _premultipliedAlpha??false;
264             }
265             set
266             {
267                 _premultipliedAlpha = value;
268                 UpdateVisual();
269             }
270         }
271         /// <summary>
272         /// Mix color is a blend color for any visual.
273         /// </summary>
274         public Color MixColor
275         {
276             get
277             {
278                 return _mixColor;
279             }
280             set
281             {
282                 _mixColor = value;
283                 UpdateVisual();
284             }
285         }
286         /// <summary>
287         /// Opacity is the alpha component of the mixColor, above.
288         /// </summary>
289         public float Opacity
290         {
291             get
292             {
293                 return _opacity??(-1.0f);
294             }
295             set
296             {
297                 _opacity = value;
298                 UpdateVisual();
299             }
300         }
301
302     }
303
304     /// <summary>
305     /// A class encapsulating the property map of a image visual.
306     /// </summary>
307     public class ImageVisual : VisualMap
308     {
309         public ImageVisual() : base()
310         {
311         }
312
313         private string _url = null;
314         private FittingModeType? _fittingMode = null;
315         private SamplingModeType? _samplingMode = null;
316         private int? _desiredWidth = null;
317         private int? _desiredHeight = null;
318         private bool? _synchronousLoading = false;
319         private bool? _borderOnly = null;
320         private Vector4 _pixelArea = null;
321         private WrapModeType? _wrapModeU = null;
322         private WrapModeType? _wrapModeV = null;
323
324         /// <summary>
325         /// Get or set the URL of the image.
326         /// </summary>
327         public string URL
328         {
329             get
330             {
331                 return _url;
332             }
333             set
334             {
335                 _url = value;
336                 UpdateVisual();
337             }
338         }
339
340         /// <summary>
341         /// Get or set fitting options, used when resizing images to fit desired dimensions.<br>
342         /// If not supplied, default is FittingMode::SHRINK_TO_FIT.<br>
343         /// For Normal Quad images only.<br>
344         /// </summary>
345         public FittingModeType FittingMode
346         {
347             get
348             {
349                 return _fittingMode ?? (FittingModeType)(-1);
350             }
351             set
352             {
353                 _fittingMode = value;
354                 UpdateVisual();
355             }
356         }
357
358         /// <summary>
359         /// Get or set filtering options, used when resizing images to sample original pixels.<br>
360         /// If not supplied, default is SamplingMode::BOX.<br>
361         /// For Normal Quad images only.<br>
362         /// </summary>
363         public SamplingModeType SamplingMode
364         {
365             get
366             {
367                 return _samplingMode ?? (SamplingModeType)(-1);
368             }
369             set
370             {
371                 _samplingMode = value;
372                 UpdateVisual();
373             }
374         }
375
376         /// <summary>
377         /// Get or set the desired image width.<br>
378         /// If not specified, the actual image width is used.<br>
379         /// For Normal Quad images only.<br>
380         /// </summary>
381         public int DesiredWidth
382         {
383             get
384             {
385                 return _desiredWidth ?? (-1);
386             }
387             set
388             {
389                 _desiredWidth = value;
390                 UpdateVisual();
391             }
392         }
393
394         /// <summary>
395         /// Get or set the desired image height.<br>
396         /// If not specified, the actual image height is used.<br>
397         /// For Normal Quad images only.<br>
398         /// </summary>
399         public int DesiredHeight
400         {
401             get
402             {
403                 return _desiredHeight ?? (-1);
404             }
405             set
406             {
407                 _desiredHeight = value;
408                 UpdateVisual();
409             }
410         }
411
412         /// <summary>
413         /// Get or set whether to load the image synchronously.<br>
414         /// If not specified, the default is false, i.e. the image is loaded asynchronously.<br>
415         /// For Normal Quad images only.<br>
416         /// </summary>
417         public bool SynchronousLoading
418         {
419             get
420             {
421                 return _synchronousLoading ?? false;
422             }
423             set
424             {
425                 _synchronousLoading = value;
426                 UpdateVisual();
427             }
428         }
429
430         /// <summary>
431         /// Get or set whether to draws the borders only(If true).<br>
432         /// If not specified, the default is false.<br>
433         /// For N-Patch images only.<br>
434         /// </summary>
435         public bool BorderOnly
436         {
437             get
438             {
439                 return _borderOnly ?? false;
440             }
441             set
442             {
443                 _borderOnly = value;
444                 UpdateVisual();
445             }
446         }
447
448         /// <summary>
449         /// Get or set the image area to be displayed.<br>
450         /// It is a rectangular area.<br>
451         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
452         /// If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.<br>
453         /// For For Normal QUAD image only.<br>
454         /// </summary>
455         public Vector4 PixelArea
456         {
457             get
458             {
459                 return _pixelArea;
460             }
461             set
462             {
463                 _pixelArea = value;
464                 UpdateVisual();
465             }
466         }
467
468         /// <summary>
469         /// Get or set the wrap mode for u coordinate.<br>
470         /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br>
471         /// If not specified, the default is CLAMP.<br>
472         /// For Normal QUAD image only.<br>
473         /// </summary>
474         public WrapModeType WrapModeU
475         {
476             get
477             {
478                 return _wrapModeU ?? (WrapModeType)(-1);
479             }
480             set
481             {
482                 _wrapModeU = value;
483                 UpdateVisual();
484             }
485         }
486
487         /// <summary>
488         /// Get or set the wrap mode for v coordinate.<br>
489         /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br>
490         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
491         /// If not specified, the default is CLAMP.<br>
492         /// For Normal QUAD image only.
493         /// </summary>
494         public WrapModeType WrapModeV
495         {
496             get
497             {
498                 return _wrapModeV ?? (WrapModeType)(-1);
499             }
500             set
501             {
502                 _wrapModeV = value;
503                 UpdateVisual();
504             }
505         }
506
507         protected override void ComposingPropertyMap()
508         {
509             _outputVisualMap = new PropertyMap();
510             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
511             if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
512             if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
513             if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
514             if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
515             if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
516             if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
517             if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
518             if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
519             if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
520             if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
521             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
522             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
523             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
524             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
525         }
526     }
527
528     /// <summary>
529     /// A class encapsulating the property map of a text visual.
530     /// </summary>
531     public class TextVisual : VisualMap
532     {
533         public TextVisual() : base()
534         {
535         }
536
537         private string _text = null;
538         private string _fontFamily = null;
539         private PropertyMap _fontStyle = null;
540         private float? _pointSize = null;
541         private bool? _multiLine = null;
542         private string _horizontalAlignment = null;
543         private string _verticalAlignment = null;
544         private Color _textColor = null;
545         private bool? _enableMarkup = null;
546
547         /// <summary>
548         /// Get or set the text to display in UTF-8 format.
549         /// </summary>
550         public string Text
551         {
552             get
553             {
554                 return _text;
555             }
556             set
557             {
558                 _text = value;
559                 UpdateVisual();
560             }
561         }
562
563         /// <summary>
564         /// Get or set the requested font family to use.
565         /// </summary>
566         public string FontFamily
567         {
568             get
569             {
570                 return _fontFamily;
571             }
572             set
573             {
574                 _fontFamily = value;
575                 UpdateVisual();
576             }
577         }
578
579         /// <summary>
580         /// Get or set the requested font style to use.
581         /// </summary>
582         public PropertyMap FontStyle
583         {
584             get
585             {
586                 return _fontStyle;
587             }
588             set
589             {
590                 _fontStyle = value;
591                 UpdateVisual();
592             }
593         }
594
595         /// <summary>
596         /// Get or set the size of font in points.
597         /// </summary>
598         public float PointSize
599         {
600             get
601             {
602                 return _pointSize ?? (-1.0f);
603             }
604             set
605             {
606                 _pointSize = value;
607                 UpdateVisual();
608             }
609         }
610
611         /// <summary>
612         /// Get or set the single-line or multi-line layout option.
613         /// </summary>
614         public bool MultiLine
615         {
616             get
617             {
618                 return _multiLine ?? false;
619             }
620             set
621             {
622                 _multiLine = value;
623                 UpdateVisual();
624             }
625         }
626
627         /// <summary>
628         /// Get or set the line horizontal alignment.<br>
629         /// If not specified, the default is BEGIN.<br>
630         /// </summary>
631         public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment
632         {
633             get
634             {
635                 switch (_horizontalAlignment)
636                 {
637                     case "BEGIN":
638                         return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin;
639                     case "CENTER":
640                         return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter;
641                     case "END":
642                         return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd;
643                     default:
644                         return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin;
645                 }
646             }
647             set
648             {
649                 switch (value)
650                 {
651                     case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin:
652                     {
653                         _horizontalAlignment = "BEGIN";
654                         break;
655                     }
656                     case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter:
657                     {
658                         _horizontalAlignment = "CENTER";
659                         break;
660                     }
661                     case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd:
662                     {
663                         _horizontalAlignment = "END";
664                         break;
665                     }
666                     default:
667                     {
668                         _horizontalAlignment = "BEGIN";
669                         break;
670                     }
671                 }
672                 UpdateVisual();
673             }
674         }
675
676         /// <summary>
677         /// Get or set the line vertical alignment.<br>
678         /// If not specified, the default is TOP.<br>
679         /// </summary>
680         public Tizen.NUI.Constants.VerticalAlignment VerticalAlignment
681         {
682             get
683             {
684                 switch (_verticalAlignment)
685                 {
686                     case "TOP":
687                         return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop;
688                     case "CENTER":
689                         return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter;
690                     case "BOTTOM":
691                         return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom;
692                     default:
693                         return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom;
694                 }
695             }
696             set
697             {
698                 switch (value)
699                 {
700                     case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop:
701                     {
702                         _verticalAlignment = "TOP";
703                         break;
704                     }
705                     case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter:
706                     {
707                         _verticalAlignment = "CENTER";
708                         break;
709                     }
710                     case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom:
711                     {
712                         _verticalAlignment = "BOTTOM";
713                         break;
714                     }
715                     default:
716                     {
717                         _verticalAlignment = "TOP";
718                         break;
719                     }
720                 }
721                 UpdateVisual();
722             }
723         }
724
725         /// <summary>
726         /// Get or set the color of the text.
727         /// </summary>
728         public Color TextColor
729         {
730             get
731             {
732                 return _textColor;
733             }
734             set
735             {
736                 _textColor = value;
737                 UpdateVisual();
738             }
739         }
740
741         /// <summary>
742         /// Get or set whether the mark-up processing is enabled.
743         /// </summary>
744         public bool EnableMarkup
745         {
746             get
747             {
748                 return _enableMarkup ?? false;
749             }
750             set
751             {
752                 _enableMarkup = value;
753                 UpdateVisual();
754             }
755         }
756
757         protected override void ComposingPropertyMap()
758         {
759             _outputVisualMap = new PropertyMap();
760             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
761             if (_text != null) { _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text)); }
762             if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
763             if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
764             if (_pointSize != null) { _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize)); }
765             if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
766             if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
767             if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
768             if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
769             if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
770             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
771             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
772             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
773             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
774         }
775     }
776
777     /// <summary>
778     /// A class encapsulating the property map of a border visual.
779     /// </summary>
780     public class BorderVisual : VisualMap
781     {
782         public BorderVisual() : base()
783         {
784         }
785
786         private Color _color = null;
787         private float? _size = null;
788         private bool? _antiAliasing = null;
789
790         /// <summary>
791         /// Get or set the color of the border.
792         /// </summary>
793         public Color Color
794         {
795             get
796             {
797                 return _color;
798             }
799             set
800             {
801                 _color = value;
802                 UpdateVisual();
803             }
804         }
805
806         /// <summary>
807         /// Get or set the width of the border (in pixels).
808         /// </summary>
809         public float BorderSize
810         {
811             get
812             {
813                 return _size ?? (-1.0f);
814             }
815             set
816             {
817                 _size = value;
818                 UpdateVisual();
819             }
820         }
821
822         /// <summary>
823         /// Get or set whether anti-aliasing of the border is required.<br>
824         /// If not supplied, default is false.<br>
825         /// </summary>
826         public bool AntiAliasing
827         {
828             get
829             {
830                 return _antiAliasing ?? false;
831             }
832             set
833             {
834                 _antiAliasing = value;
835                 UpdateVisual();
836             }
837         }
838
839         protected override void ComposingPropertyMap()
840         {
841             _outputVisualMap = new PropertyMap();
842             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
843             if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); }
844             if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); }
845             if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
846             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
847             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
848             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
849             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
850         }
851     }
852
853     /// <summary>
854     /// A class encapsulating the property map of a color visual.
855     /// </summary>
856     public class ColorVisual : VisualMap
857     {
858         public ColorVisual() : base()
859         {
860         }
861
862         private Color _mixColorForColorVisual = null;
863
864         /// <summary>
865         /// Get or set the solid color required.
866         /// </summary>
867         public Color Color
868         {
869             get
870             {
871                 return _mixColorForColorVisual;
872             }
873             set
874             {
875                 _mixColorForColorVisual = value;
876                 UpdateVisual();
877             }
878         }
879
880         protected override void ComposingPropertyMap()
881         {
882             _outputVisualMap = new PropertyMap();
883             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
884             if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); }
885             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
886             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
887             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
888         }
889     }
890
891     /// <summary>
892     /// A class encapsulating the property map of a gradient visual.
893     /// </summary>
894     public class GradientVisual : VisualMap
895     {
896         public GradientVisual() : base()
897         {
898         }
899
900         private Vector2 _startPosition = null;
901         private Vector2 _endPosition = null;
902         private Vector2 _center = null;
903         private float? _radius = null;
904         private PropertyArray _stopOffset = null;
905         private PropertyArray _stopColor = null;
906         private GradientVisualUnitsType? _units = null;
907         private GradientVisualSpreadMethodType? _spreadMethod = null;
908
909         /// <summary>
910         /// Get or set the start position of a linear gradient.<br>
911         /// Mandatory for Linear.<br>
912         /// </summary>
913         public Vector2 StartPosition
914         {
915             get
916             {
917                 return _startPosition;
918             }
919             set
920             {
921                 _startPosition = value;
922                 UpdateVisual();
923             }
924         }
925
926         /// <summary>
927         /// Get or set the end position of a linear gradient.<br>
928         /// Mandatory for Linear.<br>
929         /// </summary>
930         public Vector2 EndPosition
931         {
932             get
933             {
934                 return _endPosition;
935             }
936             set
937             {
938                 _endPosition = value;
939                 UpdateVisual();
940             }
941         }
942
943         /// <summary>
944         /// Get or set the center point of a radial gradient.<br>
945         /// Mandatory for Radial.<br>
946         /// </summary>
947         public Vector2 Center
948         {
949             get
950             {
951                 return _center;
952             }
953             set
954             {
955                 _center = value;
956                 UpdateVisual();
957             }
958         }
959
960         /// <summary>
961         /// Get or set the size of the radius of a radial gradient.<br>
962         /// Mandatory for Radial.<br>
963         /// </summary>
964         public float Radius
965         {
966             get
967             {
968                 return _radius ?? (-1.0f);
969             }
970             set
971             {
972                 _radius = value;
973                 UpdateVisual();
974             }
975         }
976
977         /// <summary>
978         /// Get or set all the stop offsets.<br>
979         /// A PropertyArray of float.<br>
980         /// If not supplied, default is 0.0f and 1.0f.<br>
981         /// </summary>
982         public PropertyArray StopOffset
983         {
984             get
985             {
986                 return _stopOffset;
987             }
988             set
989             {
990                 _stopOffset = value;
991                 UpdateVisual();
992             }
993         }
994
995         /// <summary>
996         /// Get or set the color at the stop offsets.<br>
997         /// A PropertyArray of Color.<br>
998         /// At least 2 values required to show a gradient.<br>
999         /// </summary>
1000         public PropertyArray StopColor
1001         {
1002             get
1003             {
1004                 return _stopColor;
1005             }
1006             set
1007             {
1008                 _stopColor = value;
1009                 UpdateVisual();
1010             }
1011         }
1012
1013         /// <summary>
1014         /// Get or set defines the coordinate system for certain attributes of the points in a gradient.<br>
1015         /// If not supplied, default is GradientVisualUnitsType.OBJECT_BOUNDING_BOX.<br>
1016         /// </summary>
1017         public GradientVisualUnitsType Units
1018         {
1019             get
1020             {
1021                 return _units ?? (GradientVisualUnitsType)(-1);
1022             }
1023             set
1024             {
1025                 _units = value;
1026                 UpdateVisual();
1027             }
1028         }
1029
1030         /// <summary>
1031         /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1032         /// If not supplied, default is GradientVisualSpreadMethodType.PAD.<br>
1033         /// </summary>
1034         public GradientVisualSpreadMethodType SpreadMethod
1035         {
1036             get
1037             {
1038                 return _spreadMethod ?? (GradientVisualSpreadMethodType)(-1);
1039             }
1040             set
1041             {
1042                 _spreadMethod = value;
1043                 UpdateVisual();
1044             }
1045         }
1046
1047         protected override void ComposingPropertyMap()
1048         {
1049             _outputVisualMap = new PropertyMap();
1050             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1051             if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1052             if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1053             if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1054             if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1055             if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1056             if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); }
1057             if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1058             if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1059             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1060             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1061             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1062             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1063         }
1064     }
1065
1066     /// <summary>
1067     /// A class encapsulating the property map of a mesh visual.
1068     /// </summary>
1069     public class MeshVisual : VisualMap
1070     {
1071         public MeshVisual() : base()
1072         {
1073         }
1074
1075         private string _objectURL = null;
1076         private string _materialtURL = null;
1077         private string _texturesPath = null;
1078         private MeshVisualShadingModeValue? _shadingMode = null;
1079         private bool? _useMipmapping = null;
1080         private bool? _useSoftNormals = null;
1081         private Vector3 _lightPosition = null;
1082
1083         /// <summary>
1084         /// Get or set the location of the ".obj" file.
1085         /// </summary>
1086         public string ObjectURL
1087         {
1088             get
1089             {
1090                 return _objectURL;
1091             }
1092             set
1093             {
1094                 _objectURL = value;
1095                 UpdateVisual();
1096             }
1097         }
1098
1099         /// <summary>
1100         /// Get or set the location of the ".mtl" file.<br>
1101         /// If not specified, then a textureless object is assumed.<br>
1102         /// </summary>
1103         public string MaterialtURL
1104         {
1105             get
1106             {
1107                 return _materialtURL;
1108             }
1109             set
1110             {
1111                 _materialtURL = value;
1112                 UpdateVisual();
1113             }
1114         }
1115
1116         /// <summary>
1117         /// Get or set path to the directory the textures (including gloss and normal) are stored in.<br>
1118         /// Mandatory if using material.<br>
1119         /// </summary>
1120         public string TexturesPath
1121         {
1122             get
1123             {
1124                 return _texturesPath;
1125             }
1126             set
1127             {
1128                 _texturesPath = value;
1129                 UpdateVisual();
1130             }
1131         }
1132
1133         /// <summary>
1134         /// Get or set the type of shading mode that the mesh will use.<br>
1135         /// 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>
1136         /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).<br>
1137         /// </summary>
1138         public MeshVisualShadingModeValue ShadingMode
1139         {
1140             get
1141             {
1142                 return _shadingMode??(MeshVisualShadingModeValue)(-1);
1143             }
1144             set
1145             {
1146                 _shadingMode = value;
1147                 UpdateVisual();
1148             }
1149         }
1150
1151         /// <summary>
1152         /// Get or set whether to use mipmaps for textures or not.<br>
1153         /// If not specified, the default is true.<br>
1154         /// </summary>
1155         public bool UseMipmapping
1156         {
1157             get
1158             {
1159                 return _useMipmapping??false;
1160             }
1161             set
1162             {
1163                 _useMipmapping = value;
1164                 UpdateVisual();
1165             }
1166         }
1167
1168         /// <summary>
1169         /// Get or set whether to average normals at each point to smooth textures or not.<br>
1170         /// If not specified, the default is true.<br>
1171         /// </summary>
1172         public bool UseSoftNormals
1173         {
1174             get
1175             {
1176                 return _useSoftNormals??false;
1177             }
1178             set
1179             {
1180                 _useSoftNormals = value;
1181                 UpdateVisual();
1182             }
1183         }
1184
1185         /// <summary>
1186         /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1187         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1188         /// and using all zeroes will place the light at the top left corner.<br>
1189         /// If not specified, the default is an offset outwards from the center of the screen.<br>
1190         /// </summary>
1191         public Vector3 LightPosition
1192         {
1193             get
1194             {
1195                 return _lightPosition;
1196             }
1197             set
1198             {
1199                 _lightPosition = value;
1200                 UpdateVisual();
1201             }
1202         }
1203
1204         protected override void ComposingPropertyMap()
1205         {
1206             _outputVisualMap = new PropertyMap();
1207             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1208             if (_objectURL != null) { _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL)); }
1209             if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1210             if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1211             if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1212             if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1213             if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1214             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1215             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1216             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1217             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1218
1219         }
1220     }
1221
1222     /// <summary>
1223     /// A class encapsulating the property map of a primetive visual.
1224     /// </summary>
1225     public class PrimitiveVisual : VisualMap
1226     {
1227         public PrimitiveVisual() : base()
1228         {
1229         }
1230
1231         private PrimitiveVisualShapeType? _shape = null;
1232         private Color _mixColorForPrimitiveVisual = null;
1233         private int? _slices = null;
1234         private int? _stacks = null;
1235         private float? _scaleTopRadius = null;
1236         private float? _scaleBottomRadius = null;
1237         private float? _scaleHeight = null;
1238         private float? _scaleRadius = null;
1239         private Vector3 _scaleDimensions = null;
1240         private float? _bevelPercentage = null;
1241         private float? _bevelSmoothness = null;
1242         private Vector3 _lightPosition = null;
1243
1244         /// <summary>
1245         /// Get or set the specific shape to render.<br>
1246         /// If not specified, the default is PrimitiveVisualShapeType.SPHERE.<br>
1247         /// </summary>
1248         public PrimitiveVisualShapeType Shape
1249         {
1250             get
1251             {
1252                 return _shape??(PrimitiveVisualShapeType)(-1);
1253             }
1254             set
1255             {
1256                 _shape = value;
1257                 UpdateVisual();
1258             }
1259         }
1260
1261         /// <summary>
1262         /// Get or set the color of the shape.<br>
1263         /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).<br>
1264         /// Applies to ALL shapes.<br>
1265         /// </summary>
1266         public Color MixColor
1267         {
1268             get
1269             {
1270                 return _mixColorForPrimitiveVisual;
1271             }
1272             set
1273             {
1274                 _mixColorForPrimitiveVisual = value;
1275                 UpdateVisual();
1276             }
1277         }
1278
1279         /// <summary>
1280         /// Get or set the number of slices as you go around the shape.<br>
1281         /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1282         /// If not specified, the default is 128.<br>
1283         /// The range is from 1 to 255.<br>
1284         /// </summary>
1285         public int Slices
1286         {
1287             get
1288             {
1289                 return _slices??(-1);
1290             }
1291             set
1292             {
1293                 _slices = value;
1294                 UpdateVisual();
1295             }
1296         }
1297
1298         /// <summary>
1299         /// Get or set the number of stacks as you go down the shape.<br>
1300         /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1301         /// If not specified, the default is 128.<br>
1302         /// The range is from 1 to 255.<br>
1303         /// </summary>
1304         public int Stacks
1305         {
1306             get
1307             {
1308                 return _stacks??(-1);
1309             }
1310             set
1311             {
1312                 _stacks = value;
1313                 UpdateVisual();
1314             }
1315         }
1316
1317         /// <summary>
1318         /// Get or set the scale of the radius of the top circle of a conical frustrum.<br>
1319         /// If not specified, the default is 1.0f.<br>
1320         /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1321         /// Only values greater than or equal to 0.0f are accepted.<br>
1322         /// </summary>
1323         public float ScaleTopRadius
1324         {
1325             get
1326             {
1327                 return _scaleTopRadius ?? (-1.0f);
1328             }
1329             set
1330             {
1331                 _scaleTopRadius = value;
1332                 UpdateVisual();
1333             }
1334         }
1335
1336         /// <summary>
1337         /// Get or set the scale of the radius of the bottom circle of a conical frustrum.<br>
1338         /// If not specified, the default is 1.5f.<br>
1339         /// Applies to:  - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1340         ///              - PrimitiveVisualShapeType.CONE<br>
1341         /// Only values greater than or equal to 0.0f are accepted.<br>
1342         /// </summary>
1343         public float ScaleBottomRadius
1344         {
1345             get
1346             {
1347                 return _scaleBottomRadius ?? (-1.0f);
1348             }
1349             set
1350             {
1351                 _scaleBottomRadius = value;
1352                 UpdateVisual();
1353             }
1354         }
1355
1356         /// <summary>
1357         /// Get or set the scale of the height of a conic.<br>
1358         /// If not specified, the default is 3.0f.<br>
1359         /// Applies to:<br>
1360         ///      - Shape::CONICAL_FRUSTRUM<br>
1361         ///      - Shape::CONE<br>
1362         ///      - Shape::CYLINDER<br>
1363         /// Only values greater than or equal to 0.0f are accepted.<br>
1364         /// </summary>
1365         public float ScaleHeight
1366         {
1367             get
1368             {
1369                 return _scaleHeight??(-1.0f);
1370             }
1371             set
1372             {
1373                 _scaleHeight = value;
1374                 UpdateVisual();
1375             }
1376         }
1377
1378         /// <summary>
1379         /// Get or set the scale of the radius of a cylinder.<br>
1380         /// If not specified, the default is 1.0f.<br>
1381         /// Applies to:<br>
1382         ///      - Shape::CYLINDER<br>
1383         /// Only values greater than or equal to 0.0f are accepted.<br>
1384         /// </summary>
1385         public float ScaleRadius
1386         {
1387             get
1388             {
1389                 return _scaleRadius ?? (-1.0f);
1390             }
1391             set
1392             {
1393                 _scaleRadius = value;
1394                 UpdateVisual();
1395             }
1396         }
1397
1398         /// <summary>
1399         /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1400         /// If not specified, the default is Vector3.One.<br>
1401         /// Applies to:<br>
1402         ///      - Shape::CUBE<br>
1403         ///      - Shape::OCTAHEDRON<br>
1404         ///      - Shape::BEVELLED_CUBE<br>
1405         /// Each vector3 parameter should be greater than or equal to 0.0f.<br>
1406         /// </summary>
1407         public Vector3 ScaleDimensions
1408         {
1409             get
1410             {
1411                 return _scaleDimensions;
1412             }
1413             set
1414             {
1415                 _scaleDimensions = value;
1416                 UpdateVisual();
1417             }
1418         }
1419
1420         /// <summary>
1421         /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1422         /// 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>
1423         /// If not specified, the default is 0.0f (no bevel).<br>
1424         /// Applies to:<br>
1425         ///      - Shape::BEVELLED_CUBE<br>
1426         /// The range is from 0.0f to 1.0f.<br>
1427         /// </summary>
1428         public float BevelPercentage
1429         {
1430             get
1431             {
1432                 return _bevelPercentage ?? (-1.0f);
1433             }
1434             set
1435             {
1436                 _bevelPercentage = value;
1437                 UpdateVisual();
1438             }
1439         }
1440
1441         /// <summary>
1442         /// Get or set defines how smooth the bevelled edges should be.<br>
1443         /// If not specified, the default is 0.0f (sharp edges).<br>
1444         /// Applies to:<br>
1445         ///      - Shape::BEVELLED_CUBE<br>
1446         /// The range is from 0.0f to 1.0f.<br>
1447         /// </summary>
1448         public float BevelSmoothness
1449         {
1450             get
1451             {
1452                 return _bevelSmoothness ?? (-1.0f);
1453             }
1454             set
1455             {
1456                 _bevelSmoothness = value;
1457                 UpdateVisual();
1458             }
1459         }
1460
1461         /// <summary>
1462         /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1463         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1464         /// and using all zeroes will place the light at the top left corner.<br>
1465         /// If not specified, the default is an offset outwards from the center of the screen.<br>
1466         /// Applies to ALL shapes.
1467         /// </summary>
1468         public Vector3 LightPosition
1469         {
1470             get
1471             {
1472                 return _lightPosition;
1473             }
1474             set
1475             {
1476                 _lightPosition = value;
1477                 UpdateVisual();
1478             }
1479         }
1480
1481         protected override void ComposingPropertyMap()
1482         {
1483             _outputVisualMap = new PropertyMap(); ;
1484             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1485             if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1486             if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1487             if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1488             if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1489             if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1490             if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1491             if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1492             if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1493             if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1494             if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1495             if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1496             if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1497             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1498             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1499             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1500         }
1501     }
1502
1503     /// <summary>
1504     /// A class encapsulating the property map of a n-patch image visual.
1505     /// </summary>
1506     public class NPatchVisual : VisualMap
1507     {
1508         public NPatchVisual() : base()
1509         {
1510         }
1511
1512         private string _url = null;
1513         private bool? _borderOnly = null;
1514         private Rectangle _border = null;
1515
1516         /// <summary>
1517         /// Get or set the URL of the image.
1518         /// </summary>
1519         public string URL
1520         {
1521             get
1522             {
1523                 return _url;
1524             }
1525             set
1526             {
1527                 _url = value;
1528                 UpdateVisual();
1529             }
1530         }
1531
1532         /// <summary>
1533         /// Get or set whether to draws the borders only(If true).<br>
1534         /// If not specified, the default is false.<br>
1535         /// For N-Patch images only.<br>
1536         /// </summary>
1537         public bool BorderOnly
1538         {
1539             get
1540             {
1541                 return _borderOnly ?? false;
1542             }
1543             set
1544             {
1545                 _borderOnly = value;
1546                 UpdateVisual();
1547             }
1548         }
1549
1550         /// <summary>
1551         ///  The border of the image in the order: left, right, bottom, top.
1552         /// </summary>
1553         public Rectangle Border
1554         {
1555             get
1556             {
1557                 return _border;
1558             }
1559             set
1560             {
1561                 _border = value;
1562                 UpdateVisual();
1563             }
1564         }
1565
1566         protected override void ComposingPropertyMap()
1567         {
1568             _outputVisualMap = new PropertyMap();
1569             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1570             if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); }
1571             if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1572             if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
1573             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1574             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1575             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1576             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1577
1578         }
1579     }
1580
1581
1582     /// <summary>
1583     /// This specifies wrap mode types <br>
1584     /// WrapModeU and WrapModeV separately decide how the texture should be sampled when the u and v coordinate exceeds the range of 0.0 to 1.0.
1585     /// </summary>
1586     public enum WrapModeType
1587     {
1588         /// <summary>
1589         /// Defualt value
1590         /// </summary>
1591         Default = 0,
1592         /// <summary>
1593         /// Clamp to edge
1594         /// </summary>
1595         ClampToEdge,
1596         /// <summary>
1597         /// Repeat
1598         /// </summary>
1599         Repeat,
1600         /// <summary>
1601         /// Mirrored repeat
1602         /// </summary>
1603         MirroredRepeat
1604     }
1605
1606     /// <summary>
1607     /// The type of coordinate system for certain attributes of the points in a gradient.
1608     /// </summary>
1609     public enum GradientVisualUnitsType
1610     {
1611         /// <summary>
1612         /// Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5).
1613         /// </summary>
1614         ObjectBoundingBox,
1615         /// <summary>
1616         /// Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200).
1617         /// </summary>
1618         UserSpace
1619     }
1620
1621     /// <summary>
1622     /// This specifies SpreadMethod types.<br>
1623     /// SpreadMethod defines what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1624     /// </summary>
1625     public enum GradientVisualSpreadMethodType
1626     {
1627         /// <summary>
1628         /// Uses the terminal colors of the gradient to fill the remainder of the quad.
1629         /// </summary>
1630         Pad,
1631         /// <summary>
1632         /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled.
1633         /// </summary>
1634         Reflect,
1635         /// <summary>
1636         /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled.
1637         /// </summary>
1638         Repeat
1639     }
1640
1641     /// <summary>
1642     /// The shading mode used by MeshVisual.
1643     /// </summary>
1644     public enum MeshVisualShadingModeValue
1645     {
1646         /// <summary>
1647         /// *Simplest*. One color that is lit by ambient and diffuse lighting.
1648         /// </summary>
1649         TexturelessWithDiffuseLighting,
1650         /// <summary>
1651         /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting.
1652         /// </summary>
1653         TexturedWithSpecularLighting,
1654         /// <summary>
1655         /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting.
1656         /// </summary>
1657         TexturedWithDetailedSpecularLighting
1658     }
1659
1660     /// <summary>
1661     /// The primitive shape to render as a PrimitiveVisual.
1662     /// </summary>
1663     public enum PrimitiveVisualShapeType
1664     {
1665         /// <summary>
1666         /// A perfectly round geometrical object in three-dimensional space.
1667         /// </summary>
1668         Sphere,
1669         /// <summary>
1670         /// The area bound between two circles, i.e. a cone with the tip removed.
1671         /// </summary>
1672         ConicalFrustrum,
1673         /// <summary>
1674         /// Equivalent to a conical frustrum with top radius of zero.
1675         /// </summary>Equivalent to a conical frustrum with top radius of zero.
1676         Cone,
1677         /// <summary>
1678         /// Equivalent to a conical frustrum with top radius of zero.
1679         /// </summary>
1680         Cylinder,
1681         /// <summary>
1682         /// Equivalent to a conical frustrum with equal radii for the top and bottom circles.
1683         /// </summary>
1684         Cube,
1685         /// <summary>
1686         /// Equivalent to a bevelled cube with a bevel percentage of zero.
1687         /// </summary>
1688         Octahedron,
1689         /// <summary>
1690         /// Equivalent to a bevelled cube with a bevel percentage of one.
1691         /// </summary>
1692         BevelledCube
1693     }
1694
1695     /// <summary>
1696     /// This specifies fitting mode types. Fitting options, used when resizing images to fit desired dimensions.<br>
1697     /// A fitting mode controls the region of a loaded image to be mapped to the desired image rectangle.<br>
1698     /// All fitting modes preserve the aspect ratio of the image contents.<br>
1699     /// </summary>
1700     public enum FittingModeType
1701     {
1702         /// <summary>
1703         /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode.
1704         /// </summary>
1705         ShrinkToFit,
1706         /// <summary>
1707         /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode.
1708         /// </summary>
1709         ScaleToFill,
1710         /// <summary>
1711         /// Image columns: Limit loaded image resolution to column width using FitWidth mode.
1712         /// </summary>
1713         FitWidth,
1714         /// <summary>
1715         /// Image rows: Limit loaded image resolution to row height using FitHeight mode.
1716         /// </summary>
1717         FitHeight
1718     }
1719
1720     /// <summary>
1721     /// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.<br>
1722     /// A SamplingMode controls how pixels in an input image are sampled and combined to generate each pixel of a destination image during a scaling.<br>
1723     /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,<br>
1724     /// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.<br>
1725     /// </summary>
1726     public enum SamplingModeType
1727     {
1728         /// <summary>
1729         /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size. <br>
1730         /// This is the default.
1731         /// </summary>
1732         Box,
1733         /// <summary>
1734         /// For each output pixel, read one input pixel.
1735         /// </summary>
1736         Nearest,
1737         /// <summary>
1738         /// For each output pixel, read a quad of four input pixels and write a weighted average of them.
1739         /// </summary>
1740         Linear,
1741         /// <summary>
1742         /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size, <br>
1743         /// then for each output pixel, read one pixel from the last level of box filtering.<br>
1744         /// </summary>
1745         BoxThenNearest,
1746         /// <summary>
1747         /// Iteratively box filter to almost the right size, then for each output pixel, read four pixels from the last level of box filtering and write their weighted average.
1748         /// </summary>
1749         BoxThenLinear,
1750         /// <summary>
1751         /// No filtering is performed. If the SCALE_TO_FILL scaling mode is enabled, the borders of the image may be trimmed to match the aspect ratio of the desired dimensions.
1752         /// </summary>
1753         NoFilter,
1754         /// <summary>
1755         /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image.
1756         /// </summary>
1757         DontCare
1758     }
1759
1760     /// <summary>
1761     /// This specifies policy types that could be used by the transform for the offset or size.
1762     /// </summary>
1763     public enum VisualTransformPolicyType
1764     {
1765         /// <summary>
1766         /// Relative to the control (percentage [0.0f to 1.0f] of the control).
1767         /// </summary>
1768         Relative = 0,
1769         /// <summary>
1770         /// Absolute value in world units.
1771         /// </summary>
1772         Absolute = 1
1773     }
1774
1775     /// <summary>
1776     /// This specifies all the transform property types.
1777     /// </summary>
1778     public enum VisualTransformPropertyType
1779     {
1780         /// <summary>
1781         /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1782         /// </summary>
1783         Offset,
1784         /// <summary>
1785         /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1786         /// </summary>
1787         Size,
1788         /// <summary>
1789         /// The origin of the visual within its control area.
1790         /// </summary>
1791         Origin,
1792         /// <summary>
1793         /// The anchor-point of the visual
1794         /// </summary>
1795         AnchorPoint,
1796         /// <summary>
1797         /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1798         /// </summary>
1799         OffsetPolicy,
1800         /// <summary>
1801         /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1802         /// </summary>
1803         SizePolicy
1804     }
1805
1806     /// <summary>
1807     /// This specifies visual types.
1808     /// </summary>
1809     public struct Visual
1810     {
1811         /// <summary>
1812         /// The index for the visual type.
1813         /// </summary>
1814         public enum Type
1815         {
1816             /// <summary>
1817             /// Renders a solid color as an internal border to the control's quad.
1818             /// </summary>
1819             Border,
1820             /// <summary>
1821             /// Renders a solid color to the control's quad.
1822             /// </summary>
1823             Color,
1824             /// <summary>
1825             /// Renders a smooth transition of colors to the control's quad.
1826             /// </summary>
1827             Gradient,
1828             /// <summary>
1829             /// Renders an image into the control's quad.
1830             /// </summary>
1831             Image,
1832             /// <summary>
1833             /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file.
1834             /// </summary>
1835             Mesh,
1836             /// <summary>
1837             /// Renders a simple 3D shape, such as a cube or sphere.
1838             /// </summary>
1839             Primitive,
1840             /// <summary>
1841             /// Renders a simple wire-frame outlining a quad.
1842             /// </summary>
1843             Wireframe,
1844             /// <summary>
1845             /// Renders text.
1846             /// </summary>
1847             Text,
1848             /// <summary>
1849             /// Renders an n-patch image.
1850             /// </summary>
1851             NPatch,
1852             /// <summary>
1853             /// Renders an SVG image.
1854             /// </summary>
1855             SVG,
1856             /// <summary>
1857             /// Renders a animated image. (Animated GIF)
1858             /// </summary>
1859             AnimatedImage
1860         }
1861
1862         /// <summary>
1863         /// This specifies visual properties.
1864         /// </summary>
1865         public struct Property
1866         {
1867             public static readonly int Type = NDalic.VISUAL_PROPERTY_TYPE;
1868             public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER;
1869             public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
1870             public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
1871             public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
1872             public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1;
1873         }
1874
1875         /// <summary>
1876         /// This specifies shader properties.
1877         /// </summary>
1878         public struct ShaderProperty
1879         {
1880             public static readonly int VertexShader = NDalic.VISUAL_SHADER_VERTEX;
1881             public static readonly int FragmentShader = NDalic.VISUAL_SHADER_FRAGMENT;
1882             public static readonly int ShaderSubdivideGridX = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_X;
1883             public static readonly int ShaderSubdivideGridY = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_Y;
1884             public static readonly int ShaderHints = NDalic.VISUAL_SHADER_HINTS;
1885         }
1886
1887         /// <summary>
1888         /// This specifies Visaul align types.
1889         /// </summary>
1890         public enum AlignType
1891         {
1892             TopBegin = 0,
1893             TopCenter,
1894             TopEnd,
1895             CenterBegin,
1896             Center,
1897             CenterEnd,
1898             BottomBegin,
1899             BottomCenter,
1900             BottomEnd
1901         }
1902     }
1903
1904     /// <summary>
1905     /// This specifies properties of BorderVisual.
1906     /// </summary>
1907     public struct BorderVisualProperty
1908     {
1909         public static readonly int Color = NDalic.BORDER_VISUAL_COLOR;
1910         public static readonly int Size = NDalic.BORDER_VISUAL_SIZE;
1911         public static readonly int AntiAliasing = NDalic.BORDER_VISUAL_ANTI_ALIASING;
1912     }
1913
1914     /// <summary>
1915     /// This specifies properties of ColorVisual.
1916     /// </summary>
1917     public struct ColorVisualProperty
1918     {
1919         public static readonly int MixColor = NDalic.COLOR_VISUAL_MIX_COLOR;
1920     }
1921
1922     /// <summary>
1923     /// This specifies properties of GradientVisual.
1924     /// </summary>
1925     public struct GradientVisualProperty
1926     {
1927         public static readonly int StartPosition = NDalic.GRADIENT_VISUAL_START_POSITION;
1928         public static readonly int EndPosition = NDalic.GRADIENT_VISUAL_END_POSITION;
1929         public static readonly int Center = NDalic.GRADIENT_VISUAL_CENTER;
1930         public static readonly int Radius = NDalic.GRADIENT_VISUAL_RADIUS;
1931         public static readonly int StopOffset = NDalic.GRADIENT_VISUAL_STOP_OFFSET;
1932         public static readonly int StopColor = NDalic.GRADIENT_VISUAL_STOP_COLOR;
1933         public static readonly int Units = NDalic.GRADIENT_VISUAL_UNITS;
1934         public static readonly int SpreadMethod = NDalic.GRADIENT_VISUAL_SPREAD_METHOD;
1935     }
1936
1937     /// <summary>
1938     /// This specifies properties of ImageVisual.
1939     /// </summary>
1940     public struct ImageVisualProperty
1941     {
1942         public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
1943         public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
1944         public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
1945         public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
1946         public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
1947         public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
1948         public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
1949         public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
1950         public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
1951         public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
1952         public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
1953     }
1954
1955     /// <summary>
1956     /// This specifies properties of MeshVisual.
1957     /// </summary>
1958     public struct MeshVisualProperty
1959     {
1960         public static readonly int ObjectURL = NDalic.MESH_VISUAL_OBJECT_URL;
1961         public static readonly int MaterialtURL = NDalic.MESH_VISUAL_MATERIAL_URL;
1962         public static readonly int TexturesPath = NDalic.MESH_VISUAL_TEXTURES_PATH;
1963         public static readonly int ShadingMode = NDalic.MESH_VISUAL_SHADING_MODE;
1964         public static readonly int UseMipmapping = NDalic.MESH_VISUAL_USE_MIPMAPPING;
1965         public static readonly int UseSoftNormals = NDalic.MESH_VISUAL_USE_SOFT_NORMALS;
1966         public static readonly int LightPosition = NDalic.MESH_VISUAL_LIGHT_POSITION;
1967     }
1968
1969     /// <summary>
1970     /// This specifies properties of PrimitiveVisual.
1971     /// </summary>
1972     public struct PrimitiveVisualProperty
1973     {
1974         public static readonly int Shape = NDalic.PRIMITIVE_VISUAL_SHAPE;
1975         public static readonly int MixColor = NDalic.PRIMITIVE_VISUAL_MIX_COLOR;
1976         public static readonly int Slices = NDalic.PRIMITIVE_VISUAL_SLICES;
1977         public static readonly int Stacks = NDalic.PRIMITIVE_VISUAL_STACKS;
1978         public static readonly int ScaleTopRadius = NDalic.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS;
1979         public static readonly int ScaleBottomRadius = NDalic.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS;
1980         public static readonly int ScaleHeight = NDalic.PRIMITIVE_VISUAL_SCALE_HEIGHT;
1981         public static readonly int ScaleRadius = NDalic.PRIMITIVE_VISUAL_SCALE_RADIUS;
1982         public static readonly int ScaleDimensions = NDalic.PRIMITIVE_VISUAL_SCALE_DIMENSIONS;
1983         public static readonly int BevelPercentage = NDalic.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE;
1984         public static readonly int BevelSmoothness = NDalic.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS;
1985         public static readonly int LightPosition = NDalic.PRIMITIVE_VISUAL_LIGHT_POSITION;
1986     }
1987
1988     /// <summary>
1989     /// This specifies properties of TextVisual.
1990     /// </summary>
1991     public struct TextVisualProperty
1992     {
1993         public static readonly int Text = NDalic.TEXT_VISUAL_TEXT;
1994         public static readonly int FontFamily = NDalic.TEXT_VISUAL_FONT_FAMILY;
1995         public static readonly int FontStyle = NDalic.TEXT_VISUAL_FONT_STYLE;
1996         public static readonly int PointSize = NDalic.TEXT_VISUAL_POINT_SIZE;
1997         public static readonly int MultiLine = NDalic.TEXT_VISUAL_MULTI_LINE;
1998         public static readonly int HorizontalAlignment = NDalic.TEXT_VISUAL_HORIZONTAL_ALIGNMENT;
1999         public static readonly int VerticalAlignment = NDalic.TEXT_VISUAL_VERTICAL_ALIGNMENT;
2000         public static readonly int TextColor = NDalic.TEXT_VISUAL_TEXT_COLOR;
2001         public static readonly int EnableMarkup = NDalic.TEXT_VISUAL_ENABLE_MARKUP;
2002     }
2003
2004     /// <summary>
2005     /// This specifies properties of NpatchImageVisual.
2006     /// </summary>
2007     public struct NpatchImageVisualProperty
2008     {
2009         public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
2010         public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
2011         public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
2012         public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
2013         public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
2014         public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
2015         public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
2016         public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
2017         public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
2018         public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
2019         public static readonly int Border = NDalic.IMAGE_VISUAL_WRAP_MODE_V + 1;
2020     }
2021
2022     /// <summary>
2023     /// A class encapsulating the property map of a SVG visual. 
2024     /// </summary>
2025     public class SVGVisual : VisualMap
2026     {
2027         public SVGVisual() : base()
2028         {
2029         }
2030
2031         private string _url = null;
2032
2033         public string URL
2034         {
2035             get
2036             {
2037                 return _url;
2038             }
2039             set
2040             {
2041                 _url = value;
2042                 UpdateVisual();
2043             }
2044         }
2045
2046         protected override void ComposingPropertyMap()
2047         {
2048             _outputVisualMap = new PropertyMap();
2049             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2050             if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2051             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2052             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2053             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2054             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2055         }
2056     }
2057
2058     /// <summary>
2059     /// A class encapsulating the property map of a Animated Image(AGIF) visual.
2060     /// </summary>
2061     public class AnimatedImageVisual : VisualMap
2062     {
2063         public AnimatedImageVisual() : base()
2064         {
2065         }
2066
2067         private string _url = null;
2068
2069         public string URL
2070         {
2071             get
2072             {
2073                 return _url;
2074             }
2075             set
2076             {
2077                 _url = value;
2078                 UpdateVisual();
2079             }
2080         }
2081
2082         protected override void ComposingPropertyMap()
2083         {
2084             _outputVisualMap = new PropertyMap();
2085             _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2086             if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2087             if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2088             if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2089             if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2090             if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2091         }
2092     }
2093
2094     /// <summary>
2095     /// A class encapsulating the property map of a visual transition(Animator).
2096     /// </summary>
2097     public class AnimatorVisual : VisualMap
2098     {
2099         public AnimatorVisual() : base()
2100         {
2101         }
2102
2103         private string _alphaFunction = null;
2104         private int _startTime = 0;
2105         private int _endTime = 0;
2106         private string _target = null;
2107         private string _propertyIndex = null;
2108         private object _destinationValue = null;
2109
2110         public string AlphaFunction
2111         {
2112             get
2113             {
2114                 return _alphaFunction;
2115             }
2116             set
2117             {
2118                 _alphaFunction = value;
2119             }
2120         }
2121
2122         public int StartTime
2123         {
2124             get
2125             {
2126                 return _startTime;
2127             }
2128             set
2129             {
2130                 _startTime = value;
2131             }
2132         }
2133
2134         public int EndTime
2135         {
2136             get
2137             {
2138                 return _endTime;
2139             }
2140             set
2141             {
2142                 _endTime = value;
2143             }
2144         }
2145
2146         public string Target
2147         {
2148             get
2149             {
2150                 return _target;
2151             }
2152             set
2153             {
2154                 _target = value;
2155             }
2156         }
2157
2158         public string PropertyIndex
2159         {
2160             get
2161             {
2162                 return _propertyIndex;
2163             }
2164             set
2165             {
2166                 _propertyIndex = value;
2167             }
2168         }
2169
2170         public object DestinationValue
2171         {
2172             get
2173             {
2174                 return _destinationValue;
2175             }
2176             set
2177             {
2178                 _destinationValue = value;
2179             }
2180         }
2181
2182         protected override void ComposingPropertyMap()
2183         {
2184             PropertyMap _animator = new PropertyMap();
2185             _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2186
2187             PropertyMap _timePeriod = new PropertyMap();
2188             _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2189             _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2190             _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2191
2192             string _str1 = _propertyIndex.Substring(0, 1);
2193             string _str2 = _propertyIndex.Substring(1);
2194             string _str = _str1.ToLower() + _str2;
2195
2196             PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2197
2198             PropertyMap _transition = new PropertyMap();
2199             _transition.Add("target", new PropertyValue(_target));
2200             _transition.Add("property", new PropertyValue(_str));
2201             _transition.Add("targetValue", val);
2202             _transition.Add("animator", new PropertyValue(_animator));
2203
2204             _outputVisualMap = _transition;
2205         }
2206     }
2207
2208 }