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