1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.UIComponents;
23 /// A class encapsulating the transform map of visual.
25 public class VisualMap
27 private Vector2 _visualSize = null;
28 private Vector2 _visualOffset = null;
29 private Vector2 _visualOffsetPolicy = null;
30 private Vector2 _visualSizePolicy = null;
31 private Visual.AlignType? _visualOrigin = null;
32 private Visual.AlignType? _visualAnchorPoint = null;
34 private PropertyMap _visualTransformMap = null;
36 private float _depthIndex = 0.0f;
37 protected PropertyMap _outputVisualMap = null;
45 internal int VisualIndex
50 internal VisualView Parent
61 /// Get or set size of the visual.<br>
62 /// It can be either relative (percentage of the parent)
63 /// or absolute (in world units).<br>
79 /// Get or set offset of the visual.<br>
80 /// It can be either relative (percentage of the parent)
81 /// or absolute (in world units).<br>
83 public Vector2 Position
91 _visualOffset = value;
97 /// Get or set offset policy of the visual.<br>
98 /// Indicates which components of the offset are relative
99 /// (percentage of the parent) or absolute (in world units).<br>
100 /// 0 indicates the component is relative, and 1 absolute.<br>
102 public Vector2 PositionPolicy
106 return _visualOffsetPolicy;
110 _visualOffsetPolicy = value;
116 /// Get or set size policy of the visual.<br>
117 /// Indicates which components of the size are relative
118 /// (percentage of the parent) or absolute (in world units).<br>
119 /// 0 indicates the component is relative, and 1 absolute.<br>
121 public Vector2 SizePolicy
125 return _visualSizePolicy;
129 _visualSizePolicy = value;
135 /// Get or set the origin of the visual within its control area.
137 public Visual.AlignType Origin
141 return _visualOrigin ?? (Visual.AlignType)(-1);
145 _visualOrigin = value;
151 /// Get or set the anchor-point of the visual.
153 public Visual.AlignType AnchorPoint
157 return _visualAnchorPoint ?? (Visual.AlignType)(-1);
161 _visualAnchorPoint = value;
167 /// Get or set the depth index of the visual.
169 public float DepthIndex
181 private void ComposingTransformMap()
183 _visualTransformMap = new PropertyMap();
184 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
185 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
186 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
187 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
188 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
189 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
193 /// Get the transform map used by the visual.
195 public PropertyMap OutputTransformMap
199 ComposingTransformMap();
200 return _visualTransformMap;
204 protected virtual void ComposingPropertyMap()
206 _outputVisualMap = new PropertyMap();
210 /// Get the property map to create the visual.
212 public PropertyMap OutputVisualMap
216 ComposingPropertyMap();
217 return _outputVisualMap;
221 internal void UpdateVisual()
225 Tizen.Log.Debug("NUI", "UpdateVisual()! VisualIndex=" + VisualIndex);
226 Parent.UpdateVisual(VisualIndex, Name, this);
230 Tizen.Log.Debug("NUI", "VisualIndex was not set");
234 protected PropertyMap _shader = null;
235 //private PropertyMap _transform = null;
236 protected bool? _premultipliedAlpha = null;
237 protected Color _mixColor = null;
238 protected float? _opacity = null;
239 protected PropertyMap _commonlyUsedMap = null;
242 /// The shader to use in the visual.
244 public PropertyMap Shader
257 /// Enables/disables premultiplied alpha. <br>
258 /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type.
260 public bool PremultipliedAlpha
264 return _premultipliedAlpha??false;
268 _premultipliedAlpha = value;
273 /// Mix color is a blend color for any visual.
275 public Color MixColor
288 /// Opacity is the alpha component of the mixColor, above.
294 return _opacity??(-1.0f);
306 /// A class encapsulating the property map of a image visual.
308 public class ImageVisual : VisualMap
310 public ImageVisual() : base()
314 private string _url = null;
315 private FittingModeType? _fittingMode = null;
316 private SamplingModeType? _samplingMode = null;
317 private int? _desiredWidth = null;
318 private int? _desiredHeight = null;
319 private bool? _synchronousLoading = false;
320 private bool? _borderOnly = null;
321 private Vector4 _pixelArea = null;
322 private WrapModeType? _wrapModeU = null;
323 private WrapModeType? _wrapModeV = null;
326 /// Get or set the URL of the image.
342 /// Get or set fitting options, used when resizing images to fit desired dimensions.<br>
343 /// If not supplied, default is FittingMode::SHRINK_TO_FIT.<br>
344 /// For Normal Quad images only.<br>
346 public FittingModeType FittingMode
350 return _fittingMode ?? (FittingModeType)(-1);
354 _fittingMode = value;
360 /// Get or set filtering options, used when resizing images to sample original pixels.<br>
361 /// If not supplied, default is SamplingMode::BOX.<br>
362 /// For Normal Quad images only.<br>
364 public SamplingModeType SamplingMode
368 return _samplingMode ?? (SamplingModeType)(-1);
372 _samplingMode = value;
378 /// Get or set the desired image width.<br>
379 /// If not specified, the actual image width is used.<br>
380 /// For Normal Quad images only.<br>
382 public int DesiredWidth
386 return _desiredWidth ?? (-1);
390 _desiredWidth = value;
396 /// Get or set the desired image height.<br>
397 /// If not specified, the actual image height is used.<br>
398 /// For Normal Quad images only.<br>
400 public int DesiredHeight
404 return _desiredHeight ?? (-1);
408 _desiredHeight = value;
414 /// Get or set whether to load the image synchronously.<br>
415 /// If not specified, the default is false, i.e. the image is loaded asynchronously.<br>
416 /// For Normal Quad images only.<br>
418 public bool SynchronousLoading
422 return _synchronousLoading ?? false;
426 _synchronousLoading = value;
432 /// Get or set whether to draws the borders only(If true).<br>
433 /// If not specified, the default is false.<br>
434 /// For N-Patch images only.<br>
436 public bool BorderOnly
440 return _borderOnly ?? false;
450 /// Get or set the image area to be displayed.<br>
451 /// It is a rectangular area.<br>
452 /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
453 /// If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.<br>
454 /// For For Normal QUAD image only.<br>
456 public Vector4 PixelArea
470 /// Get or set the wrap mode for u coordinate.<br>
471 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br>
472 /// If not specified, the default is CLAMP.<br>
473 /// For Normal QUAD image only.<br>
475 public WrapModeType WrapModeU
479 return _wrapModeU ?? (WrapModeType)(-1);
489 /// Get or set the wrap mode for v coordinate.<br>
490 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br>
491 /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
492 /// If not specified, the default is CLAMP.<br>
493 /// For Normal QUAD image only.
495 public WrapModeType WrapModeV
499 return _wrapModeV ?? (WrapModeType)(-1);
508 protected override void ComposingPropertyMap()
510 _outputVisualMap = new PropertyMap();
511 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
512 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
513 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
514 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
515 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
516 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
517 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
518 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
519 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
520 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
521 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
522 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
523 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
524 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
525 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
530 /// A class encapsulating the property map of a text visual.
532 public class TextVisual : VisualMap
534 public TextVisual() : base()
538 private string _text = null;
539 private string _fontFamily = null;
540 private PropertyMap _fontStyle = null;
541 private float? _pointSize = null;
542 private bool? _multiLine = null;
543 private string _horizontalAlignment = null;
544 private string _verticalAlignment = null;
545 private Color _textColor = null;
546 private bool? _enableMarkup = null;
549 /// Get or set the text to display in UTF-8 format.
565 /// Get or set the requested font family to use.
567 public string FontFamily
581 /// Get or set the requested font style to use.
583 public PropertyMap FontStyle
597 /// Get or set the size of font in points.
599 public float PointSize
603 return _pointSize ?? (-1.0f);
613 /// Get or set the single-line or multi-line layout option.
615 public bool MultiLine
619 return _multiLine ?? false;
629 /// Get or set the line horizontal alignment.<br>
630 /// If not specified, the default is BEGIN.<br>
632 public HorizontalAlignment HorizontalAlignment
636 switch (_horizontalAlignment)
639 return HorizontalAlignment.HorizontalAlignBegin;
641 return HorizontalAlignment.HorizontalAlignCenter;
643 return HorizontalAlignment.HorizontalAlignEnd;
645 return HorizontalAlignment.HorizontalAlignBegin;
652 case HorizontalAlignment.HorizontalAlignBegin:
654 _horizontalAlignment = "BEGIN";
657 case HorizontalAlignment.HorizontalAlignCenter:
659 _horizontalAlignment = "CENTER";
662 case HorizontalAlignment.HorizontalAlignEnd:
664 _horizontalAlignment = "END";
669 _horizontalAlignment = "BEGIN";
678 /// Get or set the line vertical alignment.<br>
679 /// If not specified, the default is TOP.<br>
681 public VerticalAlignment VerticalAlignment
685 switch (_verticalAlignment)
688 return VerticalAlignment.VerticalAlignTop;
690 return VerticalAlignment.VerticalAlignCenter;
692 return VerticalAlignment.VerticalAlignBottom;
694 return VerticalAlignment.VerticalAlignBottom;
701 case VerticalAlignment.VerticalAlignTop:
703 _verticalAlignment = "TOP";
706 case VerticalAlignment.VerticalAlignCenter:
708 _verticalAlignment = "CENTER";
711 case VerticalAlignment.VerticalAlignBottom:
713 _verticalAlignment = "BOTTOM";
718 _verticalAlignment = "TOP";
727 /// Get or set the color of the text.
729 public Color TextColor
743 /// Get or set whether the mark-up processing is enabled.
745 public bool EnableMarkup
749 return _enableMarkup ?? false;
753 _enableMarkup = value;
758 protected override void ComposingPropertyMap()
760 _outputVisualMap = new PropertyMap();
761 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
762 if (_text != null) { _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text)); }
763 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
764 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
765 if (_pointSize != null) { _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize)); }
766 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
767 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
768 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
769 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
770 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
771 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
772 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
773 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
774 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
779 /// A class encapsulating the property map of a border visual.
781 public class BorderVisual : VisualMap
783 public BorderVisual() : base()
787 private Color _color = null;
788 private float? _size = null;
789 private bool? _antiAliasing = null;
792 /// Get or set the color of the border.
808 /// Get or set the width of the border (in pixels).
810 public float BorderSize
814 return _size ?? (-1.0f);
824 /// Get or set whether anti-aliasing of the border is required.<br>
825 /// If not supplied, default is false.<br>
827 public bool AntiAliasing
831 return _antiAliasing ?? false;
835 _antiAliasing = value;
840 protected override void ComposingPropertyMap()
842 _outputVisualMap = new PropertyMap();
843 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
844 if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); }
845 if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); }
846 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
847 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
848 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
849 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
850 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
855 /// A class encapsulating the property map of a color visual.
857 public class ColorVisual : VisualMap
859 public ColorVisual() : base()
863 private Color _mixColorForColorVisual = null;
866 /// Get or set the solid color required.
872 return _mixColorForColorVisual;
876 _mixColorForColorVisual = value;
881 protected override void ComposingPropertyMap()
883 _outputVisualMap = new PropertyMap();
884 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
885 if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); }
886 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
887 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
888 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
893 /// A class encapsulating the property map of a gradient visual.
895 public class GradientVisual : VisualMap
897 public GradientVisual() : base()
901 private Vector2 _startPosition = null;
902 private Vector2 _endPosition = null;
903 private Vector2 _center = null;
904 private float? _radius = null;
905 private PropertyArray _stopOffset = null;
906 private PropertyArray _stopColor = null;
907 private GradientVisualUnitsType? _units = null;
908 private GradientVisualSpreadMethodType? _spreadMethod = null;
911 /// Get or set the start position of a linear gradient.<br>
912 /// Mandatory for Linear.<br>
914 public Vector2 StartPosition
918 return _startPosition;
922 _startPosition = value;
928 /// Get or set the end position of a linear gradient.<br>
929 /// Mandatory for Linear.<br>
931 public Vector2 EndPosition
939 _endPosition = value;
945 /// Get or set the center point of a radial gradient.<br>
946 /// Mandatory for Radial.<br>
948 public Vector2 Center
962 /// Get or set the size of the radius of a radial gradient.<br>
963 /// Mandatory for Radial.<br>
969 return _radius ?? (-1.0f);
979 /// Get or set all the stop offsets.<br>
980 /// A PropertyArray of float.<br>
981 /// If not supplied, default is 0.0f and 1.0f.<br>
983 public PropertyArray StopOffset
997 /// Get or set the color at the stop offsets.<br>
998 /// A PropertyArray of Color.<br>
999 /// At least 2 values required to show a gradient.<br>
1001 public PropertyArray StopColor
1015 /// Get or set defines the coordinate system for certain attributes of the points in a gradient.<br>
1016 /// If not supplied, default is GradientVisualUnitsType.OBJECT_BOUNDING_BOX.<br>
1018 public GradientVisualUnitsType Units
1022 return _units ?? (GradientVisualUnitsType)(-1);
1032 /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1033 /// If not supplied, default is GradientVisualSpreadMethodType.PAD.<br>
1035 public GradientVisualSpreadMethodType SpreadMethod
1039 return _spreadMethod ?? (GradientVisualSpreadMethodType)(-1);
1043 _spreadMethod = value;
1048 protected override void ComposingPropertyMap()
1050 _outputVisualMap = new PropertyMap();
1051 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1052 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1053 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1054 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1055 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1056 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1057 if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); }
1058 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1059 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1060 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1061 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1062 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1063 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1068 /// A class encapsulating the property map of a mesh visual.
1070 public class MeshVisual : VisualMap
1072 public MeshVisual() : base()
1076 private string _objectURL = null;
1077 private string _materialtURL = null;
1078 private string _texturesPath = null;
1079 private MeshVisualShadingModeValue? _shadingMode = null;
1080 private bool? _useMipmapping = null;
1081 private bool? _useSoftNormals = null;
1082 private Vector3 _lightPosition = null;
1085 /// Get or set the location of the ".obj" file.
1087 public string ObjectURL
1101 /// Get or set the location of the ".mtl" file.<br>
1102 /// If not specified, then a textureless object is assumed.<br>
1104 public string MaterialtURL
1108 return _materialtURL;
1112 _materialtURL = value;
1118 /// Get or set path to the directory the textures (including gloss and normal) are stored in.<br>
1119 /// Mandatory if using material.<br>
1121 public string TexturesPath
1125 return _texturesPath;
1129 _texturesPath = value;
1135 /// Get or set the type of shading mode that the mesh will use.<br>
1136 /// If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.<br>
1137 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).<br>
1139 public MeshVisualShadingModeValue ShadingMode
1143 return _shadingMode??(MeshVisualShadingModeValue)(-1);
1147 _shadingMode = value;
1153 /// Get or set whether to use mipmaps for textures or not.<br>
1154 /// If not specified, the default is true.<br>
1156 public bool UseMipmapping
1160 return _useMipmapping??false;
1164 _useMipmapping = value;
1170 /// Get or set whether to average normals at each point to smooth textures or not.<br>
1171 /// If not specified, the default is true.<br>
1173 public bool UseSoftNormals
1177 return _useSoftNormals??false;
1181 _useSoftNormals = value;
1187 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1188 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1189 /// and using all zeroes will place the light at the top left corner.<br>
1190 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1192 public Vector3 LightPosition
1196 return _lightPosition;
1200 _lightPosition = value;
1205 protected override void ComposingPropertyMap()
1207 _outputVisualMap = new PropertyMap();
1208 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1209 if (_objectURL != null) { _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL)); }
1210 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1211 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1212 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1213 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1214 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1215 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1216 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1217 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1218 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1224 /// A class encapsulating the property map of a primetive visual.
1226 public class PrimitiveVisual : VisualMap
1228 public PrimitiveVisual() : base()
1232 private PrimitiveVisualShapeType? _shape = null;
1233 private Color _mixColorForPrimitiveVisual = null;
1234 private int? _slices = null;
1235 private int? _stacks = null;
1236 private float? _scaleTopRadius = null;
1237 private float? _scaleBottomRadius = null;
1238 private float? _scaleHeight = null;
1239 private float? _scaleRadius = null;
1240 private Vector3 _scaleDimensions = null;
1241 private float? _bevelPercentage = null;
1242 private float? _bevelSmoothness = null;
1243 private Vector3 _lightPosition = null;
1246 /// Get or set the specific shape to render.<br>
1247 /// If not specified, the default is PrimitiveVisualShapeType.SPHERE.<br>
1249 public PrimitiveVisualShapeType Shape
1253 return _shape??(PrimitiveVisualShapeType)(-1);
1263 /// Get or set the color of the shape.<br>
1264 /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).<br>
1265 /// Applies to ALL shapes.<br>
1267 public Color MixColor
1271 return _mixColorForPrimitiveVisual;
1275 _mixColorForPrimitiveVisual = value;
1281 /// Get or set the number of slices as you go around the shape.<br>
1282 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1283 /// If not specified, the default is 128.<br>
1284 /// The range is from 1 to 255.<br>
1290 return _slices??(-1);
1300 /// Get or set the number of stacks as you go down the shape.<br>
1301 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1302 /// If not specified, the default is 128.<br>
1303 /// The range is from 1 to 255.<br>
1309 return _stacks??(-1);
1319 /// Get or set the scale of the radius of the top circle of a conical frustrum.<br>
1320 /// If not specified, the default is 1.0f.<br>
1321 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1322 /// Only values greater than or equal to 0.0f are accepted.<br>
1324 public float ScaleTopRadius
1328 return _scaleTopRadius ?? (-1.0f);
1332 _scaleTopRadius = value;
1338 /// Get or set the scale of the radius of the bottom circle of a conical frustrum.<br>
1339 /// If not specified, the default is 1.5f.<br>
1340 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1341 /// - PrimitiveVisualShapeType.CONE<br>
1342 /// Only values greater than or equal to 0.0f are accepted.<br>
1344 public float ScaleBottomRadius
1348 return _scaleBottomRadius ?? (-1.0f);
1352 _scaleBottomRadius = value;
1358 /// Get or set the scale of the height of a conic.<br>
1359 /// If not specified, the default is 3.0f.<br>
1361 /// - Shape::CONICAL_FRUSTRUM<br>
1362 /// - Shape::CONE<br>
1363 /// - Shape::CYLINDER<br>
1364 /// Only values greater than or equal to 0.0f are accepted.<br>
1366 public float ScaleHeight
1370 return _scaleHeight??(-1.0f);
1374 _scaleHeight = value;
1380 /// Get or set the scale of the radius of a cylinder.<br>
1381 /// If not specified, the default is 1.0f.<br>
1383 /// - Shape::CYLINDER<br>
1384 /// Only values greater than or equal to 0.0f are accepted.<br>
1386 public float ScaleRadius
1390 return _scaleRadius ?? (-1.0f);
1394 _scaleRadius = value;
1400 /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1401 /// If not specified, the default is Vector3.One.<br>
1403 /// - Shape::CUBE<br>
1404 /// - Shape::OCTAHEDRON<br>
1405 /// - Shape::BEVELLED_CUBE<br>
1406 /// Each vector3 parameter should be greater than or equal to 0.0f.<br>
1408 public Vector3 ScaleDimensions
1412 return _scaleDimensions;
1416 _scaleDimensions = value;
1422 /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1423 /// Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.<br>
1424 /// If not specified, the default is 0.0f (no bevel).<br>
1426 /// - Shape::BEVELLED_CUBE<br>
1427 /// The range is from 0.0f to 1.0f.<br>
1429 public float BevelPercentage
1433 return _bevelPercentage ?? (-1.0f);
1437 _bevelPercentage = value;
1443 /// Get or set defines how smooth the bevelled edges should be.<br>
1444 /// If not specified, the default is 0.0f (sharp edges).<br>
1446 /// - Shape::BEVELLED_CUBE<br>
1447 /// The range is from 0.0f to 1.0f.<br>
1449 public float BevelSmoothness
1453 return _bevelSmoothness ?? (-1.0f);
1457 _bevelSmoothness = value;
1463 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1464 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1465 /// and using all zeroes will place the light at the top left corner.<br>
1466 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1467 /// Applies to ALL shapes.
1469 public Vector3 LightPosition
1473 return _lightPosition;
1477 _lightPosition = value;
1482 protected override void ComposingPropertyMap()
1484 _outputVisualMap = new PropertyMap(); ;
1485 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1486 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1487 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1488 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1489 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1490 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1491 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1492 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1493 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1494 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1495 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1496 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1497 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1498 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1499 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1500 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1505 /// A class encapsulating the property map of a n-patch image visual.
1507 public class NPatchVisual : VisualMap
1509 public NPatchVisual() : base()
1513 private string _url = null;
1514 private bool? _borderOnly = null;
1515 private Rectangle _border = null;
1518 /// Get or set the URL of the image.
1534 /// Get or set whether to draws the borders only(If true).<br>
1535 /// If not specified, the default is false.<br>
1536 /// For N-Patch images only.<br>
1538 public bool BorderOnly
1542 return _borderOnly ?? false;
1546 _borderOnly = value;
1552 /// The border of the image in the order: left, right, bottom, top.
1554 public Rectangle Border
1567 protected override void ComposingPropertyMap()
1569 _outputVisualMap = new PropertyMap();
1570 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1571 if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); }
1572 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1573 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
1574 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1575 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1576 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1577 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1584 /// This specifies wrap mode types <br>
1585 /// WrapModeU and WrapModeV separately decide how the texture should be sampled when the u and v coordinate exceeds the range of 0.0 to 1.0.
1587 public enum WrapModeType
1608 /// The type of coordinate system for certain attributes of the points in a gradient.
1610 public enum GradientVisualUnitsType
1613 /// Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5).
1617 /// Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200).
1623 /// This specifies SpreadMethod types.<br>
1624 /// SpreadMethod defines what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1626 public enum GradientVisualSpreadMethodType
1629 /// Uses the terminal colors of the gradient to fill the remainder of the quad.
1633 /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled.
1637 /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled.
1643 /// The shading mode used by MeshVisual.
1645 public enum MeshVisualShadingModeValue
1648 /// *Simplest*. One color that is lit by ambient and diffuse lighting.
1650 TexturelessWithDiffuseLighting,
1652 /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting.
1654 TexturedWithSpecularLighting,
1656 /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting.
1658 TexturedWithDetailedSpecularLighting
1662 /// The primitive shape to render as a PrimitiveVisual.
1664 public enum PrimitiveVisualShapeType
1667 /// A perfectly round geometrical object in three-dimensional space.
1671 /// The area bound between two circles, i.e. a cone with the tip removed.
1675 /// Equivalent to a conical frustrum with top radius of zero.
1676 /// </summary>Equivalent to a conical frustrum with top radius of zero.
1679 /// Equivalent to a conical frustrum with top radius of zero.
1683 /// Equivalent to a conical frustrum with equal radii for the top and bottom circles.
1687 /// Equivalent to a bevelled cube with a bevel percentage of zero.
1691 /// Equivalent to a bevelled cube with a bevel percentage of one.
1697 /// This specifies fitting mode types. Fitting options, used when resizing images to fit desired dimensions.<br>
1698 /// A fitting mode controls the region of a loaded image to be mapped to the desired image rectangle.<br>
1699 /// All fitting modes preserve the aspect ratio of the image contents.<br>
1701 public enum FittingModeType
1704 /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode.
1708 /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode.
1712 /// Image columns: Limit loaded image resolution to column width using FitWidth mode.
1716 /// Image rows: Limit loaded image resolution to row height using FitHeight mode.
1722 /// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.<br>
1723 /// A SamplingMode controls how pixels in an input image are sampled and combined to generate each pixel of a destination image during a scaling.<br>
1724 /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,<br>
1725 /// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.<br>
1727 public enum SamplingModeType
1730 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size. <br>
1731 /// This is the default.
1735 /// For each output pixel, read one input pixel.
1739 /// For each output pixel, read a quad of four input pixels and write a weighted average of them.
1743 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size, <br>
1744 /// then for each output pixel, read one pixel from the last level of box filtering.<br>
1748 /// Iteratively box filter to almost the right size, then for each output pixel, read four pixels from the last level of box filtering and write their weighted average.
1752 /// No filtering is performed. If the SCALE_TO_FILL scaling mode is enabled, the borders of the image may be trimmed to match the aspect ratio of the desired dimensions.
1756 /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image.
1762 /// This specifies policy types that could be used by the transform for the offset or size.
1764 public enum VisualTransformPolicyType
1767 /// Relative to the control (percentage [0.0f to 1.0f] of the control).
1771 /// Absolute value in world units.
1777 /// This specifies all the transform property types.
1779 public enum VisualTransformPropertyType
1782 /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1786 /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1790 /// The origin of the visual within its control area.
1794 /// The anchor-point of the visual
1798 /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1802 /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1808 /// This specifies visual types.
1810 public struct Visual
1813 /// The index for the visual type.
1818 /// Renders a solid color as an internal border to the control's quad.
1822 /// Renders a solid color to the control's quad.
1826 /// Renders a smooth transition of colors to the control's quad.
1830 /// Renders an image into the control's quad.
1834 /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file.
1838 /// Renders a simple 3D shape, such as a cube or sphere.
1842 /// Renders a simple wire-frame outlining a quad.
1850 /// Renders an n-patch image.
1854 /// Renders an SVG image.
1858 /// Renders a animated image. (Animated GIF)
1864 /// This specifies visual properties.
1866 public struct Property
1868 public static readonly int Type = NDalic.VISUAL_PROPERTY_TYPE;
1869 public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER;
1870 public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
1871 public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
1872 public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
1873 public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1;
1877 /// This specifies shader properties.
1879 public struct ShaderProperty
1881 public static readonly int VertexShader = NDalic.VISUAL_SHADER_VERTEX;
1882 public static readonly int FragmentShader = NDalic.VISUAL_SHADER_FRAGMENT;
1883 public static readonly int ShaderSubdivideGridX = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_X;
1884 public static readonly int ShaderSubdivideGridY = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_Y;
1885 public static readonly int ShaderHints = NDalic.VISUAL_SHADER_HINTS;
1889 /// This specifies Visaul align types.
1891 public enum AlignType
1906 /// This specifies properties of BorderVisual.
1908 public struct BorderVisualProperty
1910 public static readonly int Color = NDalic.BORDER_VISUAL_COLOR;
1911 public static readonly int Size = NDalic.BORDER_VISUAL_SIZE;
1912 public static readonly int AntiAliasing = NDalic.BORDER_VISUAL_ANTI_ALIASING;
1916 /// This specifies properties of ColorVisual.
1918 public struct ColorVisualProperty
1920 public static readonly int MixColor = NDalic.COLOR_VISUAL_MIX_COLOR;
1924 /// This specifies properties of GradientVisual.
1926 public struct GradientVisualProperty
1928 public static readonly int StartPosition = NDalic.GRADIENT_VISUAL_START_POSITION;
1929 public static readonly int EndPosition = NDalic.GRADIENT_VISUAL_END_POSITION;
1930 public static readonly int Center = NDalic.GRADIENT_VISUAL_CENTER;
1931 public static readonly int Radius = NDalic.GRADIENT_VISUAL_RADIUS;
1932 public static readonly int StopOffset = NDalic.GRADIENT_VISUAL_STOP_OFFSET;
1933 public static readonly int StopColor = NDalic.GRADIENT_VISUAL_STOP_COLOR;
1934 public static readonly int Units = NDalic.GRADIENT_VISUAL_UNITS;
1935 public static readonly int SpreadMethod = NDalic.GRADIENT_VISUAL_SPREAD_METHOD;
1939 /// This specifies properties of ImageVisual.
1941 public struct ImageVisualProperty
1943 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
1944 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
1945 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
1946 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
1947 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
1948 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
1949 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
1950 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
1951 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
1952 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
1953 public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
1957 /// This specifies properties of MeshVisual.
1959 public struct MeshVisualProperty
1961 public static readonly int ObjectURL = NDalic.MESH_VISUAL_OBJECT_URL;
1962 public static readonly int MaterialtURL = NDalic.MESH_VISUAL_MATERIAL_URL;
1963 public static readonly int TexturesPath = NDalic.MESH_VISUAL_TEXTURES_PATH;
1964 public static readonly int ShadingMode = NDalic.MESH_VISUAL_SHADING_MODE;
1965 public static readonly int UseMipmapping = NDalic.MESH_VISUAL_USE_MIPMAPPING;
1966 public static readonly int UseSoftNormals = NDalic.MESH_VISUAL_USE_SOFT_NORMALS;
1967 public static readonly int LightPosition = NDalic.MESH_VISUAL_LIGHT_POSITION;
1971 /// This specifies properties of PrimitiveVisual.
1973 public struct PrimitiveVisualProperty
1975 public static readonly int Shape = NDalic.PRIMITIVE_VISUAL_SHAPE;
1976 public static readonly int MixColor = NDalic.PRIMITIVE_VISUAL_MIX_COLOR;
1977 public static readonly int Slices = NDalic.PRIMITIVE_VISUAL_SLICES;
1978 public static readonly int Stacks = NDalic.PRIMITIVE_VISUAL_STACKS;
1979 public static readonly int ScaleTopRadius = NDalic.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS;
1980 public static readonly int ScaleBottomRadius = NDalic.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS;
1981 public static readonly int ScaleHeight = NDalic.PRIMITIVE_VISUAL_SCALE_HEIGHT;
1982 public static readonly int ScaleRadius = NDalic.PRIMITIVE_VISUAL_SCALE_RADIUS;
1983 public static readonly int ScaleDimensions = NDalic.PRIMITIVE_VISUAL_SCALE_DIMENSIONS;
1984 public static readonly int BevelPercentage = NDalic.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE;
1985 public static readonly int BevelSmoothness = NDalic.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS;
1986 public static readonly int LightPosition = NDalic.PRIMITIVE_VISUAL_LIGHT_POSITION;
1990 /// This specifies properties of TextVisual.
1992 public struct TextVisualProperty
1994 public static readonly int Text = NDalic.TEXT_VISUAL_TEXT;
1995 public static readonly int FontFamily = NDalic.TEXT_VISUAL_FONT_FAMILY;
1996 public static readonly int FontStyle = NDalic.TEXT_VISUAL_FONT_STYLE;
1997 public static readonly int PointSize = NDalic.TEXT_VISUAL_POINT_SIZE;
1998 public static readonly int MultiLine = NDalic.TEXT_VISUAL_MULTI_LINE;
1999 public static readonly int HorizontalAlignment = NDalic.TEXT_VISUAL_HORIZONTAL_ALIGNMENT;
2000 public static readonly int VerticalAlignment = NDalic.TEXT_VISUAL_VERTICAL_ALIGNMENT;
2001 public static readonly int TextColor = NDalic.TEXT_VISUAL_TEXT_COLOR;
2002 public static readonly int EnableMarkup = NDalic.TEXT_VISUAL_ENABLE_MARKUP;
2006 /// This specifies properties of NpatchImageVisual.
2008 public struct NpatchImageVisualProperty
2010 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
2011 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
2012 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
2013 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
2014 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
2015 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
2016 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
2017 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
2018 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
2019 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
2020 public static readonly int Border = NDalic.IMAGE_VISUAL_WRAP_MODE_V + 1;
2024 /// A class encapsulating the property map of a SVG visual.
2026 public class SVGVisual : VisualMap
2028 public SVGVisual() : base()
2032 private string _url = null;
2047 protected override void ComposingPropertyMap()
2049 _outputVisualMap = new PropertyMap();
2050 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2051 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2052 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2053 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2054 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2055 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2060 /// A class encapsulating the property map of a Animated Image(AGIF) visual.
2062 public class AnimatedImageVisual : VisualMap
2064 public AnimatedImageVisual() : base()
2068 private string _url = null;
2083 protected override void ComposingPropertyMap()
2085 _outputVisualMap = new PropertyMap();
2086 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2087 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2088 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2089 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2090 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2091 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2096 /// A class encapsulating the property map of a visual transition(Animator).
2098 public class AnimatorVisual : VisualMap
2100 public AnimatorVisual() : base()
2104 private string _alphaFunction = null;
2105 private int _startTime = 0;
2106 private int _endTime = 0;
2107 private string _target = null;
2108 private string _propertyIndex = null;
2109 private object _destinationValue = null;
2111 public string AlphaFunction
2115 return _alphaFunction;
2119 _alphaFunction = value;
2123 public int StartTime
2147 public string Target
2159 public string PropertyIndex
2163 return _propertyIndex;
2167 _propertyIndex = value;
2171 public object DestinationValue
2175 return _destinationValue;
2179 _destinationValue = value;
2183 protected override void ComposingPropertyMap()
2185 PropertyMap _animator = new PropertyMap();
2186 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2188 PropertyMap _timePeriod = new PropertyMap();
2189 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2190 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2191 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2193 string _str1 = _propertyIndex.Substring(0, 1);
2194 string _str2 = _propertyIndex.Substring(1);
2195 string _str = _str1.ToLower() + _str2;
2197 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2199 PropertyMap _transition = new PropertyMap();
2200 _transition.Add("target", new PropertyValue(_target));
2201 _transition.Add("property", new PropertyValue(_str));
2202 _transition.Add("targetValue", val);
2203 _transition.Add("animator", new PropertyValue(_animator));
2205 _outputVisualMap = _transition;