private float _depthIndex = 0.0f;
protected PropertyMap _outputVisualMap = null;
+
internal string Name
{
set;
}
}
+ protected PropertyMap _shader = null;
+ //private PropertyMap _transform = null;
+ protected bool? _premultipliedAlpha = null;
+ protected Color _mixColor = null;
+ protected float? _opacity = null;
+ protected PropertyMap _commonlyUsedMap = null;
+
+ /// <summary>
+ /// The shader to use in the visual.
+ /// </summary>
+ public PropertyMap Shader
+ {
+ get
+ {
+ return _shader;
+ }
+ set
+ {
+ _shader = value;
+ UpdateVisual();
+ }
+ }
+ /// <summary>
+ /// Enables/disables premultiplied alpha. <br>
+ /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type.
+ /// </summary>
+ public bool PremultipliedAlpha
+ {
+ get
+ {
+ return _premultipliedAlpha??false;
+ }
+ set
+ {
+ _premultipliedAlpha = value;
+ UpdateVisual();
+ }
+ }
+ /// <summary>
+ /// Mix color is a blend color for any visual.
+ /// </summary>
+ public Color MixColor
+ {
+ get
+ {
+ return _mixColor;
+ }
+ set
+ {
+ _mixColor = value;
+ UpdateVisual();
+ }
+ }
+ /// <summary>
+ /// Opacity is the alpha component of the mixColor, above.
+ /// </summary>
+ public float Opacity
+ {
+ get
+ {
+ return _opacity??(-1.0f);
+ }
+ set
+ {
+ _opacity = value;
+ UpdateVisual();
+ }
+ }
+
}
/// <summary>
if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); }
if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); }
if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
-
}
/// <summary>
if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); }
if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); }
if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
if (_color != null) { _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); }
if (_size != null) { _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); }
if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
{
}
- private Color _mixColor = null;
+ private Color _mixColorForColorVisual = null;
/// <summary>
/// Get or set the solid color required.
/// </summary>
- public Color MixColor
+ public Color Color
{
get
{
- return _mixColor;
+ return _mixColorForColorVisual;
}
set
{
- _mixColor = value;
+ _mixColorForColorVisual = value;
UpdateVisual();
}
}
{
_outputVisualMap = new PropertyMap();
_outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
- if (_mixColor != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColor)); }
+ if (_mixColorForColorVisual != null) { _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
if (_stopColor != null) { _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); }
if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); }
if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); }
if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
+
}
}
}
private PrimitiveVisualShapeType? _shape = null;
- private Color _mixColor = null;
+ private Color _mixColorForPrimitiveVisual = null;
private int? _slices = null;
private int? _stacks = null;
private float? _scaleTopRadius = null;
{
get
{
- return _mixColor;
+ return _mixColorForPrimitiveVisual;
}
set
{
- _mixColor = value;
+ _mixColorForPrimitiveVisual = value;
UpdateVisual();
}
}
_outputVisualMap = new PropertyMap(); ;
_outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive));
if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); }
- if (_mixColor != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColor)); }
+ if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); }
if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); }
if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); }
if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); }
if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); }
if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); }
if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
if (_url != null) { _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); }
if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
+
}
}
/// <summary>
- /// This specifies wrap mode types
+ /// This specifies wrap mode types <br>
+ /// 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.
/// </summary>
public enum WrapModeType
{
+ /// <summary>
+ /// Defualt value
+ /// </summary>
Default = 0,
+ /// <summary>
+ /// Clamp to edge
+ /// </summary>
ClampToEdge,
+ /// <summary>
+ /// Repeat
+ /// </summary>
Repeat,
+ /// <summary>
+ /// Mirrored repeat
+ /// </summary>
MirroredRepeat
}
/// <summary>
- /// This specifies all kind os types of coordinate system for certain attributes of the points in a gradient.
+ /// The type of coordinate system for certain attributes of the points in a gradient.
/// </summary>
public enum GradientVisualUnitsType
{
+ /// <summary>
+ /// 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).
+ /// </summary>
ObjectBoundingBox,
+ /// <summary>
+ /// 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).
+ /// </summary>
UserSpace
}
/// </summary>
public enum GradientVisualSpreadMethodType
{
+ /// <summary>
+ /// Uses the terminal colors of the gradient to fill the remainder of the quad.
+ /// </summary>
Pad,
+ /// <summary>
+ /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled.
+ /// </summary>
Reflect,
+ /// <summary>
+ /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled.
+ /// </summary>
Repeat
}
/// <summary>
- /// This specifies shading mode types.
+ /// The shading mode used by MeshVisual.
/// </summary>
public enum MeshVisualShadingModeValue
{
+ /// <summary>
+ /// *Simplest*. One color that is lit by ambient and diffuse lighting.
+ /// </summary>
TexturelessWithDiffuseLighting,
+ /// <summary>
+ /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting.
+ /// </summary>
TexturedWithSpecularLighting,
+ /// <summary>
+ /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting.
+ /// </summary>
TexturedWithDetailedSpecularLighting
}
/// <summary>
- /// This specifies shape types.
+ /// The primitive shape to render as a PrimitiveVisual.
/// </summary>
public enum PrimitiveVisualShapeType
{
+ /// <summary>
+ /// A perfectly round geometrical object in three-dimensional space.
+ /// </summary>
Sphere,
+ /// <summary>
+ /// The area bound between two circles, i.e. a cone with the tip removed.
+ /// </summary>
ConicalFrustrum,
+ /// <summary>
+ /// Equivalent to a conical frustrum with top radius of zero.
+ /// </summary>Equivalent to a conical frustrum with top radius of zero.
Cone,
+ /// <summary>
+ /// Equivalent to a conical frustrum with top radius of zero.
+ /// </summary>
Cylinder,
+ /// <summary>
+ /// Equivalent to a conical frustrum with equal radii for the top and bottom circles.
+ /// </summary>
Cube,
+ /// <summary>
+ /// Equivalent to a bevelled cube with a bevel percentage of zero.
+ /// </summary>
Octahedron,
+ /// <summary>
+ /// Equivalent to a bevelled cube with a bevel percentage of one.
+ /// </summary>
BevelledCube
}
/// </summary>
public enum FittingModeType
{
+ /// <summary>
+ /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode.
+ /// </summary>
ShrinkToFit,
+ /// <summary>
+ /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode.
+ /// </summary>
ScaleToFill,
+ /// <summary>
+ /// Image columns: Limit loaded image resolution to column width using FitWidth mode.
+ /// </summary>
FitWidth,
+ /// <summary>
+ /// Image rows: Limit loaded image resolution to row height using FitHeight mode.
+ /// </summary>
FitHeight
}
/// <summary>
/// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.<br>
/// 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>
- /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,
+ /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,<br>
/// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.<br>
/// </summary>
public enum SamplingModeType
{
+ /// <summary>
+ /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size. <br>
+ /// This is the default.
+ /// </summary>
Box,
+ /// <summary>
+ /// For each output pixel, read one input pixel.
+ /// </summary>
Nearest,
+ /// <summary>
+ /// For each output pixel, read a quad of four input pixels and write a weighted average of them.
+ /// </summary>
Linear,
+ /// <summary>
+ /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size, <br>
+ /// then for each output pixel, read one pixel from the last level of box filtering.<br>
+ /// </summary>
BoxThenNearest,
+ /// <summary>
+ /// 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.
+ /// </summary>
BoxThenLinear,
+ /// <summary>
+ /// 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.
+ /// </summary>
NoFilter,
+ /// <summary>
+ /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image.
+ /// </summary>
DontCare
}
/// </summary>
public enum VisualTransformPolicyType
{
+ /// <summary>
+ /// Relative to the control (percentage [0.0f to 1.0f] of the control).
+ /// </summary>
Relative = 0,
+ /// <summary>
+ /// Absolute value in world units.
+ /// </summary>
Absolute = 1
}
/// </summary>
public enum VisualTransformPropertyType
{
+ /// <summary>
+ /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
+ /// </summary>
Offset,
+ /// <summary>
+ /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
+ /// </summary>
Size,
+ /// <summary>
+ /// The origin of the visual within its control area.
+ /// </summary>
Origin,
+ /// <summary>
+ /// The anchor-point of the visual
+ /// </summary>
AnchorPoint,
+ /// <summary>
+ /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// </summary>
OffsetPolicy,
+ /// <summary>
+ /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// </summary>
SizePolicy
}
/// </summary>
public struct Visual
{
+ /// <summary>
+ /// The index for the visual type.
+ /// </summary>
public enum Type
{
+ /// <summary>
+ /// Renders a solid color as an internal border to the control's quad.
+ /// </summary>
Border,
+ /// <summary>
+ /// Renders a solid color to the control's quad.
+ /// </summary>
Color,
+ /// <summary>
+ /// Renders a smooth transition of colors to the control's quad.
+ /// </summary>
Gradient,
+ /// <summary>
+ /// Renders an image into the control's quad.
+ /// </summary>
Image,
+ /// <summary>
+ /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file.
+ /// </summary>
Mesh,
+ /// <summary>
+ /// Renders a simple 3D shape, such as a cube or sphere.
+ /// </summary>
Primitive,
+ /// <summary>
+ /// Renders a simple wire-frame outlining a quad.
+ /// </summary>
Wireframe,
+ /// <summary>
+ /// Renders text.
+ /// </summary>
Text,
+ /// <summary>
+ /// Renders an n-patch image.
+ /// </summary>
NPatch,
+ /// <summary>
+ /// Renders an SVG image.
+ /// </summary>
SVG,
+ /// <summary>
+ /// Renders a animated image. (Animated GIF)
+ /// </summary>
AnimatedImage
}
public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM;
public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA;
public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR;
+ public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1;
}
/// <summary>
_outputVisualMap = new PropertyMap();
_outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
_outputVisualMap = new PropertyMap();
_outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
if (_url != null) { _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); }
+ if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); }
+ if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
+ if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); }
+ if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
}
}
string _str1 = _propertyIndex.Substring(0, 1);
string _str2 = _propertyIndex.Substring(1);
string _str = _str1.ToLower() + _str2;
-
- //dynamic _obj = (object)_destinationValue;
+
PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
PropertyMap _transition = new PropertyMap();
_transition.Add("target", new PropertyValue(_target));
_transition.Add("property", new PropertyValue(_str));
- _transition.Add("targetValue", new PropertyValue(val));
+ _transition.Add("targetValue", val);
_transition.Add("animator", new PropertyValue(_animator));
_outputVisualMap = _transition;