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