dali-1.2.31, nui 0.2.31 upgrade
[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 = Vector2.Zero;
27         private Vector2 _visualOffset = Vector2.Zero;
28         private Vector2 _visualOffsetPolicy = new Vector2((int)VisualTransformPolicyType.ABSOLUTE, (int)VisualTransformPolicyType.ABSOLUTE); // default absolute
29         private Vector2 _visualSizePolicy = new Vector2((int)VisualTransformPolicyType.ABSOLUTE, (int)VisualTransformPolicyType.ABSOLUTE); // default absolute
30         private AlignType _visualOrigin = AlignType.TOP_BEGIN;
31         private AlignType _visualAnchorPoint = AlignType.TOP_BEGIN;
32
33         private PropertyMap _visualTransformMap = null;
34
35         private float _depthIndex = 0.0f;
36         protected PropertyMap _outputVisualMap = null;
37
38         public VisualMap()
39         {
40         }
41
42         /// <summary>
43         /// Get or set size of the visual.
44         /// It can be either relative (percentage of the parent)
45         /// or absolute (in world units).
46         /// </summary>
47         public Vector2 VisualSize
48         {
49             get
50             {
51                 return _visualSize;
52             }
53             set
54             {
55                 _visualSize = value;
56             }
57         }
58
59         /// <summary>
60         /// Get or set offset of the visual.
61         /// It can be either relative (percentage of the parent)
62         /// or absolute (in world units).
63         /// </summary>
64         public Vector2 Offset
65         {
66             get
67             {
68                 return _visualOffset;
69             }
70             set
71             {
72                 _visualOffset = value;
73             }
74         }
75
76         /// <summary>
77         /// Get or set offset policy of the visual.
78         /// Indicates which components of the offset are relative
79         /// (percentage of the parent) or absolute (in world units).
80         /// 0 indicates the component is relative, and 1 absolute.
81         /// </summary>
82         public Vector2 OffsetPolicy
83         {
84             get
85             {
86                 return _visualOffsetPolicy;
87             }
88             set
89             {
90                 _visualOffsetPolicy = value;
91             }
92         }
93
94         /// <summary>
95         /// Get or set size policy of the visual.
96         /// Indicates which components of the size are relative
97         /// (percentage of the parent) or absolute (in world units).
98         /// 0 indicates the component is relative, and 1 absolute.
99         /// </summary>
100         public Vector2 SizePolicy
101         {
102             get
103             {
104                 return _visualSizePolicy;
105             }
106             set
107             {
108                 _visualSizePolicy = value;
109             }
110         }
111
112         /// <summary>
113         /// Get or set the origin of the visual within its control area.
114         /// </summary>
115         public AlignType Origin
116         {
117             get
118             {
119                 return _visualOrigin;
120             }
121             set
122             {
123                 _visualOrigin = value;
124             }
125         }
126
127         /// <summary>
128         /// Get or set the anchor-point of the visual.
129         /// </summary>
130         public AlignType AnchorPoint
131         {
132             get
133             {
134                 return _visualAnchorPoint;
135             }
136             set
137             {
138                 _visualAnchorPoint = value;
139             }
140         }
141
142         /// <summary>
143         /// Get or set the depth index of the visual.
144         /// </summary>
145         public float DepthIndex
146         {
147             get
148             {
149                 return _depthIndex;
150             }
151             set
152             {
153                 _depthIndex = value;
154             }
155         }
156
157         private void ComposingTransformMap()
158         {
159             if (_visualSize != Vector2.Zero)
160             {
161                 _visualTransformMap = new PropertyMap();
162                 _visualTransformMap.Add((int)VisualTransformPropertyType.SIZE, new PropertyValue(_visualSize));
163                 _visualTransformMap.Add((int)VisualTransformPropertyType.OFFSET, new PropertyValue(_visualOffset));
164                 _visualTransformMap.Add((int)VisualTransformPropertyType.OFFSET_POLICY, new PropertyValue(_visualOffsetPolicy));
165                 _visualTransformMap.Add((int)VisualTransformPropertyType.SIZE_POLICY, new PropertyValue(_visualSizePolicy));
166                 _visualTransformMap.Add((int)VisualTransformPropertyType.ORIGIN, new PropertyValue((int)_visualOrigin));
167                 _visualTransformMap.Add((int)VisualTransformPropertyType.ANCHOR_POINT, new PropertyValue((int)_visualAnchorPoint));
168             }
169         }
170
171         /// <summary>
172         /// Get the transform map used by the visual.
173         /// </summary>
174         public PropertyMap OutputTransformMap
175         {
176             get
177             {
178                 ComposingTransformMap();
179                 return _visualTransformMap;
180             }
181         }
182
183         protected virtual void ComposingPropertyMap()
184         {
185             _outputVisualMap = new PropertyMap();
186         }
187
188         /// <summary>
189         /// Get the property map to create the visual.
190         /// </summary>
191         public PropertyMap OutputVisualMap
192         {
193             get
194             {
195                 ComposingPropertyMap();
196                 return _outputVisualMap;
197             }
198         }
199     }
200
201     /// <summary>
202     /// A class encapsulating the property map of a image visual.
203     /// </summary>
204     public class ImageVisualMap : VisualMap
205     {
206         public ImageVisualMap() : base()
207         {
208         }
209
210         private string _url = "";
211         private FittingModeType _fittingMode = FittingModeType.ShrinkToFit;
212         private SamplingModeType _samplingMode = SamplingModeType.Box;
213         private int _desiredWidth = 0;
214         private int _desiredHeight = 0;
215         private bool _synchronousLoading = false;
216         private bool _borderOnly = false;
217         private Vector4 _pixelArea = new Vector4(0.0f, 0.0f, 1.0f, 1.0f);
218         private WrapModeType _wrapModeU = WrapModeType.ClampToEdge;
219         private WrapModeType _wrapModeV = WrapModeType.ClampToEdge;
220
221         /// <summary>
222         /// Get or set the URL of the image.
223         /// </summary>
224         public string URL
225         {
226             get
227             {
228                 return _url;
229             }
230             set
231             {
232                 _url = value;
233             }
234         }
235
236         /// <summary>
237         /// Get or set fitting options, used when resizing images to fit desired dimensions.
238         /// If not supplied, default is FittingMode::SHRINK_TO_FIT.
239         /// For Normal Quad images only.
240         /// </summary>
241         public FittingModeType FittingMode
242         {
243             get
244             {
245                 return _fittingMode;
246             }
247             set
248             {
249                 _fittingMode = value;
250             }
251         }
252
253         /// <summary>
254         /// Get or set filtering options, used when resizing images to sample original pixels.
255         /// If not supplied, default is SamplingMode::BOX.
256         /// For Normal Quad images only.
257         /// </summary>
258         public SamplingModeType SamplingMode
259         {
260             get
261             {
262                 return _samplingMode;
263             }
264             set
265             {
266                 _samplingMode = value;
267             }
268         }
269
270         /// <summary>
271         /// Get or set the desired image width.
272         /// If not specified, the actual image width is used.
273         /// For Normal Quad images only.
274         /// </summary>
275         public int DesiredWidth
276         {
277             get
278             {
279                 return _desiredWidth;
280             }
281             set
282             {
283                 _desiredWidth = value;
284             }
285         }
286
287         /// <summary>
288         /// Get or set the desired image height.
289         /// If not specified, the actual image height is used.
290         /// For Normal Quad images only.
291         /// </summary>
292         public int DesiredHeight
293         {
294             get
295             {
296                 return _desiredHeight;
297             }
298             set
299             {
300                 _desiredHeight = value;
301             }
302         }
303
304         /// <summary>
305         /// Get or set whether to load the image synchronously.
306         /// If not specified, the default is false, i.e. the image is loaded asynchronously.
307         /// For Normal Quad images only.
308         /// </summary>
309         public bool SynchronousLoading
310         {
311             get
312             {
313                 return _synchronousLoading;
314             }
315             set
316             {
317                 _synchronousLoading = value;
318             }
319         }
320
321         /// <summary>
322         /// Get or set whether to draws the borders only(If true).
323         /// If not specified, the default is false.
324         /// For N-Patch images only.
325         /// </summary>
326         public bool BorderOnly
327         {
328             get
329             {
330                 return _borderOnly;
331             }
332             set
333             {
334                 _borderOnly = value;
335             }
336         }
337
338         /// <summary>
339         /// Get or set the image area to be displayed.
340         /// It is a rectangular area.
341         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
342         /// If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.
343         /// For For Normal QUAD image only.
344         /// </summary>
345         public Vector4 PixelArea
346         {
347             get
348             {
349                 return _pixelArea;
350             }
351             set
352             {
353                 _pixelArea = value;
354             }
355         }
356
357         /// <summary>
358         /// Get or set the wrap mode for u coordinate.
359         /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.
360         /// If not specified, the default is CLAMP.
361         /// For Normal QUAD image only.
362         /// </summary>
363         public WrapModeType WrapModeU
364         {
365             get
366             {
367                 return _wrapModeU;
368             }
369             set
370             {
371                 _wrapModeU = value;
372             }
373         }
374
375         /// <summary>
376         /// Get or set the wrap mode for v coordinate.
377         /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.
378         /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
379         /// If not specified, the default is CLAMP.
380         /// For Normal QUAD image only.
381         /// </summary>
382         public WrapModeType WrapModeV
383         {
384             get
385             {
386                 return _wrapModeV;
387             }
388             set
389             {
390                 _wrapModeV = value;
391             }
392         }
393
394         protected override void ComposingPropertyMap()
395         {
396             if (_url != "")
397             {
398                 _outputVisualMap = new PropertyMap();
399                 _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Image));
400                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.URL, new PropertyValue(_url));
401                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode));
402                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode));
403
404                 if (_desiredWidth != 0)
405                 {
406                     _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.DesiredWidth, new PropertyValue(_desiredWidth));
407                 }
408
409                 if (_desiredHeight != 0)
410                 {
411                     _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.DesiredHeight, new PropertyValue(_desiredHeight));
412                 }
413
414                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.SynchronousLoading, new PropertyValue(_synchronousLoading));
415                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.BorderOnly, new PropertyValue(_borderOnly));
416                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea));
417                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU));
418                 _outputVisualMap.Add(Tizen.NUI.Constants.ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV));
419             }
420         }
421     }
422
423     /// <summary>
424     /// A class encapsulating the property map of a text visual.
425     /// </summary>
426     public class TextVisualMap : VisualMap
427     {
428         public TextVisualMap() : base()
429         {
430         }
431
432         private string _text = "";
433         private string _fontFamily = "";
434         private PropertyMap _fontStyle = null;
435         private float _pointSize = 0.0f;
436         private bool _multiLine = false;
437         private string _horizontalAlignment = "BEGIN";
438         private string _verticalAlignment = "TOP";
439         private Color _textColor = Color.Black;
440         private bool _enableMarkup = false;
441
442         /// <summary>
443         /// Get or set the text to display in UTF-8 format.
444         /// </summary>
445         public string Text
446         {
447             get
448             {
449                 return _text;
450             }
451             set
452             {
453                 _text = value;
454             }
455         }
456
457         /// <summary>
458         /// Get or set the requested font family to use.
459         /// </summary>
460         public string FontFamily
461         {
462             get
463             {
464                 return _fontFamily;
465             }
466             set
467             {
468                 _fontFamily = value;
469             }
470         }
471
472         /// <summary>
473         /// Get or set the requested font style to use.
474         /// </summary>
475         public PropertyMap FontStyle
476         {
477             get
478             {
479                 return _fontStyle;
480             }
481             set
482             {
483                 _fontStyle = value;
484             }
485         }
486
487         /// <summary>
488         /// Get or set the size of font in points.
489         /// </summary>
490         public float PointSize
491         {
492             get
493             {
494                 return _pointSize;
495             }
496             set
497             {
498                 _pointSize = value;
499             }
500         }
501
502         /// <summary>
503         /// Get or set the single-line or multi-line layout option.
504         /// </summary>
505         public bool MultiLine
506         {
507             get
508             {
509                 return _multiLine;
510             }
511             set
512             {
513                 _multiLine = value;
514             }
515         }
516
517         /// <summary>
518         /// Get or set the line horizontal alignment.
519         /// If not specified, the default is BEGIN.
520         /// </summary>
521         public string HorizontalAlignment
522         {
523             get
524             {
525                 return _horizontalAlignment;
526             }
527             set
528             {
529                 _horizontalAlignment = value;
530             }
531         }
532
533         /// <summary>
534         /// Get or set the line vertical alignment.
535         /// If not specified, the default is TOP.
536         /// </summary>
537         public string VerticalAlignment
538         {
539             get
540             {
541                 return _verticalAlignment;
542             }
543             set
544             {
545                 _verticalAlignment = value;
546             }
547         }
548
549         /// <summary>
550         /// Get or set the color of the text.
551         /// </summary>
552         public Color TextColor
553         {
554             get
555             {
556                 return _textColor;
557             }
558             set
559             {
560                 _textColor = value;
561             }
562         }
563
564         /// <summary>
565         /// Get or set whether the mark-up processing is enabled.
566         /// </summary>
567         public bool EnableMarkup
568         {
569             get
570             {
571                 return _enableMarkup;
572             }
573             set
574             {
575                 _enableMarkup = value;
576             }
577         }
578
579         protected override void ComposingPropertyMap()
580         {
581             if (_text != "")
582             {
583                 _outputVisualMap = new PropertyMap();
584                 _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Text));
585                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.Text, new PropertyValue(_text));
586
587                 if (_fontFamily != "")
588                 {
589                     _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.FontFamily, new PropertyValue(_fontFamily));
590                 }
591
592                 if (_fontStyle != null)
593                 {
594                     _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.FontStyle, new PropertyValue(_fontStyle));
595                 }
596
597                 if (_pointSize != 0)
598                 {
599                     _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.PointSize, new PropertyValue(_pointSize));
600                 }
601
602                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.MultiLine, new PropertyValue(_multiLine));
603                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment));
604                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment));
605                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.TextColor, new PropertyValue(_textColor));
606                 _outputVisualMap.Add(Tizen.NUI.Constants.TextVisualProperty.EnableMarkup, new PropertyValue(_enableMarkup));
607             }
608         }
609     }
610
611     /// <summary>
612     /// A class encapsulating the property map of a border visual.
613     /// </summary>
614     public class BorderVisualMap : VisualMap
615     {
616         public BorderVisualMap() : base()
617         {
618         }
619
620         private Color _color = Color.Black;
621         private float _size = 0.000001f;
622         private bool _antiAliasing = false;
623
624         /// <summary>
625         /// Get or set the color of the border.
626         /// </summary>
627         public Color Color
628         {
629             get
630             {
631                 return _color;
632             }
633             set
634             {
635                 _color = value;
636             }
637         }
638
639         /// <summary>
640         /// Get or set the width of the border (in pixels).
641         /// </summary>
642         public float Size
643         {
644             get
645             {
646                 return _size;
647             }
648             set
649             {
650                 _size = value;
651             }
652         }
653
654         /// <summary>
655         /// Get or set whether anti-aliasing of the border is required.
656         /// If not supplied, default is false.
657         /// </summary>
658         public bool AntiAliasing
659         {
660             get
661             {
662                 return _antiAliasing;
663             }
664             set
665             {
666                 _antiAliasing = value;
667             }
668         }
669
670         protected override void ComposingPropertyMap()
671         {
672             if (_size > 0.000001f)
673             {
674                 _outputVisualMap = new PropertyMap();
675                 _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Border));
676                 _outputVisualMap.Add(Tizen.NUI.Constants.BorderVisualProperty.Color, new PropertyValue(_color));
677                 _outputVisualMap.Add(Tizen.NUI.Constants.BorderVisualProperty.Size, new PropertyValue(_size));
678                 _outputVisualMap.Add(Tizen.NUI.Constants.BorderVisualProperty.AntiAliasing, new PropertyValue(_antiAliasing));
679             }
680         }
681     }
682
683     /// <summary>
684     /// A class encapsulating the property map of a color visual.
685     /// </summary>
686     public class ColorVisualMap : VisualMap
687     {
688         public ColorVisualMap() : base()
689         {
690         }
691
692         private Color _mixColor = Color.Black;
693
694         /// <summary>
695         /// Get or set the solid color required.
696         /// </summary>
697         public Color MixColor
698         {
699             get
700             {
701                 return _mixColor;
702             }
703             set
704             {
705                 _mixColor = value;
706             }
707         }
708
709         protected override void ComposingPropertyMap()
710         {
711             _outputVisualMap = new PropertyMap();
712             _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Color));
713             _outputVisualMap.Add(Tizen.NUI.Constants.ColorVisualProperty.MixColor, new PropertyValue(_mixColor));
714         }
715     }
716
717     /// <summary>
718     /// A class encapsulating the property map of a gradient visual.
719     /// </summary>
720     public class GradientVisualMap : VisualMap
721     {
722         public GradientVisualMap() : base()
723         {
724         }
725
726         private Vector2 _startPosition = Vector2.Zero;
727         private Vector2 _endPosition = Vector2.Zero;
728         private Vector2 _center = Vector2.Zero;
729         private float _radius = 0.000001f;
730         private PropertyArray _stopOffset = null; //0.0, 1.0
731         private PropertyArray _stopColor = null; // Color.Black, Color.Blue
732         private GradientVisualUnitsType _units = GradientVisualUnitsType.ObjectBoundingBox;
733         private GradientVisualSpreadMethodType _spreadMethod = GradientVisualSpreadMethodType.Pad;
734
735         /// <summary>
736         /// Get or set the start position of a linear gradient.
737         /// Mandatory for Linear.
738         /// </summary>
739         public Vector2 StartPosition
740         {
741             get
742             {
743                 return _startPosition;
744             }
745             set
746             {
747                 _startPosition = value;
748             }
749         }
750
751         /// <summary>
752         /// Get or set the end position of a linear gradient.
753         /// Mandatory for Linear.
754         /// </summary>
755         public Vector2 EndPosition
756         {
757             get
758             {
759                 return _endPosition;
760             }
761             set
762             {
763                 _endPosition = value;
764             }
765         }
766
767         /// <summary>
768         /// Get or set the center point of a radial gradient.
769         /// Mandatory for Radial.
770         /// </summary>
771         public Vector2 Center
772         {
773             get
774             {
775                 return _center;
776             }
777             set
778             {
779                 _center = value;
780             }
781         }
782
783         /// <summary>
784         /// Get or set the size of the radius of a radial gradient.
785         /// Mandatory for Radial.
786         /// </summary>
787         public float Radius
788         {
789             get
790             {
791                 return _radius;
792             }
793             set
794             {
795                 _radius = value;
796             }
797         }
798
799         /// <summary>
800         /// Get or set all the stop offsets.
801         /// A PropertyArray of float.
802         /// If not supplied, default is 0.0f and 1.0f.
803         /// </summary>
804         public PropertyArray StopOffset
805         {
806             get
807             {
808                 return _stopOffset;
809             }
810             set
811             {
812                 _stopOffset = value;
813             }
814         }
815
816         /// <summary>
817         /// Get or set the color at the stop offsets.
818         /// A PropertyArray of Color.
819         /// At least 2 values required to show a gradient.
820         /// </summary>
821         public PropertyArray StopColor
822         {
823             get
824             {
825                 return _stopColor;
826             }
827             set
828             {
829                 _stopColor = value;
830             }
831         }
832
833         /// <summary>
834         /// Get or set defines the coordinate system for certain attributes of the points in a gradient.
835         /// If not supplied, default is GradientVisualUnitsType.OBJECT_BOUNDING_BOX.
836         /// </summary>
837         public GradientVisualUnitsType Units
838         {
839             get
840             {
841                 return _units;
842             }
843             set
844             {
845                 _units = value;
846             }
847         }
848
849         /// <summary>
850         /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
851         /// If not supplied, default is GradientVisualSpreadMethodType.PAD.
852         /// </summary>
853         public GradientVisualSpreadMethodType SpreadMethod
854         {
855             get
856             {
857                 return _spreadMethod;
858             }
859             set
860             {
861                 _spreadMethod = value;
862             }
863         }
864
865         protected override void ComposingPropertyMap()
866         {
867             if (_startPosition != Vector2.Zero && _endPosition != Vector2.Zero && _center != Vector2.Zero
868                 && _radius > 0.000001f && _stopColor != null)
869             {
870                 _outputVisualMap = new PropertyMap();
871                 _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Gradient));
872                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.StartPosition, new PropertyValue(_startPosition));
873                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.EndPosition, new PropertyValue(_endPosition));
874                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.Center, new PropertyValue(_center));
875                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.Radius, new PropertyValue(_radius));
876
877                 if (_stopOffset != null)
878                 {
879                     _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset));
880                 }
881
882                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
883                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.Units, new PropertyValue((int)_units));
884                 _outputVisualMap.Add(Tizen.NUI.Constants.GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod));
885             }
886         }
887     }
888
889     /// <summary>
890     /// A class encapsulating the property map of a mesh visual.
891     /// </summary>
892     public class MeshVisualMap : VisualMap
893     {
894         public MeshVisualMap() : base()
895         {
896         }
897
898         private string _objectURL = "";
899         private string _materialtURL = "";
900         private string _texturesPath = "";
901         private MeshVisualShadingModeValue _shadingMode = MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting;
902         private bool _useMipmapping = true;
903         private bool _useSoftNormals = true;
904         private Vector3 _lightPosition = null; //default center of screen
905
906         /// <summary>
907         /// Get or set the location of the ".obj" file.
908         /// </summary>
909         public string ObjectURL
910         {
911             get
912             {
913                 return _objectURL;
914             }
915             set
916             {
917                 _objectURL = value;
918             }
919         }
920
921         /// <summary>
922         /// Get or set the location of the ".mtl" file.
923         /// If not specified, then a textureless object is assumed.
924         /// </summary>
925         public string MaterialtURL
926         {
927             get
928             {
929                 return _materialtURL;
930             }
931             set
932             {
933                 _materialtURL = value;
934             }
935         }
936
937         /// <summary>
938         /// Get or set path to the directory the textures (including gloss and normal) are stored in.
939         /// Mandatory if using material.
940         /// </summary>
941         public string TexturesPath
942         {
943             get
944             {
945                 return _texturesPath;
946             }
947             set
948             {
949                 _texturesPath = value;
950             }
951         }
952
953         /// <summary>
954         /// Get or set the type of shading mode that the mesh will use.
955         /// 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.
956         /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).
957         /// </summary>
958         public MeshVisualShadingModeValue ShadingMode
959         {
960             get
961             {
962                 return _shadingMode;
963             }
964             set
965             {
966                 _shadingMode = value;
967             }
968         }
969
970         /// <summary>
971         /// Get or set whether to use mipmaps for textures or not.
972         /// If not specified, the default is true.
973         /// </summary>
974         public bool UseMipmapping
975         {
976             get
977             {
978                 return _useMipmapping;
979             }
980             set
981             {
982                 _useMipmapping = value;
983             }
984         }
985
986         /// <summary>
987         /// Get or set whether to average normals at each point to smooth textures or not.
988         /// If not specified, the default is true.
989         /// </summary>
990         public bool UseSoftNormals
991         {
992             get
993             {
994                 return _useSoftNormals;
995             }
996             set
997             {
998                 _useSoftNormals = value;
999             }
1000         }
1001
1002         /// <summary>
1003         /// Get or set the position, in stage space, of the point light that applies lighting to the model.
1004         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1005         /// and using all zeroes will place the light at the top left corner.
1006         /// If not specified, the default is an offset outwards from the center of the screen.
1007         /// </summary>
1008         public Vector3 LightPosition
1009         {
1010             get
1011             {
1012                 return _lightPosition;
1013             }
1014             set
1015             {
1016                 _lightPosition = value;
1017             }
1018         }
1019
1020         protected override void ComposingPropertyMap()
1021         {
1022             if (_objectURL != "")
1023             {
1024                 _outputVisualMap = new PropertyMap();
1025                 _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Mesh));
1026                 _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL));
1027
1028                 if (_materialtURL != "" && _texturesPath != "")
1029                 {
1030                     _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL));
1031                     _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath));
1032                 }
1033
1034                 _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode));
1035                 _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.UseMipmapping, new PropertyValue(_useMipmapping));
1036                 _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.UseSoftNormals, new PropertyValue(_useSoftNormals));
1037
1038                 if (_lightPosition != null)
1039                 {
1040                     _outputVisualMap.Add(Tizen.NUI.Constants.MeshVisualProperty.LightPosition, new PropertyValue(_lightPosition));
1041                 }
1042             }
1043         }
1044     }
1045
1046     /// <summary>
1047     /// A class encapsulating the property map of a primetive visual.
1048     /// </summary>
1049     public class PrimitiveVisualMap : VisualMap
1050     {
1051         public PrimitiveVisualMap() : base()
1052         {
1053         }
1054
1055         private PrimitiveVisualShapeType _shape = PrimitiveVisualShapeType.Sphere;
1056         private Color _mixColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
1057         private int _slices = 128;
1058         private int _stacks = 128;
1059         private float _scaleTopRadius = 1.0f;
1060         private float _scaleBottomRadius = 1.5f;
1061         private float _scaleHeight = 3.0f;
1062         private float _scaleRadius = 1.0f;
1063         private Vector3 _scaleDimensions = Vector3.One;
1064         private float _bevelPercentage = 0.0f;
1065         private float _bevelSmoothness = 0.0f;
1066         private Vector3 _lightPosition = null; // default ?? center of screen
1067
1068         /// <summary>
1069         /// Get or set the specific shape to render.
1070         /// If not specified, the default is PrimitiveVisualShapeType.SPHERE.
1071         /// </summary>
1072         public PrimitiveVisualShapeType Shape
1073         {
1074             get
1075             {
1076                 return _shape;
1077             }
1078             set
1079             {
1080                 _shape = value;
1081             }
1082         }
1083
1084         /// <summary>
1085         /// Get or set the color of the shape.
1086         /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).
1087         /// Applies to ALL shapes.
1088         /// </summary>
1089         public Color MixColor
1090         {
1091             get
1092             {
1093                 return _mixColor;
1094             }
1095             set
1096             {
1097                 _mixColor = value;
1098             }
1099         }
1100
1101         /// <summary>
1102         /// Get or set the number of slices as you go around the shape.
1103         /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.
1104         /// If not specified, the default is 128.
1105         /// The range is from 1 to 255.
1106         /// </summary>
1107         public int Slices
1108         {
1109             get
1110             {
1111                 return _slices;
1112             }
1113             set
1114             {
1115                 _slices = value;
1116             }
1117         }
1118
1119         /// <summary>
1120         /// Get or set the number of stacks as you go down the shape.
1121         /// For spheres, 'stacks' determines how many layers there are as you go down the object.
1122         /// If not specified, the default is 128.
1123         /// The range is from 1 to 255.
1124         /// </summary>
1125         public int Stacks
1126         {
1127             get
1128             {
1129                 return _stacks;
1130             }
1131             set
1132             {
1133                 _stacks = value;
1134             }
1135         }
1136
1137         /// <summary>
1138         /// Get or set the scale of the radius of the top circle of a conical frustrum.
1139         /// If not specified, the default is 1.0f.
1140         /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM
1141         /// Only values greater than or equal to 0.0f are accepted.
1142         /// </summary>
1143         public float ScaleTopRadius
1144         {
1145             get
1146             {
1147                 return _scaleTopRadius;
1148             }
1149             set
1150             {
1151                 _scaleTopRadius = value;
1152             }
1153         }
1154
1155         /// <summary>
1156         /// Get or set the scale of the radius of the bottom circle of a conical frustrum.
1157         /// If not specified, the default is 1.5f.
1158         /// Applies to:  - PrimitiveVisualShapeType.CONICAL_FRUSTRUM
1159         ///              - PrimitiveVisualShapeType.CONE
1160         /// Only values greater than or equal to 0.0f are accepted.
1161         /// </summary>
1162         public float ScaleBottomRadius
1163         {
1164             get
1165             {
1166                 return _scaleBottomRadius;
1167             }
1168             set
1169             {
1170                 _scaleBottomRadius = value;
1171             }
1172         }
1173
1174         /// <summary>
1175         /// Get or set the scale of the height of a conic.
1176         /// If not specified, the default is 3.0f.
1177         /// Applies to:
1178         ///      - Shape::CONICAL_FRUSTRUM
1179         ///      - Shape::CONE
1180         ///      - Shape::CYLINDER
1181         /// Only values greater than or equal to 0.0f are accepted.
1182         /// </summary>
1183         public float ScaleHeight
1184         {
1185             get
1186             {
1187                 return _scaleHeight;
1188             }
1189             set
1190             {
1191                 _scaleHeight = value;
1192             }
1193         }
1194
1195         /// <summary>
1196         /// Get or set the scale of the radius of a cylinder.
1197         /// If not specified, the default is 1.0f.
1198         /// Applies to:
1199         ///      - Shape::CYLINDER
1200         /// Only values greater than or equal to 0.0f are accepted.
1201         /// </summary>
1202         public float ScaleRadius
1203         {
1204             get
1205             {
1206                 return _scaleRadius;
1207             }
1208             set
1209             {
1210                 _scaleRadius = value;
1211             }
1212         }
1213
1214         /// <summary>
1215         /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.
1216         /// If not specified, the default is Vector3.One.
1217         /// Applies to:
1218         ///      - Shape::CUBE
1219         ///      - Shape::OCTAHEDRON
1220         ///      - Shape::BEVELLED_CUBE
1221         /// Each vector3 parameter should be greater than or equal to 0.0f.
1222         /// </summary>
1223         public Vector3 ScaleDimensions
1224         {
1225             get
1226             {
1227                 return _scaleDimensions;
1228             }
1229             set
1230             {
1231                 _scaleDimensions = value;
1232             }
1233         }
1234
1235         /// <summary>
1236         /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.
1237         /// 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.
1238         /// If not specified, the default is 0.0f (no bevel).
1239         /// Applies to:
1240         ///      - Shape::BEVELLED_CUBE
1241         /// The range is from 0.0f to 1.0f.
1242         /// </summary>
1243         public float BevelPercentage
1244         {
1245             get
1246             {
1247                 return _bevelPercentage;
1248             }
1249             set
1250             {
1251                 _bevelPercentage = value;
1252             }
1253         }
1254
1255         /// <summary>
1256         /// Get or set defines how smooth the bevelled edges should be.
1257         /// If not specified, the default is 0.0f (sharp edges).
1258         /// Applies to:
1259         ///      - Shape::BEVELLED_CUBE
1260         /// The range is from 0.0f to 1.0f.
1261         /// </summary>
1262         public float BevelSmoothness
1263         {
1264             get
1265             {
1266                 return _bevelSmoothness;
1267             }
1268             set
1269             {
1270                 _bevelSmoothness = value;
1271             }
1272         }
1273
1274         /// <summary>
1275         /// Get or set the position, in stage space, of the point light that applies lighting to the model.
1276         /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1277         /// and using all zeroes will place the light at the top left corner.
1278         /// If not specified, the default is an offset outwards from the center of the screen.
1279         /// Applies to ALL shapes.
1280         /// </summary>
1281         public Vector3 LightPosition
1282         {
1283             get
1284             {
1285                 return _lightPosition;
1286             }
1287             set
1288             {
1289                 _lightPosition = value;
1290             }
1291         }
1292
1293         protected override void ComposingPropertyMap()
1294         {
1295             _outputVisualMap = new PropertyMap(); ;
1296             _outputVisualMap.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Primitive));
1297             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape));
1298             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColor));
1299             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.Slices, new PropertyValue(_slices));
1300             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.Stacks, new PropertyValue(_stacks));
1301             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue(_scaleTopRadius));
1302             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue(_scaleBottomRadius));
1303             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.ScaleHeight, new PropertyValue(_scaleHeight));
1304             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.ScaleRadius, new PropertyValue(_scaleRadius));
1305             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions));
1306             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.BevelPercentage, new PropertyValue(_bevelPercentage));
1307             _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.BevelSmoothness, new PropertyValue(_bevelSmoothness));
1308
1309             if (_lightPosition != null)
1310             {
1311                 _outputVisualMap.Add(Tizen.NUI.Constants.PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition));
1312             }
1313         }
1314     }
1315
1316
1317     public enum WrapModeType
1318     {
1319         Default = 0,
1320         ClampToEdge,
1321         Repeat,
1322         MirroredRepeat
1323     }
1324
1325     public enum GradientVisualUnitsType
1326     {
1327         ObjectBoundingBox,
1328         UserSpace
1329     }
1330
1331     public enum GradientVisualSpreadMethodType
1332     {
1333         Pad,
1334         Reflect,
1335         Repeat
1336     }
1337
1338     public enum MeshVisualShadingModeValue
1339     {
1340         TexturelessWithDiffuseLighting,
1341         TexturedWithSpecularLighting,
1342         TexturedWithDetailedSpecularLighting
1343     }
1344
1345     public enum PrimitiveVisualShapeType
1346     {
1347         Sphere,
1348         ConicalFrustrum,
1349         Cone,
1350         Cylinder,
1351         Cube,
1352         Octahedron,
1353         BevelledCube
1354     }
1355
1356     public enum FittingModeType
1357     {
1358         ShrinkToFit,
1359         ScaleToFill,
1360         FitWidth,
1361         FitHeight
1362     }
1363
1364     public enum SamplingModeType
1365     {
1366         Box,
1367         Nearest,
1368         Linear,
1369         BoxThenNearest,
1370         BoxThenLinear,
1371         NoFilter,
1372         DontCare
1373     }
1374
1375 }