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 string HorizontalAlignment
635 return _horizontalAlignment;
639 _horizontalAlignment = value;
645 /// Get or set the line vertical alignment.<br>
646 /// If not specified, the default is TOP.<br>
648 public string VerticalAlignment
652 return _verticalAlignment;
656 _verticalAlignment = value;
662 /// Get or set the color of the text.
664 public Color TextColor
678 /// Get or set whether the mark-up processing is enabled.
680 public bool EnableMarkup
684 return _enableMarkup ?? false;
688 _enableMarkup = value;
693 protected override void ComposingPropertyMap()
695 _outputVisualMap = new PropertyMap();
696 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text));
697 if (_text != null) { _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text)); }
698 if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); }
699 if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); }
700 if (_pointSize != null) { _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize)); }
701 if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); }
702 if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); }
703 if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
704 if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
705 if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
706 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
707 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
708 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
709 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
714 /// A class encapsulating the property map of a border visual.
716 public class BorderVisual : VisualMap
718 public BorderVisual() : base()
722 private Color _color = null;
723 private float? _size = null;
724 private bool? _antiAliasing = null;
727 /// Get or set the color of the border.
743 /// Get or set the width of the border (in pixels).
745 public float BorderSize
749 return _size ?? (-1.0f);
759 /// Get or set whether anti-aliasing of the border is required.<br>
760 /// If not supplied, default is false.<br>
762 public bool AntiAliasing
766 return _antiAliasing ?? false;
770 _antiAliasing = value;
775 protected override void ComposingPropertyMap()
777 _outputVisualMap = new PropertyMap();
778 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
779 if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); }
780 if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); }
781 if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
782 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
783 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
784 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
785 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
790 /// A class encapsulating the property map of a color visual.
792 public class ColorVisual : VisualMap
794 public ColorVisual() : base()
798 private Color _mixColorForColorVisual = null;
801 /// Get or set the solid color required.
807 return _mixColorForColorVisual;
811 _mixColorForColorVisual = value;
816 protected override void ComposingPropertyMap()
818 _outputVisualMap = new PropertyMap();
819 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
820 if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); }
821 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
822 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
823 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
828 /// A class encapsulating the property map of a gradient visual.
830 public class GradientVisual : VisualMap
832 public GradientVisual() : base()
836 private Vector2 _startPosition = null;
837 private Vector2 _endPosition = null;
838 private Vector2 _center = null;
839 private float? _radius = null;
840 private PropertyArray _stopOffset = null;
841 private PropertyArray _stopColor = null;
842 private GradientVisualUnitsType? _units = null;
843 private GradientVisualSpreadMethodType? _spreadMethod = null;
846 /// Get or set the start position of a linear gradient.<br>
847 /// Mandatory for Linear.<br>
849 public Vector2 StartPosition
853 return _startPosition;
857 _startPosition = value;
863 /// Get or set the end position of a linear gradient.<br>
864 /// Mandatory for Linear.<br>
866 public Vector2 EndPosition
874 _endPosition = value;
880 /// Get or set the center point of a radial gradient.<br>
881 /// Mandatory for Radial.<br>
883 public Vector2 Center
897 /// Get or set the size of the radius of a radial gradient.<br>
898 /// Mandatory for Radial.<br>
904 return _radius ?? (-1.0f);
914 /// Get or set all the stop offsets.<br>
915 /// A PropertyArray of float.<br>
916 /// If not supplied, default is 0.0f and 1.0f.<br>
918 public PropertyArray StopOffset
932 /// Get or set the color at the stop offsets.<br>
933 /// A PropertyArray of Color.<br>
934 /// At least 2 values required to show a gradient.<br>
936 public PropertyArray StopColor
950 /// Get or set defines the coordinate system for certain attributes of the points in a gradient.<br>
951 /// If not supplied, default is GradientVisualUnitsType.OBJECT_BOUNDING_BOX.<br>
953 public GradientVisualUnitsType Units
957 return _units ?? (GradientVisualUnitsType)(-1);
967 /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
968 /// If not supplied, default is GradientVisualSpreadMethodType.PAD.<br>
970 public GradientVisualSpreadMethodType SpreadMethod
974 return _spreadMethod ?? (GradientVisualSpreadMethodType)(-1);
978 _spreadMethod = value;
983 protected override void ComposingPropertyMap()
985 _outputVisualMap = new PropertyMap();
986 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
987 if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
988 if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
989 if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
990 if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
991 if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
992 if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); }
993 if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
994 if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
995 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
996 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
997 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
998 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1003 /// A class encapsulating the property map of a mesh visual.
1005 public class MeshVisual : VisualMap
1007 public MeshVisual() : base()
1011 private string _objectURL = null;
1012 private string _materialtURL = null;
1013 private string _texturesPath = null;
1014 private MeshVisualShadingModeValue? _shadingMode = null;
1015 private bool? _useMipmapping = null;
1016 private bool? _useSoftNormals = null;
1017 private Vector3 _lightPosition = null;
1020 /// Get or set the location of the ".obj" file.
1022 public string ObjectURL
1036 /// Get or set the location of the ".mtl" file.<br>
1037 /// If not specified, then a textureless object is assumed.<br>
1039 public string MaterialtURL
1043 return _materialtURL;
1047 _materialtURL = value;
1053 /// Get or set path to the directory the textures (including gloss and normal) are stored in.<br>
1054 /// Mandatory if using material.<br>
1056 public string TexturesPath
1060 return _texturesPath;
1064 _texturesPath = value;
1070 /// Get or set the type of shading mode that the mesh will use.<br>
1071 /// 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>
1072 /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).<br>
1074 public MeshVisualShadingModeValue ShadingMode
1078 return _shadingMode??(MeshVisualShadingModeValue)(-1);
1082 _shadingMode = value;
1088 /// Get or set whether to use mipmaps for textures or not.<br>
1089 /// If not specified, the default is true.<br>
1091 public bool UseMipmapping
1095 return _useMipmapping??false;
1099 _useMipmapping = value;
1105 /// Get or set whether to average normals at each point to smooth textures or not.<br>
1106 /// If not specified, the default is true.<br>
1108 public bool UseSoftNormals
1112 return _useSoftNormals??false;
1116 _useSoftNormals = value;
1122 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1123 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1124 /// and using all zeroes will place the light at the top left corner.<br>
1125 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1127 public Vector3 LightPosition
1131 return _lightPosition;
1135 _lightPosition = value;
1140 protected override void ComposingPropertyMap()
1142 _outputVisualMap = new PropertyMap();
1143 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh));
1144 if (_objectURL != null) { _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL)); }
1145 if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); }
1146 if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); }
1147 if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
1148 if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
1149 if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
1150 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1151 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1152 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1153 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1159 /// A class encapsulating the property map of a primetive visual.
1161 public class PrimitiveVisual : VisualMap
1163 public PrimitiveVisual() : base()
1167 private PrimitiveVisualShapeType? _shape = null;
1168 private Color _mixColorForPrimitiveVisual = null;
1169 private int? _slices = null;
1170 private int? _stacks = null;
1171 private float? _scaleTopRadius = null;
1172 private float? _scaleBottomRadius = null;
1173 private float? _scaleHeight = null;
1174 private float? _scaleRadius = null;
1175 private Vector3 _scaleDimensions = null;
1176 private float? _bevelPercentage = null;
1177 private float? _bevelSmoothness = null;
1178 private Vector3 _lightPosition = null;
1181 /// Get or set the specific shape to render.<br>
1182 /// If not specified, the default is PrimitiveVisualShapeType.SPHERE.<br>
1184 public PrimitiveVisualShapeType Shape
1188 return _shape??(PrimitiveVisualShapeType)(-1);
1198 /// Get or set the color of the shape.<br>
1199 /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).<br>
1200 /// Applies to ALL shapes.<br>
1202 public Color MixColor
1206 return _mixColorForPrimitiveVisual;
1210 _mixColorForPrimitiveVisual = value;
1216 /// Get or set the number of slices as you go around the shape.<br>
1217 /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.<br>
1218 /// If not specified, the default is 128.<br>
1219 /// The range is from 1 to 255.<br>
1225 return _slices??(-1);
1235 /// Get or set the number of stacks as you go down the shape.<br>
1236 /// For spheres, 'stacks' determines how many layers there are as you go down the object.<br>
1237 /// If not specified, the default is 128.<br>
1238 /// The range is from 1 to 255.<br>
1244 return _stacks??(-1);
1254 /// Get or set the scale of the radius of the top circle of a conical frustrum.<br>
1255 /// If not specified, the default is 1.0f.<br>
1256 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1257 /// Only values greater than or equal to 0.0f are accepted.<br>
1259 public float ScaleTopRadius
1263 return _scaleTopRadius ?? (-1.0f);
1267 _scaleTopRadius = value;
1273 /// Get or set the scale of the radius of the bottom circle of a conical frustrum.<br>
1274 /// If not specified, the default is 1.5f.<br>
1275 /// Applies to: - PrimitiveVisualShapeType.CONICAL_FRUSTRUM<br>
1276 /// - PrimitiveVisualShapeType.CONE<br>
1277 /// Only values greater than or equal to 0.0f are accepted.<br>
1279 public float ScaleBottomRadius
1283 return _scaleBottomRadius ?? (-1.0f);
1287 _scaleBottomRadius = value;
1293 /// Get or set the scale of the height of a conic.<br>
1294 /// If not specified, the default is 3.0f.<br>
1296 /// - Shape::CONICAL_FRUSTRUM<br>
1297 /// - Shape::CONE<br>
1298 /// - Shape::CYLINDER<br>
1299 /// Only values greater than or equal to 0.0f are accepted.<br>
1301 public float ScaleHeight
1305 return _scaleHeight??(-1.0f);
1309 _scaleHeight = value;
1315 /// Get or set the scale of the radius of a cylinder.<br>
1316 /// If not specified, the default is 1.0f.<br>
1318 /// - Shape::CYLINDER<br>
1319 /// Only values greater than or equal to 0.0f are accepted.<br>
1321 public float ScaleRadius
1325 return _scaleRadius ?? (-1.0f);
1329 _scaleRadius = value;
1335 /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.<br>
1336 /// If not specified, the default is Vector3.One.<br>
1338 /// - Shape::CUBE<br>
1339 /// - Shape::OCTAHEDRON<br>
1340 /// - Shape::BEVELLED_CUBE<br>
1341 /// Each vector3 parameter should be greater than or equal to 0.0f.<br>
1343 public Vector3 ScaleDimensions
1347 return _scaleDimensions;
1351 _scaleDimensions = value;
1357 /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.<br>
1358 /// 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>
1359 /// If not specified, the default is 0.0f (no bevel).<br>
1361 /// - Shape::BEVELLED_CUBE<br>
1362 /// The range is from 0.0f to 1.0f.<br>
1364 public float BevelPercentage
1368 return _bevelPercentage ?? (-1.0f);
1372 _bevelPercentage = value;
1378 /// Get or set defines how smooth the bevelled edges should be.<br>
1379 /// If not specified, the default is 0.0f (sharp edges).<br>
1381 /// - Shape::BEVELLED_CUBE<br>
1382 /// The range is from 0.0f to 1.0f.<br>
1384 public float BevelSmoothness
1388 return _bevelSmoothness ?? (-1.0f);
1392 _bevelSmoothness = value;
1398 /// Get or set the position, in stage space, of the point light that applies lighting to the model.<br>
1399 /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
1400 /// and using all zeroes will place the light at the top left corner.<br>
1401 /// If not specified, the default is an offset outwards from the center of the screen.<br>
1402 /// Applies to ALL shapes.
1404 public Vector3 LightPosition
1408 return _lightPosition;
1412 _lightPosition = value;
1417 protected override void ComposingPropertyMap()
1419 _outputVisualMap = new PropertyMap(); ;
1420 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
1421 if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
1422 if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
1423 if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
1424 if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
1425 if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
1426 if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); }
1427 if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); }
1428 if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); }
1429 if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); }
1430 if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
1431 if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
1432 if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
1433 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1434 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1435 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1440 /// A class encapsulating the property map of a n-patch image visual.
1442 public class NPatchVisual : VisualMap
1444 public NPatchVisual() : base()
1448 private string _url = null;
1449 private bool? _borderOnly = null;
1450 private Rectangle _border = null;
1453 /// Get or set the URL of the image.
1469 /// Get or set whether to draws the borders only(If true).<br>
1470 /// If not specified, the default is false.<br>
1471 /// For N-Patch images only.<br>
1473 public bool BorderOnly
1477 return _borderOnly ?? false;
1481 _borderOnly = value;
1487 /// The border of the image in the order: left, right, bottom, top.
1489 public Rectangle Border
1502 protected override void ComposingPropertyMap()
1504 _outputVisualMap = new PropertyMap();
1505 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
1506 if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); }
1507 if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
1508 if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
1509 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1510 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1511 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1512 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1519 /// This specifies wrap mode types <br>
1520 /// 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.
1522 public enum WrapModeType
1543 /// The type of coordinate system for certain attributes of the points in a gradient.
1545 public enum GradientVisualUnitsType
1548 /// 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).
1552 /// 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).
1558 /// This specifies SpreadMethod types.<br>
1559 /// SpreadMethod defines what happens if the gradient starts or ends inside the bounds of the target rectangle.<br>
1561 public enum GradientVisualSpreadMethodType
1564 /// Uses the terminal colors of the gradient to fill the remainder of the quad.
1568 /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled.
1572 /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled.
1578 /// The shading mode used by MeshVisual.
1580 public enum MeshVisualShadingModeValue
1583 /// *Simplest*. One color that is lit by ambient and diffuse lighting.
1585 TexturelessWithDiffuseLighting,
1587 /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting.
1589 TexturedWithSpecularLighting,
1591 /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting.
1593 TexturedWithDetailedSpecularLighting
1597 /// The primitive shape to render as a PrimitiveVisual.
1599 public enum PrimitiveVisualShapeType
1602 /// A perfectly round geometrical object in three-dimensional space.
1606 /// The area bound between two circles, i.e. a cone with the tip removed.
1610 /// Equivalent to a conical frustrum with top radius of zero.
1611 /// </summary>Equivalent to a conical frustrum with top radius of zero.
1614 /// Equivalent to a conical frustrum with top radius of zero.
1618 /// Equivalent to a conical frustrum with equal radii for the top and bottom circles.
1622 /// Equivalent to a bevelled cube with a bevel percentage of zero.
1626 /// Equivalent to a bevelled cube with a bevel percentage of one.
1632 /// This specifies fitting mode types. Fitting options, used when resizing images to fit desired dimensions.<br>
1633 /// A fitting mode controls the region of a loaded image to be mapped to the desired image rectangle.<br>
1634 /// All fitting modes preserve the aspect ratio of the image contents.<br>
1636 public enum FittingModeType
1639 /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode.
1643 /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode.
1647 /// Image columns: Limit loaded image resolution to column width using FitWidth mode.
1651 /// Image rows: Limit loaded image resolution to row height using FitHeight mode.
1657 /// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.<br>
1658 /// 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>
1659 /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,<br>
1660 /// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.<br>
1662 public enum SamplingModeType
1665 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size. <br>
1666 /// This is the default.
1670 /// For each output pixel, read one input pixel.
1674 /// For each output pixel, read a quad of four input pixels and write a weighted average of them.
1678 /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size, <br>
1679 /// then for each output pixel, read one pixel from the last level of box filtering.<br>
1683 /// 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.
1687 /// 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.
1691 /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image.
1697 /// This specifies policy types that could be used by the transform for the offset or size.
1699 public enum VisualTransformPolicyType
1702 /// Relative to the control (percentage [0.0f to 1.0f] of the control).
1706 /// Absolute value in world units.
1712 /// This specifies all the transform property types.
1714 public enum VisualTransformPropertyType
1717 /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1721 /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
1725 /// The origin of the visual within its control area.
1729 /// The anchor-point of the visual
1733 /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1737 /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
1743 /// This specifies visual types.
1745 public struct Visual
1748 /// The index for the visual type.
1753 /// Renders a solid color as an internal border to the control's quad.
1757 /// Renders a solid color to the control's quad.
1761 /// Renders a smooth transition of colors to the control's quad.
1765 /// Renders an image into the control's quad.
1769 /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file.
1773 /// Renders a simple 3D shape, such as a cube or sphere.
1777 /// Renders a simple wire-frame outlining a quad.
1785 /// Renders an n-patch image.
1789 /// Renders an SVG image.
1793 /// Renders a animated image. (Animated GIF)
1799 /// This specifies visual properties.
1801 public struct Property
1803 public static readonly int Type = NDalic.VISUAL_PROPERTY_TYPE;
1804 public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER;
1805 public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
1806 public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
1807 public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
1808 public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1;
1812 /// This specifies shader properties.
1814 public struct ShaderProperty
1816 public static readonly int VertexShader = NDalic.VISUAL_SHADER_VERTEX;
1817 public static readonly int FragmentShader = NDalic.VISUAL_SHADER_FRAGMENT;
1818 public static readonly int ShaderSubdivideGridX = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_X;
1819 public static readonly int ShaderSubdivideGridY = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_Y;
1820 public static readonly int ShaderHints = NDalic.VISUAL_SHADER_HINTS;
1824 /// This specifies Visaul align types.
1826 public enum AlignType
1841 /// This specifies properties of BorderVisual.
1843 public struct BorderVisualProperty
1845 public static readonly int Color = NDalic.BORDER_VISUAL_COLOR;
1846 public static readonly int Size = NDalic.BORDER_VISUAL_SIZE;
1847 public static readonly int AntiAliasing = NDalic.BORDER_VISUAL_ANTI_ALIASING;
1851 /// This specifies properties of ColorVisual.
1853 public struct ColorVisualProperty
1855 public static readonly int MixColor = NDalic.COLOR_VISUAL_MIX_COLOR;
1859 /// This specifies properties of GradientVisual.
1861 public struct GradientVisualProperty
1863 public static readonly int StartPosition = NDalic.GRADIENT_VISUAL_START_POSITION;
1864 public static readonly int EndPosition = NDalic.GRADIENT_VISUAL_END_POSITION;
1865 public static readonly int Center = NDalic.GRADIENT_VISUAL_CENTER;
1866 public static readonly int Radius = NDalic.GRADIENT_VISUAL_RADIUS;
1867 public static readonly int StopOffset = NDalic.GRADIENT_VISUAL_STOP_OFFSET;
1868 public static readonly int StopColor = NDalic.GRADIENT_VISUAL_STOP_COLOR;
1869 public static readonly int Units = NDalic.GRADIENT_VISUAL_UNITS;
1870 public static readonly int SpreadMethod = NDalic.GRADIENT_VISUAL_SPREAD_METHOD;
1874 /// This specifies properties of ImageVisual.
1876 public struct ImageVisualProperty
1878 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
1879 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
1880 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
1881 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
1882 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
1883 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
1884 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
1885 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
1886 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
1887 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
1888 public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER;
1892 /// This specifies properties of MeshVisual.
1894 public struct MeshVisualProperty
1896 public static readonly int ObjectURL = NDalic.MESH_VISUAL_OBJECT_URL;
1897 public static readonly int MaterialtURL = NDalic.MESH_VISUAL_MATERIAL_URL;
1898 public static readonly int TexturesPath = NDalic.MESH_VISUAL_TEXTURES_PATH;
1899 public static readonly int ShadingMode = NDalic.MESH_VISUAL_SHADING_MODE;
1900 public static readonly int UseMipmapping = NDalic.MESH_VISUAL_USE_MIPMAPPING;
1901 public static readonly int UseSoftNormals = NDalic.MESH_VISUAL_USE_SOFT_NORMALS;
1902 public static readonly int LightPosition = NDalic.MESH_VISUAL_LIGHT_POSITION;
1906 /// This specifies properties of PrimitiveVisual.
1908 public struct PrimitiveVisualProperty
1910 public static readonly int Shape = NDalic.PRIMITIVE_VISUAL_SHAPE;
1911 public static readonly int MixColor = NDalic.PRIMITIVE_VISUAL_MIX_COLOR;
1912 public static readonly int Slices = NDalic.PRIMITIVE_VISUAL_SLICES;
1913 public static readonly int Stacks = NDalic.PRIMITIVE_VISUAL_STACKS;
1914 public static readonly int ScaleTopRadius = NDalic.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS;
1915 public static readonly int ScaleBottomRadius = NDalic.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS;
1916 public static readonly int ScaleHeight = NDalic.PRIMITIVE_VISUAL_SCALE_HEIGHT;
1917 public static readonly int ScaleRadius = NDalic.PRIMITIVE_VISUAL_SCALE_RADIUS;
1918 public static readonly int ScaleDimensions = NDalic.PRIMITIVE_VISUAL_SCALE_DIMENSIONS;
1919 public static readonly int BevelPercentage = NDalic.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE;
1920 public static readonly int BevelSmoothness = NDalic.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS;
1921 public static readonly int LightPosition = NDalic.PRIMITIVE_VISUAL_LIGHT_POSITION;
1925 /// This specifies properties of TextVisual.
1927 public struct TextVisualProperty
1929 public static readonly int Text = NDalic.TEXT_VISUAL_TEXT;
1930 public static readonly int FontFamily = NDalic.TEXT_VISUAL_FONT_FAMILY;
1931 public static readonly int FontStyle = NDalic.TEXT_VISUAL_FONT_STYLE;
1932 public static readonly int PointSize = NDalic.TEXT_VISUAL_POINT_SIZE;
1933 public static readonly int MultiLine = NDalic.TEXT_VISUAL_MULTI_LINE;
1934 public static readonly int HorizontalAlignment = NDalic.TEXT_VISUAL_HORIZONTAL_ALIGNMENT;
1935 public static readonly int VerticalAlignment = NDalic.TEXT_VISUAL_VERTICAL_ALIGNMENT;
1936 public static readonly int TextColor = NDalic.TEXT_VISUAL_TEXT_COLOR;
1937 public static readonly int EnableMarkup = NDalic.TEXT_VISUAL_ENABLE_MARKUP;
1941 /// This specifies properties of NpatchImageVisual.
1943 public struct NpatchImageVisualProperty
1945 public static readonly int URL = NDalic.IMAGE_VISUAL_URL;
1946 public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE;
1947 public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE;
1948 public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH;
1949 public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
1950 public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
1951 public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
1952 public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
1953 public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
1954 public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
1955 public static readonly int Border = NDalic.IMAGE_VISUAL_WRAP_MODE_V + 1;
1959 /// A class encapsulating the property map of a SVG visual.
1961 public class SVGVisual : VisualMap
1963 public SVGVisual() : base()
1967 private string _url = null;
1982 protected override void ComposingPropertyMap()
1984 _outputVisualMap = new PropertyMap();
1985 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
1986 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
1987 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
1988 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
1989 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
1990 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
1995 /// A class encapsulating the property map of a Animated Image(AGIF) visual.
1997 public class AnimatedImageVisual : VisualMap
1999 public AnimatedImageVisual() : base()
2003 private string _url = null;
2018 protected override void ComposingPropertyMap()
2020 _outputVisualMap = new PropertyMap();
2021 _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
2022 if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
2023 if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
2024 if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
2025 if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
2026 if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
2031 /// A class encapsulating the property map of a visual transition(Animator).
2033 public class AnimatorVisual : VisualMap
2035 public AnimatorVisual() : base()
2039 private string _alphaFunction = null;
2040 private int _startTime = 0;
2041 private int _endTime = 0;
2042 private string _target = null;
2043 private string _propertyIndex = null;
2044 private object _destinationValue = null;
2046 public string AlphaFunction
2050 return _alphaFunction;
2054 _alphaFunction = value;
2058 public int StartTime
2082 public string Target
2094 public string PropertyIndex
2098 return _propertyIndex;
2102 _propertyIndex = value;
2106 public object DestinationValue
2110 return _destinationValue;
2114 _destinationValue = value;
2118 protected override void ComposingPropertyMap()
2120 PropertyMap _animator = new PropertyMap();
2121 _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
2123 PropertyMap _timePeriod = new PropertyMap();
2124 _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
2125 _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
2126 _animator.Add("timePeriod", new PropertyValue(_timePeriod));
2128 string _str1 = _propertyIndex.Substring(0, 1);
2129 string _str2 = _propertyIndex.Substring(1);
2130 string _str = _str1.ToLower() + _str2;
2132 PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
2134 PropertyMap _transition = new PropertyMap();
2135 _transition.Add("target", new PropertyValue(_target));
2136 _transition.Add("property", new PropertyValue(_str));
2137 _transition.Add("targetValue", val);
2138 _transition.Add("animator", new PropertyValue(_animator));
2140 _outputVisualMap = _transition;