Add a Shadow struct to pass data of DALi Shadow PropertyMap.
The Shadow struct can be used as an argument to
SetShadow and GetShadow methods.
// example
var shadow = new Tizen.NUI.Text.Shadow();
shadow.Offset = new Vector2(3, 3);
shadow.Color = new Color("#F1C40F");
shadow.BlurRadius = 4.0f;
label.SetShadow(shadow);
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
}
/// <summary>
+ /// Set Shadow to TextEditor. <br />
+ /// </summary>
+ /// <param name="shadow">The Shadow</param>
+ /// <remarks>
+ /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetShadow method.
+ /// <code>
+ /// var shadow = new Tizen.NUI.Text.Shadow();
+ /// shadow.Offset = new Vector2(3, 3);
+ /// shadow.Color = new Color("#F1C40F");
+ /// editor.SetShadow(shadow);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
+ {
+ SetProperty(TextEditor.Property.SHADOW, new PropertyValue(TextUtils.GetShadowMap(shadow)));
+ }
+
+ /// <summary>
+ /// Get Shadow from TextEditor. <br />
+ /// </summary>
+ /// <returns>The Shadow</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Shadow"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Text.Shadow GetShadow()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextEditor.Property.SHADOW).Get(map);
+ return TextUtils.GetShadowStruct(map);
+ }
+
+ /// <summary>
/// The InputShadow property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
/// <summary>
+ /// Set Shadow to TextField. <br />
+ /// </summary>
+ /// <param name="shadow">The Shadow</param>
+ /// <remarks>
+ /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetShadow method.
+ /// <code>
+ /// var shadow = new Tizen.NUI.Text.Shadow();
+ /// shadow.Offset = new Vector2(3, 3);
+ /// shadow.Color = new Color("#F1C40F");
+ /// field.SetShadow(shadow);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
+ {
+ SetProperty(TextField.Property.SHADOW, new PropertyValue(TextUtils.GetShadowMap(shadow)));
+ }
+
+ /// <summary>
+ /// Get Shadow from TextField. <br />
+ /// </summary>
+ /// <returns>The Shadow</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Shadow"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Text.Shadow GetShadow()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextField.Property.SHADOW).Get(map);
+ return TextUtils.GetShadowStruct(map);
+ }
+
+ /// <summary>
/// The InputShadow property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
/// <summary>
+ /// Set Shadow to TextLabel. <br />
+ /// </summary>
+ /// <param name="shadow">The Shadow</param>
+ /// <remarks>
+ /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetShadow method.
+ /// <code>
+ /// var shadow = new Tizen.NUI.Text.Shadow();
+ /// shadow.Offset = new Vector2(3, 3);
+ /// shadow.Color = new Color("#F1C40F");
+ /// shadow.BlurRadius = 4.0f;
+ /// label.SetShadow(shadow);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
+ {
+ SetProperty(TextLabel.Property.SHADOW, new PropertyValue(TextUtils.GetShadowMap(shadow)));
+ }
+
+ /// <summary>
+ /// Get Shadow from TextLabel. <br />
+ /// </summary>
+ /// <returns>The Shadow</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Shadow"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Text.Shadow GetShadow()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextLabel.Property.SHADOW).Get(map);
+ return TextUtils.GetShadowStruct(map);
+ }
+
+ /// <summary>
/// Describes a text shadow for a TextLabel.
/// It is null by default.
/// </summary>
return underline;
}
+ /// <summary>
+ /// This method converts a Shadow struct to a PropertyMap and returns it.
+ /// The returned map can be used for set Shadow PropertyMap in the SetShadow method.
+ /// <param name="shadow">The Shadow struct value.</param>
+ /// <returns> A PropertyMap for Shadow property. </returns>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static PropertyMap GetShadowMap(Tizen.NUI.Text.Shadow shadow)
+ {
+ var map = new PropertyMap();
+
+ if (shadow.Offset != null)
+ map.Add("offset", new PropertyValue(shadow.Offset));
+
+ if (shadow.Color != null)
+ map.Add("color", new PropertyValue(shadow.Color));
+
+ map.Add("blurRadius", new PropertyValue(shadow.BlurRadius));
+
+ return map;
+ }
+
+ /// <summary>
+ /// This method converts a Shadow map to a struct and returns it.
+ /// The returned struct can be returned to the user as a Shadow in the GetShadow method.
+ /// <param name="map">The Shadow PropertyMap.</param>
+ /// <returns> A Shadow struct. </returns>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Tizen.NUI.Text.Shadow GetShadowStruct(PropertyMap map)
+ {
+ Vector2 offset = new Vector2();
+ Color color = new Color();
+ map.Find(0, "offset").Get(offset);
+ map.Find(0, "color").Get(color);
+ map.Find(0, "blurRadius").Get(out float blurRadius);
+
+ var shadow = new Tizen.NUI.Text.Shadow();
+ shadow.Offset = offset;
+ shadow.Color = color;
+ shadow.BlurRadius = blurRadius;
+
+ return shadow;
+ }
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public float Height { get; set; }
}
+
+ /// <summary>
+ /// A struct to pass data of Shadow PropertyMap. <br />
+ /// </summary>
+ /// <remarks>
+ /// The Shadow struct is used as an argument to SetShadow and GetShadow methods. <br />
+ /// See <see cref="Tizen.NUI.BaseComponents.TextLabel.SetShadow"/>, <see cref="Tizen.NUI.BaseComponents.TextLabel.GetShadow"/>, <see cref="Tizen.NUI.BaseComponents.TextField.SetShadow"/>, <see cref="Tizen.NUI.BaseComponents.TextField.GetShadow"/>, <see cref="Tizen.NUI.BaseComponents.TextEditor.SetShadow"/> and <see cref="Tizen.NUI.BaseComponents.TextEditor.GetShadow"/>. <br />
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct Shadow
+ {
+ /// <summary>
+ /// The color of the shadow (the default color is Color.Black).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color Color { get; set; }
+
+ /// <summary>
+ /// The offset in pixels of the shadow (If not provided then the shadow is not enabled).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 Offset { get; set; }
+
+ /// <summary>
+ /// The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float BlurRadius { get; set; }
+ }
}
}