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;
22 /// A class encapsulating the transform map of visual.
24 public class VisualMap
26 private Vector2 _visualSize = null;
27 private Vector2 _visualOffset = null;
28 private Vector2 _visualOffsetPolicy = null;
29 private Vector2 _visualSizePolicy = null;
30 private Visual.AlignType? _visualOrigin = null;
31 private Visual.AlignType? _visualAnchorPoint = null;
33 private PropertyMap _visualTransformMap = null;
35 private float _depthIndex = 0.0f;
36 protected PropertyMap _outputVisualMap = null;
44 internal int VisualIndex
49 internal VisualView Parent
60 /// Get or set size of the visual.<br>
61 /// It can be either relative (percentage of the parent)
62 /// or absolute (in world units).<br>
78 /// Get or set offset of the visual.<br>
79 /// It can be either relative (percentage of the parent)
80 /// or absolute (in world units).<br>
82 public Vector2 Position
90 _visualOffset = value;
96 /// Get or set offset policy of the visual.<br>
97 /// Indicates which components of the offset are relative
98 /// (percentage of the parent) or absolute (in world units).<br>
99 /// 0 indicates the component is relative, and 1 absolute.<br>
101 public Vector2 PositionPolicy
105 return _visualOffsetPolicy;
109 _visualOffsetPolicy = value;
115 /// Get or set size policy of the visual.<br>
116 /// Indicates which components of the size are relative
117 /// (percentage of the parent) or absolute (in world units).<br>
118 /// 0 indicates the component is relative, and 1 absolute.<br>
120 public Vector2 SizePolicy
124 return _visualSizePolicy;
128 _visualSizePolicy = value;
134 /// Get or set the origin of the visual within its control area.
136 public Visual.AlignType Origin
140 return _visualOrigin ?? (Visual.AlignType)(-1);
144 _visualOrigin = value;
150 /// Get or set the anchor-point of the visual.
152 public Visual.AlignType AnchorPoint
156 return _visualAnchorPoint ?? (Visual.AlignType)(-1);
160 _visualAnchorPoint = value;
166 /// Get or set the depth index of the visual.
168 public float DepthIndex
180 private void ComposingTransformMap()
182 _visualTransformMap = new PropertyMap();
183 if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
184 if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
185 if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
186 if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
187 if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
188 if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
192 /// Get the transform map used by the visual.
194 public PropertyMap OutputTransformMap
198 ComposingTransformMap();
199 return _visualTransformMap;
203 protected virtual void ComposingPropertyMap()
205 _outputVisualMap = new PropertyMap();
209 /// Get the property map to create the visual.
211 public PropertyMap OutputVisualMap
215 ComposingPropertyMap();
216 return _outputVisualMap;
220 internal void UpdateVisual()
224 Tizen.Log.Debug("NUI", "UpdateVisual()! VisualIndex=" + VisualIndex);
225 Parent.UpdateVisual(VisualIndex, Name, this);
229 Tizen.Log.Debug("NUI", "VisualIndex was not set");
233 protected PropertyMap _shader = null;
234 //private PropertyMap _transform = null;
235 protected bool? _premultipliedAlpha = null;
236 protected Color _mixColor = null;
237 protected float? _opacity = null;
238 protected PropertyMap _commonlyUsedMap = null;
241 /// The shader to use in the visual.
243 public PropertyMap Shader
256 /// Enables/disables premultiplied alpha. <br>
257 /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type.
259 public bool PremultipliedAlpha
263 return _premultipliedAlpha??false;
267 _premultipliedAlpha = value;
272 /// Mix color is a blend color for any visual.
274 public Color MixColor
287 /// Opacity is the alpha component of the mixColor, above.
293 return _opacity??(-1.0f);
305 /// A class encapsulating the property map of a image visual.
307 public class ImageVisual : VisualMap
309 public ImageVisual() : base()
313 private string _url = null;
314 private FittingModeType? _fittingMode = null;
315 private SamplingModeType? _samplingMode = null;
316 private int? _desiredWidth = null;
317 private int? _desiredHeight = null;
318 private bool? _synchronousLoading = false;
319 private bool? _borderOnly = null;
320 private Vector4 _pixelArea = null;
321 private WrapModeType? _wrapModeU = null;
322 private WrapModeType? _wrapModeV = null;
325 /// Get or set the URL of the image.
341 /// Get or set fitting options, used when resizing images to fit desired dimensions.<br>
342 /// If not supplied, default is FittingMode::SHRINK_TO_FIT.<br>
343 /// For Normal Quad images only.<br>
345 public FittingModeType FittingMode
349 return _fittingMode ?? (FittingModeType)(-1);
353 _fittingMode = value;
359 /// Get or set filtering options, used when resizing images to sample original pixels.<br>
360 /// If not supplied, default is SamplingMode::BOX.<br>
361 /// For Normal Quad images only.<br>
363 public SamplingModeType SamplingMode
367 return _samplingMode ?? (SamplingModeType)(-1);
371 _samplingMode = value;
377 /// Get or set the desired image width.<br>
378 /// If not specified, the actual image width is used.<br>
379 /// For Normal Quad images only.<br>
381 public int DesiredWidth
385 return _desiredWidth ?? (-1);
389 _desiredWidth = value;
395 /// Get or set the desired image height.<br>
396 /// If not specified, the actual image height is used.<br>
397 /// For Normal Quad images only.<br>
399 public int DesiredHeight
403 return _desiredHeight ?? (-1);
407 _desiredHeight = value;
413 /// Get or set whether to load the image synchronously.<br>
414 /// If not specified, the default is false, i.e. the image is loaded asynchronously.<br>
415 /// For Normal Quad images only.<br>
417 public bool SynchronousLoading
421 return _synchronousLoading ?? false;
425 _synchronousLoading = value;
431 /// Get or set whether to draws the borders only(If true).<br>
432 /// If not specified, the default is false.<br>
433 /// For N-Patch images only.<br>
435 public bool BorderOnly
439 return _borderOnly ?? false;
449 /// Get or set the image area to be displayed.<br>
450 /// It is a rectangular area.<br>
451 /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
452 /// If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.<br>
453 /// For For Normal QUAD image only.<br>
455 public Vector4 PixelArea
469 /// Get or set the wrap mode for u coordinate.<br>
470 /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.<br>
471 /// If not specified, the default is CLAMP.<br>
472 /// For Normal QUAD image only.<br>
474 public WrapModeType WrapModeU
478 return _wrapModeU ?? (WrapModeType)(-1);
488 /// Get or set the wrap mode for v coordinate.<br>
489 /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.<br>
490 /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.<br>
491 /// If not specified, the default is CLAMP.<br>
492 /// For Normal QUAD image only.
494 public WrapModeType WrapModeV
498 return _wrapModeV ?? (WrapModeType)(-1);
507 protected override void ComposingPropertyMap()
509 _outputVisualMap = new PropertyMap();
510 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
511 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
512 if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); }
513 if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); }
514 if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); }
515 if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); }
516 if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
517 if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
518 if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
519 if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
520 if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
521 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
522 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
523 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
524 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
529 /// A class encapsulating the property map of a text visual.
531 public class TextVisual : VisualMap
533 public TextVisual() : base()
537 private string _text = null;
538 private string _fontFamily = null;
539 private PropertyMap _fontStyle = null;
540 private float? _pointSize = null;
541 private bool? _multiLine = null;
542 private string _horizontalAlignment = null;
543 private string _verticalAlignment = null;
544 private Color _textColor = null;
545 private bool? _enableMarkup = null;
548 /// Get or set the text to display in UTF-8 format.
564 /// Get or set the requested font family to use.
566 public string FontFamily
580 /// Get or set the requested font style to use.
582 public PropertyMap FontStyle
596 /// Get or set the size of font in points.
598 public float PointSize
602 return _pointSize ?? (-1.0f);
612 /// Get or set the single-line or multi-line layout option.
614 public bool MultiLine
618 return _multiLine ?? false;
628 /// Get or set the line horizontal alignment.<br>
629 /// If not specified, the default is BEGIN.<br>
631 public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment
635 switch (_horizontalAlignment)
638 return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin;
640 return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter;
642 return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd;
644 return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin;
651 case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin:
653 _horizontalAlignment = "BEGIN";
656 case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter:
658 _horizontalAlignment = "CENTER";
661 case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd:
663 _horizontalAlignment = "END";
668 _horizontalAlignment = "BEGIN";
677 /// Get or set the line vertical alignment.<br>
678 /// If not specified, the default is TOP.<br>
680 public Tizen.NUI.Constants.VerticalAlignment VerticalAlignment
684 switch (_verticalAlignment)
687 return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop;
689 return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter;
691 return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom;
693 return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom;
700 case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop:
702 _verticalAlignment = "TOP";
705 case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter:
707 _verticalAlignment = "CENTER";
710 case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom:
712 _verticalAlignment = "BOTTOM";
717 _verticalAlignment = "TOP";
726 /// Get or set the color of the text.
728 public Color TextColor
742 /// Get or set whether the mark-up processing is enabled.
744 public bool EnableMarkup
748 return _enableMarkup ?? false;
752 _enableMarkup = value;
757 protected override void ComposingPropertyMap()
759 _outputVisualMap = new PropertyMap();
760 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
761 if (_text != null) { _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text)); }
762 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
763 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
764 if (_pointSize != null) { _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize)); }
765 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
766 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
767 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
768 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
769 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
770 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
771 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
772 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
773 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
778 /// A class encapsulating the property map of a border visual.
780 public class BorderVisual : VisualMap
782 public BorderVisual() : base()
786 private Color _color = null;
787 private float? _size = null;
788 private bool? _antiAliasing = null;
791 /// Get or set the color of the border.
807 /// Get or set the width of the border (in pixels).
809 public float BorderSize
813 return _size ?? (-1.0f);
823 /// Get or set whether anti-aliasing of the border is required.<br>
824 /// If not supplied, default is false.<br>
826 public bool AntiAliasing
830 return _antiAliasing ?? false;
834 _antiAliasing = value;
839 protected override void ComposingPropertyMap()
841 _outputVisualMap = new PropertyMap();
842 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
843 if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); }
844 if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); }
845 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
846 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
847 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
848 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
849 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
854 /// A class encapsulating the property map of a color visual.
856 public class ColorVisual : VisualMap
858 public ColorVisual() : base()
862 private Color _mixColorForColorVisual = null;
865 /// Get or set the solid color required.
871 return _mixColorForColorVisual;
875 _mixColorForColorVisual = value;
880 protected override void ComposingPropertyMap()
882 _outputVisualMap = new PropertyMap();
883 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
884 if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); }
885 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
886 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
887 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
892 /// A class encapsulating the property map of a gradient visual.
894 public class GradientVisual : VisualMap
896 public GradientVisual() : base()
900 private Vector2 _startPosition = null;
901 private Vector2 _endPosition = null;
902 private Vector2 _center = null;
903 private float? _radius = null;
904 private PropertyArray _stopOffset = null;
905 private PropertyArray _stopColor = null;
906 private GradientVisualUnitsType? _units = null;
907 private GradientVisualSpreadMethodType? _spreadMethod = null;
910 /// Get or set the start position of a linear gradient.<br>
911 /// Mandatory for Linear.<br>
913 public Vector2 StartPosition
917 return _startPosition;
921 _startPosition = value;
927 /// Get or set the end position of a linear gradient.<br>
928 /// Mandatory for Linear.<br>
930 public Vector2 EndPosition
938 _endPosition = value;
944 /// Get or set the center point of a radial gradient.<br>
945 /// Mandatory for Radial.<br>
947 public Vector2 Center
961 /// Get or set the size of the radius of a radial gradient.<br>
962 /// Mandatory for Radial.<br>
968 return _radius ?? (-1.0f);
978 /// Get or set all the stop offsets.<br>
979 /// A PropertyArray of float.<br>
980 /// If not supplied, default is 0.0f and 1.0f.<br>
982 public PropertyArray StopOffset
996 /// Get or set the color at the stop offsets.<br>
997 /// A PropertyArray of Color.<br>
998 /// At least 2 values required to show a gradient.<br>
1000 public PropertyArray StopColor
1014 /// Get or set defines the coordinate system for certain attributes of the points in a gradient.<br>
1015 /// If not supplied, default is GradientVisualUnitsType.OBJECT_BOUNDING_BOX.<br>
1017 public GradientVisualUnitsType Units
1021 return _units ?? (GradientVisualUnitsType)(-1);
1031 /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1032 /// If not supplied, default is GradientVisualSpreadMethodType.PAD.<br>
1034 public GradientVisualSpreadMethodType SpreadMethod
1038 return _spreadMethod ?? (GradientVisualSpreadMethodType)(-1);
1042 _spreadMethod = value;
1047 protected override void ComposingPropertyMap()
1049 _outputVisualMap = new PropertyMap();
1050 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
1051 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
1052 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
1053 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
1054 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
1055 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
1056 if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); }
1057 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
1058 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
1059 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1060 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1061 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1062 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1067 /// A class encapsulating the property map of a mesh visual.
1069 public class MeshVisual : VisualMap
1071 public MeshVisual() : base()
1075 private string _objectURL = null;
1076 private string _materialtURL = null;
1077 private string _texturesPath = null;
1078 private MeshVisualShadingModeValue? _shadingMode = null;
1079 private bool? _useMipmapping = null;
1080 private bool? _useSoftNormals = null;
1081 private Vector3 _lightPosition = null;
1084 /// Get or set the location of the ".obj" file.
1086 public string ObjectURL
1100 /// Get or set the location of the ".mtl" file.<br>
1101 /// If not specified, then a textureless object is assumed.<br>
1103 public string MaterialtURL
1107 return _materialtURL;
1111 _materialtURL = value;
1117 /// Get or set path to the directory the textures (including gloss and normal) are stored in.<br>
1118 /// Mandatory if using material.<br>
1120 public string TexturesPath
1124 return _texturesPath;
1128 _texturesPath = value;
1134 /// Get or set the type of shading mode that the mesh will use.<br>
1135 /// If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.<br>
1136 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).<br>
1138 public MeshVisualShadingModeValue ShadingMode
1142 return _shadingMode??(MeshVisualShadingModeValue)(-1);
1146 _shadingMode = value;
1152 /// Get or set whether to use mipmaps for textures or not.<br>
1153 /// If not specified, the default is true.<br>
1155 public bool UseMipmapping
1159 return _useMipmapping??false;
1163 _useMipmapping = value;
1169 /// Get or set whether to average normals at each point to smooth textures or not.<br>
1170 /// If not specified, the default is true.<br>
1172 public bool UseSoftNormals
1176 return _useSoftNormals??false;
1180 _useSoftNormals = value;
1186 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1187 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1188 /// and using all zeroes will place the light at the top left corner.<br>
1189 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1191 public Vector3 LightPosition
1195 return _lightPosition;
1199 _lightPosition = value;
1204 protected override void ComposingPropertyMap()
1206 _outputVisualMap = new PropertyMap();
1207 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1208 if (_objectURL != null) { _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL)); }
1209 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1210 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1211 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1212 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1213 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1214 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1215 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1216 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1217 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1223 /// A class encapsulating the property map of a primetive visual.
1225 public class PrimitiveVisual : VisualMap
1227 public PrimitiveVisual() : base()
1231 private PrimitiveVisualShapeType? _shape = null;
1232 private Color _mixColorForPrimitiveVisual = null;
1233 private int? _slices = null;
1234 private int? _stacks = null;
1235 private float? _scaleTopRadius = null;
1236 private float? _scaleBottomRadius = null;
1237 private float? _scaleHeight = null;
1238 private float? _scaleRadius = null;
1239 private Vector3 _scaleDimensions = null;
1240 private float? _bevelPercentage = null;
1241 private float? _bevelSmoothness = null;
1242 private Vector3 _lightPosition = null;
1245 /// Get or set the specific shape to render.<br>
1246 /// If not specified, the default is PrimitiveVisualShapeType.SPHERE.<br>
1248 public PrimitiveVisualShapeType Shape
1252 return _shape??(PrimitiveVisualShapeType)(-1);
1262 /// Get or set the color of the shape.<br>
1263 /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).<br>
1264 /// Applies to ALL shapes.<br>
1266 public Color MixColor
1270 return _mixColorForPrimitiveVisual;
1274 _mixColorForPrimitiveVisual = value;
1280 /// Get or set the number of slices as you go around the shape.<br>
1281 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1282 /// If not specified, the default is 128.<br>
1283 /// The range is from 1 to 255.<br>
1289 return _slices??(-1);
1299 /// Get or set the number of stacks as you go down the shape.<br>
1300 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1301 /// If not specified, the default is 128.<br>
1302 /// The range is from 1 to 255.<br>
1308 return _stacks??(-1);
1318 /// Get or set the scale of the radius of the top circle of a conical frustrum.<br>
1319 /// If not specified, the default is 1.0f.<br>
1320 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1321 /// Only values greater than or equal to 0.0f are accepted.<br>
1323 public float ScaleTopRadius
1327 return _scaleTopRadius ?? (-1.0f);
1331 _scaleTopRadius = value;
1337 /// Get or set the scale of the radius of the bottom circle of a conical frustrum.<br>
1338 /// If not specified, the default is 1.5f.<br>
1339 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1340 /// - PrimitiveVisualShapeType.CONE<br>
1341 /// Only values greater than or equal to 0.0f are accepted.<br>
1343 public float ScaleBottomRadius
1347 return _scaleBottomRadius ?? (-1.0f);
1351 _scaleBottomRadius = value;
1357 /// Get or set the scale of the height of a conic.<br>
1358 /// If not specified, the default is 3.0f.<br>
1360 /// - Shape::CONICAL_FRUSTRUM<br>
1361 /// - Shape::CONE<br>
1362 /// - Shape::CYLINDER<br>
1363 /// Only values greater than or equal to 0.0f are accepted.<br>
1365 public float ScaleHeight
1369 return _scaleHeight??(-1.0f);
1373 _scaleHeight = value;
1379 /// Get or set the scale of the radius of a cylinder.<br>
1380 /// If not specified, the default is 1.0f.<br>
1382 /// - Shape::CYLINDER<br>
1383 /// Only values greater than or equal to 0.0f are accepted.<br>
1385 public float ScaleRadius
1389 return _scaleRadius ?? (-1.0f);
1393 _scaleRadius = value;
1399 /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1400 /// If not specified, the default is Vector3.One.<br>
1402 /// - Shape::CUBE<br>
1403 /// - Shape::OCTAHEDRON<br>
1404 /// - Shape::BEVELLED_CUBE<br>
1405 /// Each vector3 parameter should be greater than or equal to 0.0f.<br>
1407 public Vector3 ScaleDimensions
1411 return _scaleDimensions;
1415 _scaleDimensions = value;
1421 /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1422 /// Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.<br>
1423 /// If not specified, the default is 0.0f (no bevel).<br>
1425 /// - Shape::BEVELLED_CUBE<br>
1426 /// The range is from 0.0f to 1.0f.<br>
1428 public float BevelPercentage
1432 return _bevelPercentage ?? (-1.0f);
1436 _bevelPercentage = value;
1442 /// Get or set defines how smooth the bevelled edges should be.<br>
1443 /// If not specified, the default is 0.0f (sharp edges).<br>
1445 /// - Shape::BEVELLED_CUBE<br>
1446 /// The range is from 0.0f to 1.0f.<br>
1448 public float BevelSmoothness
1452 return _bevelSmoothness ?? (-1.0f);
1456 _bevelSmoothness = value;
1462 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1463 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1464 /// and using all zeroes will place the light at the top left corner.<br>
1465 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1466 /// Applies to ALL shapes.
1468 public Vector3 LightPosition
1472 return _lightPosition;
1476 _lightPosition = value;
1481 protected override void ComposingPropertyMap()
1483 _outputVisualMap = new PropertyMap(); ;
1484 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1485 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1486 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1487 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1488 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1489 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1490 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1491 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1492 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1493 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1494 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1495 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1496 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1497 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1498 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1499 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1504 /// A class encapsulating the property map of a n-patch image visual.
1506 public class NPatchVisual : VisualMap
1508 public NPatchVisual() : base()
1512 private string _url = null;
1513 private bool? _borderOnly = null;
1514 private Rectangle _border = null;
1517 /// Get or set the URL of the image.
1533 /// Get or set whether to draws the borders only(If true).<br>
1534 /// If not specified, the default is false.<br>
1535 /// For N-Patch images only.<br>
1537 public bool BorderOnly
1541 return _borderOnly ?? false;
1545 _borderOnly = value;
1551 /// The border of the image in the order: left, right, bottom, top.
1553 public Rectangle Border
1566 protected override void ComposingPropertyMap()
1568 _outputVisualMap = new PropertyMap();
1569 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1570 if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); }
1571 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1572 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
1573 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1574 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1575 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1576 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1583 /// This specifies wrap mode types <br>
1584 /// WrapModeU and WrapModeV separately decide how the texture should be sampled when the u and v coordinate exceeds the range of 0.0 to 1.0.
1586 public enum WrapModeType
1607 /// The type of coordinate system for certain attributes of the points in a gradient.
1609 public enum GradientVisualUnitsType
1612 /// Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5).
1616 /// Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200).
1622 /// This specifies SpreadMethod types.<br>
1623 /// SpreadMethod defines what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1625 public enum GradientVisualSpreadMethodType
1628 /// Uses the terminal colors of the gradient to fill the remainder of the quad.
1632 /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled.
1636 /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled.
1642 /// The shading mode used by MeshVisual.
1644 public enum MeshVisualShadingModeValue
1647 /// *Simplest*. One color that is lit by ambient and diffuse lighting.
1649 TexturelessWithDiffuseLighting,
1651 /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting.
1653 TexturedWithSpecularLighting,
1655 /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting.
1657 TexturedWithDetailedSpecularLighting
1661 /// The primitive shape to render as a PrimitiveVisual.
1663 public enum PrimitiveVisualShapeType
1666 /// A perfectly round geometrical object in three-dimensional space.
1670 /// The area bound between two circles, i.e. a cone with the tip removed.
1674 /// Equivalent to a conical frustrum with top radius of zero.
1675 /// </summary>Equivalent to a conical frustrum with top radius of zero.
1678 /// Equivalent to a conical frustrum with top radius of zero.
1682 /// Equivalent to a conical frustrum with equal radii for the top and bottom circles.
1686 /// Equivalent to a bevelled cube with a bevel percentage of zero.
1690 /// Equivalent to a bevelled cube with a bevel percentage of one.
1696 /// This specifies fitting mode types. Fitting options, used when resizing images to fit desired dimensions.<br>
1697 /// A fitting mode controls the region of a loaded image to be mapped to the desired image rectangle.<br>
1698 /// All fitting modes preserve the aspect ratio of the image contents.<br>
1700 public enum FittingModeType
1703 /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode.
1707 /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode.
1711 /// Image columns: Limit loaded image resolution to column width using FitWidth mode.
1715 /// Image rows: Limit loaded image resolution to row height using FitHeight mode.
1721 /// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.<br>
1722 /// A SamplingMode controls how pixels in an input image are sampled and combined to generate each pixel of a destination image during a scaling.<br>
1723 /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,<br>
1724 /// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.<br>
1726 public enum SamplingModeType
1729 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size. <br>
1730 /// This is the default.
1734 /// For each output pixel, read one input pixel.
1738 /// For each output pixel, read a quad of four input pixels and write a weighted average of them.
1742 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size, <br>
1743 /// then for each output pixel, read one pixel from the last level of box filtering.<br>
1747 /// Iteratively box filter to almost the right size, then for each output pixel, read four pixels from the last level of box filtering and write their weighted average.
1751 /// No filtering is performed. If the SCALE_TO_FILL scaling mode is enabled, the borders of the image may be trimmed to match the aspect ratio of the desired dimensions.
1755 /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image.
1761 /// This specifies policy types that could be used by the transform for the offset or size.
1763 public enum VisualTransformPolicyType
1766 /// Relative to the control (percentage [0.0f to 1.0f] of the control).
1770 /// Absolute value in world units.
1776 /// This specifies all the transform property types.
1778 public enum VisualTransformPropertyType
1781 /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1785 /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1789 /// The origin of the visual within its control area.
1793 /// The anchor-point of the visual
1797 /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1801 /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1807 /// This specifies visual types.
1809 public struct Visual
1812 /// The index for the visual type.
1817 /// Renders a solid color as an internal border to the control's quad.
1821 /// Renders a solid color to the control's quad.
1825 /// Renders a smooth transition of colors to the control's quad.
1829 /// Renders an image into the control's quad.
1833 /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file.
1837 /// Renders a simple 3D shape, such as a cube or sphere.
1841 /// Renders a simple wire-frame outlining a quad.
1849 /// Renders an n-patch image.
1853 /// Renders an SVG image.
1857 /// Renders a animated image. (Animated GIF)
1863 /// This specifies visual properties.
1865 public struct Property
1867 public static readonly int Type = NDalic.VISUAL_PROPERTY_TYPE;
1868 public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER;
1869 public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
1870 public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
1871 public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
1872 public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1;
1876 /// This specifies shader properties.
1878 public struct ShaderProperty
1880 public static readonly int VertexShader = NDalic.VISUAL_SHADER_VERTEX;
1881 public static readonly int FragmentShader = NDalic.VISUAL_SHADER_FRAGMENT;
1882 public static readonly int ShaderSubdivideGridX = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_X;
1883 public static readonly int ShaderSubdivideGridY = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_Y;
1884 public static readonly int ShaderHints = NDalic.VISUAL_SHADER_HINTS;
1888 /// This specifies Visaul align types.
1890 public enum AlignType
1905 /// This specifies properties of BorderVisual.
1907 public struct BorderVisualProperty
1909 public static readonly int Color = NDalic.BORDER_VISUAL_COLOR;
1910 public static readonly int Size = NDalic.BORDER_VISUAL_SIZE;
1911 public static readonly int AntiAliasing = NDalic.BORDER_VISUAL_ANTI_ALIASING;
1915 /// This specifies properties of ColorVisual.
1917 public struct ColorVisualProperty
1919 public static readonly int MixColor = NDalic.COLOR_VISUAL_MIX_COLOR;
1923 /// This specifies properties of GradientVisual.
1925 public struct GradientVisualProperty
1927 public static readonly int StartPosition = NDalic.GRADIENT_VISUAL_START_POSITION;
1928 public static readonly int EndPosition = NDalic.GRADIENT_VISUAL_END_POSITION;
1929 public static readonly int Center = NDalic.GRADIENT_VISUAL_CENTER;
1930 public static readonly int Radius = NDalic.GRADIENT_VISUAL_RADIUS;
1931 public static readonly int StopOffset = NDalic.GRADIENT_VISUAL_STOP_OFFSET;
1932 public static readonly int StopColor = NDalic.GRADIENT_VISUAL_STOP_COLOR;
1933 public static readonly int Units = NDalic.GRADIENT_VISUAL_UNITS;
1934 public static readonly int SpreadMethod = NDalic.GRADIENT_VISUAL_SPREAD_METHOD;
1938 /// This specifies properties of ImageVisual.
1940 public struct ImageVisualProperty
1942 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
1943 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
1944 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
1945 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
1946 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
1947 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
1948 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
1949 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
1950 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
1951 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
1952 public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
1956 /// This specifies properties of MeshVisual.
1958 public struct MeshVisualProperty
1960 public static readonly int ObjectURL = NDalic.MESH_VISUAL_OBJECT_URL;
1961 public static readonly int MaterialtURL = NDalic.MESH_VISUAL_MATERIAL_URL;
1962 public static readonly int TexturesPath = NDalic.MESH_VISUAL_TEXTURES_PATH;
1963 public static readonly int ShadingMode = NDalic.MESH_VISUAL_SHADING_MODE;
1964 public static readonly int UseMipmapping = NDalic.MESH_VISUAL_USE_MIPMAPPING;
1965 public static readonly int UseSoftNormals = NDalic.MESH_VISUAL_USE_SOFT_NORMALS;
1966 public static readonly int LightPosition = NDalic.MESH_VISUAL_LIGHT_POSITION;
1970 /// This specifies properties of PrimitiveVisual.
1972 public struct PrimitiveVisualProperty
1974 public static readonly int Shape = NDalic.PRIMITIVE_VISUAL_SHAPE;
1975 public static readonly int MixColor = NDalic.PRIMITIVE_VISUAL_MIX_COLOR;
1976 public static readonly int Slices = NDalic.PRIMITIVE_VISUAL_SLICES;
1977 public static readonly int Stacks = NDalic.PRIMITIVE_VISUAL_STACKS;
1978 public static readonly int ScaleTopRadius = NDalic.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS;
1979 public static readonly int ScaleBottomRadius = NDalic.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS;
1980 public static readonly int ScaleHeight = NDalic.PRIMITIVE_VISUAL_SCALE_HEIGHT;
1981 public static readonly int ScaleRadius = NDalic.PRIMITIVE_VISUAL_SCALE_RADIUS;
1982 public static readonly int ScaleDimensions = NDalic.PRIMITIVE_VISUAL_SCALE_DIMENSIONS;
1983 public static readonly int BevelPercentage = NDalic.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE;
1984 public static readonly int BevelSmoothness = NDalic.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS;
1985 public static readonly int LightPosition = NDalic.PRIMITIVE_VISUAL_LIGHT_POSITION;
1989 /// This specifies properties of TextVisual.
1991 public struct TextVisualProperty
1993 public static readonly int Text = NDalic.TEXT_VISUAL_TEXT;
1994 public static readonly int FontFamily = NDalic.TEXT_VISUAL_FONT_FAMILY;
1995 public static readonly int FontStyle = NDalic.TEXT_VISUAL_FONT_STYLE;
1996 public static readonly int PointSize = NDalic.TEXT_VISUAL_POINT_SIZE;
1997 public static readonly int MultiLine = NDalic.TEXT_VISUAL_MULTI_LINE;
1998 public static readonly int HorizontalAlignment = NDalic.TEXT_VISUAL_HORIZONTAL_ALIGNMENT;
1999 public static readonly int VerticalAlignment = NDalic.TEXT_VISUAL_VERTICAL_ALIGNMENT;
2000 public static readonly int TextColor = NDalic.TEXT_VISUAL_TEXT_COLOR;
2001 public static readonly int EnableMarkup = NDalic.TEXT_VISUAL_ENABLE_MARKUP;
2005 /// This specifies properties of NpatchImageVisual.
2007 public struct NpatchImageVisualProperty
2009 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
2010 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
2011 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
2012 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
2013 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
2014 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
2015 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
2016 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
2017 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
2018 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
2019 public static readonly int Border = NDalic.IMAGE_VISUAL_WRAP_MODE_V + 1;
2023 /// A class encapsulating the property map of a SVG visual.
2025 public class SVGVisual : VisualMap
2027 public SVGVisual() : base()
2031 private string _url = null;
2046 protected override void ComposingPropertyMap()
2048 _outputVisualMap = new PropertyMap();
2049 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
2050 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2051 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2052 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2053 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2054 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2059 /// A class encapsulating the property map of a Animated Image(AGIF) visual.
2061 public class AnimatedImageVisual : VisualMap
2063 public AnimatedImageVisual() : base()
2067 private string _url = null;
2082 protected override void ComposingPropertyMap()
2084 _outputVisualMap = new PropertyMap();
2085 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2086 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2087 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2088 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2089 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2090 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2095 /// A class encapsulating the property map of a visual transition(Animator).
2097 public class AnimatorVisual : VisualMap
2099 public AnimatorVisual() : base()
2103 private string _alphaFunction = null;
2104 private int _startTime = 0;
2105 private int _endTime = 0;
2106 private string _target = null;
2107 private string _propertyIndex = null;
2108 private object _destinationValue = null;
2110 public string AlphaFunction
2114 return _alphaFunction;
2118 _alphaFunction = value;
2122 public int StartTime
2146 public string Target
2158 public string PropertyIndex
2162 return _propertyIndex;
2166 _propertyIndex = value;
2170 public object DestinationValue
2174 return _destinationValue;
2178 _destinationValue = value;
2182 protected override void ComposingPropertyMap()
2184 PropertyMap _animator = new PropertyMap();
2185 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2187 PropertyMap _timePeriod = new PropertyMap();
2188 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2189 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2190 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2192 string _str1 = _propertyIndex.Substring(0, 1);
2193 string _str2 = _propertyIndex.Substring(1);
2194 string _str = _str1.ToLower() + _str2;
2196 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2198 PropertyMap _transition = new PropertyMap();
2199 _transition.Add("target", new PropertyValue(_target));
2200 _transition.Add("property", new PropertyValue(_str));
2201 _transition.Add("targetValue", val);
2202 _transition.Add("animator", new PropertyValue(_animator));
2204 _outputVisualMap = _transition;