From f7ff125676ad36176185b725c62187bbe8e1b015 Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Mon, 3 Jun 2019 13:40:45 +0900 Subject: [PATCH] [NUI] Add ImageView APIs (#872) * [NUI] Add ImageView APIs AlphaMaskURL CropToMask FittingMode DesiredWidth DesiredHeight WrapModeU WrapModeV Signed-off-by: huiyu.eun * [NUI] Fix URL Signed-off-by: huiyu.eun --- .../src/public/BaseComponents/ImageView.cs | 227 ++++++++++++++++++ src/Tizen.NUI/src/public/VisualMaps.cs | 2 +- 2 files changed, 228 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index b36d15bda..9c27b0116 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -332,6 +332,15 @@ namespace Tizen.NUI.BaseComponents _url = (value == null ? "" : value); SetValue(ResourceUrlProperty, _url); NotifyPropertyChanged(); + + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.URL, new PropertyValue(value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + } } @@ -598,6 +607,224 @@ namespace Tizen.NUI.BaseComponents this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0)); } + /// + /// Gets or sets the URL of the alpha mask.
+ /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public string AlphaMaskURL + { + get + { + string ret = ""; + Image.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret); + + return ret; + } + set + { + if (value == null) + { + value = ""; + } + + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + + /// + /// Whether to crop image to mask or scale mask to fit image. + /// + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public bool CropToMask + { + get + { + bool ret = false; + Image.Find(ImageVisualProperty.CropToMask)?.Get(out ret); + + return ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.CropToMask, new PropertyValue(value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + + /// + /// Gets or sets fitting options used when resizing images to fit the desired dimensions.
+ /// If not supplied, the default is FittingModeType.ShrinkToFit.
+ /// For normal quad images only.
+ /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public FittingModeType FittingMode + { + get + { + int ret = (int)FittingModeType.ShrinkToFit; + Image.Find(ImageVisualProperty.FittingMode)?.Get(out ret); + + return (FittingModeType)ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + + + /// + /// Gets or sets the desired image width.
+ /// If not specified, the actual image width is used.
+ /// For normal quad images only.
+ /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public int DesiredWidth + { + get + { + int ret = -1; + Image.Find(ImageVisualProperty.DesiredWidth)?.Get(out ret); + + return ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.DesiredWidth, new PropertyValue(value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + /// + /// Gets or sets the desired image height.
+ /// If not specified, the actual image height is used.
+ /// For normal quad images only.
+ /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public int DesiredHeight + { + get + { + int ret = -1; + Image.Find(ImageVisualProperty.DesiredHeight)?.Get(out ret); + + return ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.DesiredHeight, new PropertyValue(value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + + /// + /// Gets or sets the wrap mode for the u coordinate.
+ /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.
+ /// If not specified, the default is WrapModeType.Default(CLAMP).
+ /// For normal quad images only.
+ /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public WrapModeType WrapModeU + { + get + { + int ret = (int)WrapModeType.Default; + Image.Find(ImageVisualProperty.WrapModeU)?.Get(out ret); + + return (WrapModeType)ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.WrapModeU, new PropertyValue((int)value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + + /// + /// Gets or sets the wrap mode for the v coordinate.
+ /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.
+ /// The first two elements indicate the top-left position of the area, and the last two elements are the areas of the width and the height respectively.
+ /// If not specified, the default is WrapModeType.Default(CLAMP).
+ /// For normal quad images only. + /// Optional. + ///
+ /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public WrapModeType WrapModeV + { + get + { + int ret = (int)WrapModeType.Default; + Image.Find(ImageVisualProperty.WrapModeV)?.Get(out ret); + + return (WrapModeType)ret; + } + set + { + PropertyMap temp = new PropertyMap(); + temp.Insert(ImageVisualProperty.WrapModeV, new PropertyValue((int)value)); + + PropertyMap imageMap = Image; + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + } + } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 36589c19e..0dde4804b 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -697,7 +697,7 @@ namespace Tizen.NUI } set { - _url = value; + _url = (value == null ? "" : value); UpdateVisual(); } } -- 2.34.1